Skip to content

Commit e71be7a

Browse files
committed
Examples updated with newer models
1 parent 0ad460a commit e71be7a

5 files changed

+12
-14
lines changed

openai-examples/src/main/scala/io/cequence/openaiscala/examples/adapters/ChatCompletionStreamedRouterWithFullServiceExample.scala

+3-4
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,7 @@ object ChatCompletionStreamedRouterWithFullServiceExample
5050
octoMLService -> Seq(NonOpenAIModelId.mixtral_8x7b_instruct),
5151
ollamaService -> Seq(NonOpenAIModelId.llama2),
5252
anthropicService -> Seq(
53-
NonOpenAIModelId.claude_2_1,
54-
NonOpenAIModelId.claude_3_haiku_20240307
53+
NonOpenAIModelId.claude_3_5_haiku_20241022
5554
)
5655
),
5756
defaultService = openAIService
@@ -75,10 +74,10 @@ object ChatCompletionStreamedRouterWithFullServiceExample
7574
_ <- runChatCompletionAux(NonOpenAIModelId.llama2)
7675

7776
// runs on Anthropic
78-
_ <- runChatCompletionAux(NonOpenAIModelId.claude_3_haiku_20240307)
77+
_ <- runChatCompletionAux(NonOpenAIModelId.claude_3_5_haiku_20241022)
7978

8079
// runs on OpenAI
81-
_ <- runChatCompletionAux(ModelId.gpt_3_5_turbo)
80+
_ <- runChatCompletionAux(ModelId.gpt_4o)
8281

8382
// runs on OpenAI (non-chat-completion function)
8483
_ <- service.listModels.map(_.foreach(println))

openai-examples/src/main/scala/io/cequence/openaiscala/examples/adapters/ChatCompletionStreamedRouterWithMappedModelsExample.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ object ChatCompletionStreamedRouterWithMappedModelsExample
7474
_ <- runChatCompletionAux("ollama-" + NonOpenAIModelId.llama2)
7575

7676
// runs on OpenAI
77-
_ <- runChatCompletionAux(ModelId.gpt_3_5_turbo)
77+
_ <- runChatCompletionAux(ModelId.gpt_4o)
7878
} yield ()
7979

8080
private def runChatCompletionAux(model: String) = {

openai-examples/src/main/scala/io/cequence/openaiscala/examples/adapters/RandomOrderAdapterExample.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ object RandomOrderAdapterExample extends ExampleBase[OpenAIService] {
3030

3131
private val repetitions = 10
3232
private val parallelism = 1
33-
private val modelId = ModelId.gpt_3_5_turbo
33+
private val modelId = ModelId.gpt_4o
3434

3535
private val messages = Seq(
3636
SystemMessage("You are a helpful assistant."),

openai-examples/src/main/scala/io/cequence/openaiscala/examples/adapters/RetryAdapterExample.scala

+5-6
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ object RetryAdapterExample extends ExampleBase[OpenAIService] {
2727
() => Future(throw new OpenAIScalaClientTimeoutException("Fake timeout"))
2828
)
2929

30-
// we then map the failing service to a specific model - gpt-3.5-turbo-1106
30+
// we then map the failing service to a specific model - gpt_4o
3131
// for all other models we use the regular service
3232
private val mergedService = adapters.chatCompletionRouter(
33-
serviceModels = Map(failingService -> Seq(ModelId.gpt_3_5_turbo_1106)),
33+
serviceModels = Map(failingService -> Seq(ModelId.gpt_4o)),
3434
regularService
3535
)
3636

@@ -48,13 +48,12 @@ object RetryAdapterExample extends ExampleBase[OpenAIService] {
4848
override protected def run: Future[_] =
4949
for {
5050
// this invokes the failing service, which triggers the retry mechanism
51-
_ <- runChatCompletionAux(ModelId.gpt_3_5_turbo_1106).recover {
52-
case e: OpenAIScalaClientException =>
53-
println(s"Too many retries, giving up on '${e.getMessage}'")
51+
_ <- runChatCompletionAux(ModelId.gpt_4o).recover { case e: OpenAIScalaClientException =>
52+
println(s"Too many retries, giving up on '${e.getMessage}'")
5453
}
5554

5655
// should complete without retry
57-
_ <- runChatCompletionAux(ModelId.gpt_3_5_turbo_0125)
56+
_ <- runChatCompletionAux(ModelId.o3_mini)
5857
} yield ()
5958

6059
private def runChatCompletionAux(model: String) = {

openai-examples/src/main/scala/io/cequence/openaiscala/examples/adapters/RoundRobinAdapterExample.scala

+2-2
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@ object RoundRobinAdapterExample extends ExampleBase[OpenAIService] {
3535
override protected def run: Future[_] =
3636
for {
3737
// runs on the first service
38-
_ <- runChatCompletionAux(ModelId.gpt_3_5_turbo)
38+
_ <- runChatCompletionAux(ModelId.gpt_4o)
3939

4040
// runs on the second service
41-
_ <- runChatCompletionAux(ModelId.gpt_3_5_turbo)
41+
_ <- runChatCompletionAux(ModelId.gpt_4o)
4242
} yield ()
4343

4444
private def runChatCompletionAux(model: String) = {

0 commit comments

Comments
 (0)