You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add usage example to ChatLanguageModelExtensions documentation
Included a Kotlin code snippet demonstrating how to use the `chatAsync` function with a `ChatRequestBuilder`. This improves clarity and provides developers with a concrete example for better understanding and implementation.
Copy file name to clipboardExpand all lines: langchain4j-kotlin/src/main/kotlin/me/kpavlov/langchain4j/kotlin/model/chat/ChatLanguageModelExtensions.kt
+11Lines changed: 11 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -67,6 +67,17 @@ suspend fun ChatLanguageModel.chatAsync(requestBuilder: ChatRequest.Builder): Ch
67
67
* of well-structured chat requests using a `ChatRequestBuilder` and
68
68
* executes the request using the associated `ChatLanguageModel`.
69
69
*
70
+
* Example usage:
71
+
* ```kotlin
72
+
* model.chatAsync {
73
+
* messages += systemMessage("You are a helpful assistant")
74
+
* messages += userMessage("Say Hello")
75
+
* parameters {
76
+
* temperature(0.1)
77
+
* }
78
+
* }
79
+
* ```
80
+
*
70
81
* @param block A lambda with receiver on `ChatRequestBuilder` used to
71
82
* configure the messages and parameters for the chat request.
72
83
* @return A `ChatResponse` containing the response from the model and any
0 commit comments