Skip to content

Commit

Permalink
scalafmt
Browse files Browse the repository at this point in the history
  • Loading branch information
bburdiliak committed Nov 12, 2024
1 parent 9ad8ab1 commit 4f5d348
Show file tree
Hide file tree
Showing 14 changed files with 9 additions and 20 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package io.cequence.openaiscala.anthropic

import io.cequence.openaiscala.anthropic.domain.CacheControl.Ephemeral
import io.cequence.openaiscala.anthropic.domain.Content.ContentBlock.{MediaBlock, TextBlock}
import io.cequence.openaiscala.anthropic.domain.Content.{
ContentBlockBase,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package io.cequence.openaiscala.anthropic.domain

import io.cequence.openaiscala.anthropic.domain.Content.{
ContentBlock,
ContentBlockBase,
ContentBlocks,
SingleString
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ private[service] trait AnthropicServiceImpl extends Anthropic {
val messageJsons = messages.map(Json.toJson(_))

val systemJson = system.map {
case single @ Content.SingleString(text, cacheControl) =>
case Content.SingleString(text, cacheControl) =>
if (cacheControl.isEmpty) JsString(text)
else {
val blocks =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package io.cequence.openaiscala.anthropic.service.impl

import akka.NotUsed
import akka.stream.scaladsl.Source
import io.cequence.openaiscala.anthropic.domain.Content
import io.cequence.openaiscala.anthropic.service.AnthropicService
import io.cequence.openaiscala.domain.BaseMessage
import io.cequence.openaiscala.domain.response.{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ package object impl extends AnthropicServiceConsts {
.foldLeft((List.empty[Message], countUserMessagesToCache)) {
case ((acc, userMessagesToCache), message) =>
message match {
case Message.UserMessage(contentString, cacheControl) =>
case Message.UserMessage(contentString, _) =>
val newCacheControl = if (userMessagesToCache > 0) Some(Ephemeral) else None
(
acc :+ Message.UserMessage(contentString, newCacheControl),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import io.cequence.openaiscala.service.adapter.{
import io.cequence.openaiscala.service.{OpenAIChatCompletionService, OpenAIServiceConsts}
import io.cequence.wsclient.JsonUtil
import io.cequence.wsclient.ResponseImplicits._
import io.cequence.wsclient.service.WSClient
import io.cequence.wsclient.service.WSClientWithEngineTypes.WSClientWithEngine
import play.api.libs.json.{JsObject, JsValue, Json}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,15 +87,15 @@ object Batch {
request_counts: Map[String, Int],
metadata: Option[Map[String, String]]
) {
def isRunning =
def isRunning: Boolean =
List("in_progress", "validating", "finalizing", "cancelling").contains(status)

// "failed", "completed", "expired", "cancelled"
def isFinished = !isRunning
def isFinished: Boolean = !isRunning

def isSuccess = status == "completed"
def isSuccess: Boolean = status == "completed"

def isFailedOrCancelledOrExpired = isFinished && !isSuccess
def isFailedOrCancelledOrExpired: Boolean = isFinished && !isSuccess
}

case class BatchProcessingErrors(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ package io.cequence.openaiscala.domain.settings

import io.cequence.wsclient.domain.EnumValue

import scala.util.Try

case class CreateChatCompletionSettings(
// ID of the model to use. Currently, only gpt-3.5-turbo and gpt-3.5-turbo-0301 are supported.
model: String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ object OpenAIChatCompletionExtra {
settings: CreateChatCompletionSettings,
taskNameForLogging: String,
jsonSchemaModels: Seq[String] = defaultJsonSchemaModels
) = {
): (Seq[BaseMessage], CreateChatCompletionSettings) = {
val jsonSchemaDef = settings.jsonSchema.getOrElse(
throw new IllegalArgumentException("JSON schema is not defined but expected.")
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package io.cequence.openaiscala.service.adapter

import io.cequence.openaiscala.domain.response.ResponseFormat
import io.cequence.openaiscala.domain.settings.{
ChatCompletionResponseFormatType,
CreateChatCompletionSettings
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package io.cequence.openaiscala.service.adapter

import akka.actor.Scheduler
import io.cequence.openaiscala.{RetryHelpers, Retryable}
import io.cequence.openaiscala.RetryHelpers
import io.cequence.openaiscala.RetryHelpers.RetrySettings
import io.cequence.wsclient.service.CloseableService

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package io.cequence.openaiscala.examples.adapter

import akka.actor.Scheduler
import io.cequence.openaiscala.{OpenAIScalaClientException, OpenAIScalaClientTimeoutException}
import io.cequence.openaiscala.RetryHelpers.RetrySettings
import io.cequence.openaiscala.domain.settings.CreateChatCompletionSettings
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,9 @@ import io.cequence.openaiscala.anthropic.service.{AnthropicService, AnthropicSer
import io.cequence.openaiscala.domain.NonOpenAIModelId
import io.cequence.openaiscala.examples.ExampleBase

import java.awt.image.RenderedImage
import java.io.{ByteArrayOutputStream, File}
import java.io.File
import java.nio.file.Files
import java.util.Base64
import javax.imageio.ImageIO
import scala.concurrent.Future

// requires `openai-scala-anthropic-client` as a dependency
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package io.cequence.openaiscala.examples.nonopenai

import io.cequence.openaiscala.anthropic.domain.CacheControl.Ephemeral
import io.cequence.openaiscala.anthropic.domain.Content.ContentBlock.TextBlock
import io.cequence.openaiscala.anthropic.domain.Content.{ContentBlockBase, SingleString}
import io.cequence.openaiscala.anthropic.domain.{Content, Message}
Expand Down

0 comments on commit 4f5d348

Please sign in to comment.