-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ceda68c
commit 1ad4529
Showing
2 changed files
with
34 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
...examples/src/main/scala/io/cequence/openaiscala/examples/CreateChatCompletionWithO1.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package io.cequence.openaiscala.examples | ||
|
||
import io.cequence.openaiscala.domain._ | ||
import io.cequence.openaiscala.domain.settings.{ | ||
ChatCompletionResponseFormatType, | ||
CreateChatCompletionSettings | ||
} | ||
|
||
import scala.concurrent.Future | ||
|
||
object CreateChatCompletionWithO1 extends Example { | ||
|
||
private val messages = Seq( | ||
// system message still works for O1 models but moving forward DeveloperMessage should be used instead | ||
SystemMessage("You are a helpful weather assistant who likes to make jokes."), | ||
UserMessage("What is the weather like in Norway per major cities? Answer in json format.") | ||
) | ||
|
||
override protected def run: Future[_] = | ||
service | ||
.createChatCompletion( | ||
messages = messages, | ||
settings = CreateChatCompletionSettings( | ||
model = ModelId.o1, | ||
temperature = Some(0.1), | ||
response_format_type = Some(ChatCompletionResponseFormatType.json_object), | ||
max_tokens = Some(4000) | ||
) | ||
) | ||
.map { content => | ||
printMessageContent(content) | ||
} | ||
} |