Skip to content

Commit

Permalink
Special handling for O1 models (chat completion)
Browse files Browse the repository at this point in the history
  • Loading branch information
peterbanda committed Sep 17, 2024
1 parent 1bdb8d3 commit 452eaaf
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion openai-count-tokens/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ The currently supported Scala versions are **2.12, 2.13**, and **3**.
To pull the library you have to add the following dependency to your *build.sbt*

```
"io.cequence" %% "openai-scala-count-tokens" % "1.0.0"
"io.cequence" %% "openai-scala-count-tokens" % "1.1.0"
```

or to *pom.xml* (if you use maven)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package io.cequence.openaiscala.examples

import io.cequence.openaiscala.domain.settings.CreateChatCompletionSettings
import io.cequence.openaiscala.domain.settings.{ChatCompletionResponseFormatType, CreateChatCompletionSettings}
import io.cequence.openaiscala.domain._

import scala.concurrent.Future

object CreateChatCompletion extends Example {

private val messages = Seq(
SystemMessage("You are a helpful assistant."),
SystemMessage("You are a helpful weather assistant."),
UserMessage("What is the weather like in Norway?")
)

Expand All @@ -17,9 +17,9 @@ object CreateChatCompletion extends Example {
.createChatCompletion(
messages = messages,
settings = CreateChatCompletionSettings(
model = ModelId.gpt_4o_2024_05_13,
model = ModelId.o1_mini,
temperature = Some(0),
max_tokens = Some(100)
max_tokens = Some(4000)
)
)
.map { content =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,7 @@ trait ExampleBase[T <: CloseableService] {

protected def printMessageContent(response: ChatCompletionResponse): Unit =
println(response.choices.head.message.content)

protected def messageContent(response: ChatCompletionResponse): String =
response.choices.head.message.content
}

0 comments on commit 452eaaf

Please sign in to comment.