-
Notifications
You must be signed in to change notification settings - Fork 24
/
TogetherAICreateChatCompletion.scala
37 lines (30 loc) · 1.14 KB
/
TogetherAICreateChatCompletion.scala
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package io.cequence.openaiscala.examples.nonopenai
import io.cequence.openaiscala.domain._
import io.cequence.openaiscala.domain.settings.CreateChatCompletionSettings
import io.cequence.openaiscala.examples.ExampleBase
import io.cequence.openaiscala.service.OpenAIChatCompletionService
import scala.concurrent.Future
/**
* Requires `TOGETHERAI_API_KEY` environment variable to be set.
*/
object TogetherAICreateChatCompletion extends ExampleBase[OpenAIChatCompletionService] {
override val service: OpenAIChatCompletionService = ChatCompletionProvider.togetherAI
private val messages = Seq(
SystemMessage("You are a helpful assistant."),
UserMessage("What is the weather like in Norway?")
)
private val modelId = NonOpenAIModelId.deepseek_ai_deepseek_v3 // yi_34b_chat
override protected def run: Future[_] =
service
.createChatCompletion(
messages = messages,
settings = CreateChatCompletionSettings(
model = modelId,
temperature = Some(0.1),
max_tokens = Some(512),
top_p = Some(0.9),
presence_penalty = Some(0)
)
)
.map(printMessageContent)
}