File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -170,6 +170,25 @@ Examples:
170
170
```
171
171
(For this to work you need to use ` OpenAIServiceStreamedFactory ` from ` openai-scala-client-stream ` lib)
172
172
173
+ - Create chat completion
174
+
175
+ ``` scala
176
+ val createChatCompletionSettings = CreateChatCompletionSettings (
177
+ model = ModelId .gpt_3_5_turbo_0301
178
+ )
179
+
180
+ val messages : Seq [MessageSpec ] = Seq (
181
+ MessageSpec (role = ChatRole .System , content = " You are a helpful assistant." ),
182
+ MessageSpec (role = ChatRole .User , content = " Who won the world series in 2020?" ),
183
+ MessageSpec (role = ChatRole .Assistant , content = " The Los Angeles Dodgers won the World Series in 2020." ),
184
+ MessageSpec (role = ChatRole .User , content = " Where was it played" ),
185
+ )
186
+
187
+ service.createChatCompletion(messages = messages, settings = createChatCompletionSettings).map { chatCompletion =>
188
+ println(chatCompletion.choices.head.message.content)
189
+ }
190
+ ```
191
+
173
192
## FAQ 🤔
174
193
175
194
1 . _ Wen Scala 3?_
You can’t perform that action at this time.
0 commit comments