Skip to content

Commit 59f1add

Browse files
Konstantin PavlovKonstantin Pavlov
Konstantin Pavlov
authored and
Konstantin Pavlov
committed
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.
1 parent 900bc3d commit 59f1add

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

langchain4j-kotlin/src/main/kotlin/me/kpavlov/langchain4j/kotlin/model/chat/ChatLanguageModelExtensions.kt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,17 @@ suspend fun ChatLanguageModel.chatAsync(requestBuilder: ChatRequest.Builder): Ch
6767
* of well-structured chat requests using a `ChatRequestBuilder` and
6868
* executes the request using the associated `ChatLanguageModel`.
6969
*
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+
*
7081
* @param block A lambda with receiver on `ChatRequestBuilder` used to
7182
* configure the messages and parameters for the chat request.
7283
* @return A `ChatResponse` containing the response from the model and any

0 commit comments

Comments
 (0)