Skip to content

Commit 7e5d455

Browse files
committed
Formatting
1 parent a8dfef8 commit 7e5d455

File tree

3 files changed

+22
-9
lines changed

3 files changed

+22
-9
lines changed

anthropic-client/src/main/scala/io/cequence/openaiscala/anthropic/service/impl/package.scala

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -103,11 +103,12 @@ package object impl extends AnthropicServiceConsts {
103103

104104
case Message.UserMessageContent(contentBlocks) =>
105105
val (newContentBlocks, remainingCache) =
106-
contentBlocks.foldLeft((Seq.empty[ContentBlockBase], userMessagesToCacheCount)) {
107-
case ((acc, cacheLeft), content) =>
108-
val (block, newCacheLeft) =
109-
toAnthropic(cacheLeft)(content.asInstanceOf[OpenAIContent])
110-
(acc :+ block, newCacheLeft)
106+
contentBlocks.foldLeft(
107+
(Seq.empty[ContentBlockBase], userMessagesToCacheCount)
108+
) { case ((acc, cacheLeft), content) =>
109+
val (block, newCacheLeft) =
110+
toAnthropic(cacheLeft)(content.asInstanceOf[OpenAIContent])
111+
(acc :+ block, newCacheLeft)
111112
}
112113
(acc :+ Message.UserMessageContent(newContentBlocks), remainingCache)
113114

openai-client-stream/src/main/scala/io/cequence/openaiscala/service/OpenAIStreamedServiceImplicits.scala

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,20 @@ import akka.NotUsed
44
import akka.stream.Materializer
55
import akka.stream.scaladsl.Source
66
import io.cequence.openaiscala.domain.BaseMessage
7-
import io.cequence.openaiscala.domain.response.{ChatCompletionChunkResponse, TextCompletionResponse}
8-
import io.cequence.openaiscala.domain.settings.{CreateChatCompletionSettings, CreateCompletionSettings}
7+
import io.cequence.openaiscala.domain.response.{
8+
ChatCompletionChunkResponse,
9+
TextCompletionResponse
10+
}
11+
import io.cequence.openaiscala.domain.settings.{
12+
CreateChatCompletionSettings,
13+
CreateCompletionSettings
14+
}
915
import io.cequence.openaiscala.service.StreamedServiceTypes.OpenAIStreamedService
10-
import io.cequence.openaiscala.service.adapter.{OpenAIChatCompletionServiceWrapper, OpenAICoreServiceWrapper, OpenAIServiceWrapper}
16+
import io.cequence.openaiscala.service.adapter.{
17+
OpenAIChatCompletionServiceWrapper,
18+
OpenAICoreServiceWrapper,
19+
OpenAIServiceWrapper
20+
}
1121
import io.cequence.wsclient.domain.WsRequestContext
1222
import io.cequence.wsclient.service.CloseableService
1323
import io.cequence.wsclient.service.adapter.ServiceWrapperTypes.CloseableServiceWrapper

openai-examples/src/main/scala/io/cequence/openaiscala/examples/nonopenai/AnthropicCreateChatCompletionCachedWithOpenAIAdapter.scala

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ object AnthropicCreateChatCompletionCachedWithOpenAIAdapter
2626
messages = messages,
2727
settings = CreateChatCompletionSettings(
2828
NonOpenAIModelId.claude_3_5_sonnet_20241022
29-
).setUseAnthropicSystemMessagesCache(true), // this is how we pass it through the adapter
29+
).setUseAnthropicSystemMessagesCache(
30+
true
31+
) // this is how we pass it through the adapter
3032
)
3133
.map { content =>
3234
println(content.choices.headOption.map(_.message.content).getOrElse("N/A"))

0 commit comments

Comments
 (0)