From 6fab023c1ba198e5274fdc7e4acb0f10e8039c82 Mon Sep 17 00:00:00 2001 From: peterbanda Date: Mon, 27 Nov 2023 23:06:07 +0100 Subject: [PATCH] GPTVision examples renamed --- .../io/cequence/openaiscala/service/OpenAICoreService.scala | 2 +- .../io/cequence/openaiscala/service/OpenAIService.scala | 2 +- ....scala => CreateChatCompletionVisionWithLocalFile.scala} | 6 +++--- ...ithURL.scala => CreateChatCompletionVisionWithURL.scala} | 6 +++--- .../{CreateEditImage.scala => CreateImageEdit.scala} | 2 +- .../scala/io/cequence/openaiscala/examples/Example.scala | 1 - 6 files changed, 9 insertions(+), 10 deletions(-) rename openai-examples/src/main/scala/io/cequence/openaiscala/examples/{GPTVisionWithLocalFile.scala => CreateChatCompletionVisionWithLocalFile.scala} (91%) rename openai-examples/src/main/scala/io/cequence/openaiscala/examples/{GPTVisionWithURL.scala => CreateChatCompletionVisionWithURL.scala} (86%) rename openai-examples/src/main/scala/io/cequence/openaiscala/examples/{CreateEditImage.scala => CreateImageEdit.scala} (94%) diff --git a/openai-core/src/main/scala/io/cequence/openaiscala/service/OpenAICoreService.scala b/openai-core/src/main/scala/io/cequence/openaiscala/service/OpenAICoreService.scala index 46932cec..e67cc7f1 100644 --- a/openai-core/src/main/scala/io/cequence/openaiscala/service/OpenAICoreService.scala +++ b/openai-core/src/main/scala/io/cequence/openaiscala/service/OpenAICoreService.scala @@ -2,7 +2,7 @@ package io.cequence.openaiscala.service import io.cequence.openaiscala.domain.response._ import io.cequence.openaiscala.domain.settings._ -import io.cequence.openaiscala.domain.{BaseMessage, SystemMessage} +import io.cequence.openaiscala.domain.BaseMessage import scala.concurrent.Future diff --git a/openai-core/src/main/scala/io/cequence/openaiscala/service/OpenAIService.scala b/openai-core/src/main/scala/io/cequence/openaiscala/service/OpenAIService.scala index cc4089fe..98608e5c 100644 --- a/openai-core/src/main/scala/io/cequence/openaiscala/service/OpenAIService.scala +++ b/openai-core/src/main/scala/io/cequence/openaiscala/service/OpenAIService.scala @@ -1,6 +1,6 @@ package io.cequence.openaiscala.service -import io.cequence.openaiscala.domain.{BaseMessage, FunMessage, FunctionSpec, ToolSpec} +import io.cequence.openaiscala.domain.{BaseMessage, FunctionSpec, ToolSpec} import io.cequence.openaiscala.domain.settings._ import io.cequence.openaiscala.domain.response._ diff --git a/openai-examples/src/main/scala/io/cequence/openaiscala/examples/GPTVisionWithLocalFile.scala b/openai-examples/src/main/scala/io/cequence/openaiscala/examples/CreateChatCompletionVisionWithLocalFile.scala similarity index 91% rename from openai-examples/src/main/scala/io/cequence/openaiscala/examples/GPTVisionWithLocalFile.scala rename to openai-examples/src/main/scala/io/cequence/openaiscala/examples/CreateChatCompletionVisionWithLocalFile.scala index 4d1070f1..faf804f6 100644 --- a/openai-examples/src/main/scala/io/cequence/openaiscala/examples/GPTVisionWithLocalFile.scala +++ b/openai-examples/src/main/scala/io/cequence/openaiscala/examples/CreateChatCompletionVisionWithLocalFile.scala @@ -9,7 +9,7 @@ import java.util.Base64 import javax.imageio.ImageIO import scala.concurrent.Future -object GPTVisionWithLocalFile extends Example { +object CreateChatCompletionVisionWithLocalFile extends Example { // provide a local jpeg here private val localImagePath = sys.env("EXAMPLE_IMAGE_PATH") @@ -17,7 +17,7 @@ object GPTVisionWithLocalFile extends Example { private val imageBase64Source = Base64.getEncoder.encodeToString(imageToBytes(bufferedImage, "jpeg")) - val messages = Seq( + val messages: Seq[BaseMessage] = Seq( SystemMessage("You are a helpful assistant."), UserSeqMessage( Seq( @@ -30,7 +30,7 @@ object GPTVisionWithLocalFile extends Example { override protected def run: Future[_] = service .createChatCompletion( - messages = messages, + messages, settings = CreateChatCompletionSettings( model = ModelId.gpt_4_vision_preview, temperature = Some(0), diff --git a/openai-examples/src/main/scala/io/cequence/openaiscala/examples/GPTVisionWithURL.scala b/openai-examples/src/main/scala/io/cequence/openaiscala/examples/CreateChatCompletionVisionWithURL.scala similarity index 86% rename from openai-examples/src/main/scala/io/cequence/openaiscala/examples/GPTVisionWithURL.scala rename to openai-examples/src/main/scala/io/cequence/openaiscala/examples/CreateChatCompletionVisionWithURL.scala index 029f1392..430947cc 100644 --- a/openai-examples/src/main/scala/io/cequence/openaiscala/examples/GPTVisionWithURL.scala +++ b/openai-examples/src/main/scala/io/cequence/openaiscala/examples/CreateChatCompletionVisionWithURL.scala @@ -5,9 +5,9 @@ import io.cequence.openaiscala.domain.settings.CreateChatCompletionSettings import scala.concurrent.Future -object GPTVisionWithURL extends Example { +object CreateChatCompletionVisionWithURL extends Example { - val messages = Seq( + val messages: Seq[BaseMessage] = Seq( SystemMessage("You are a helpful assistant."), UserSeqMessage( Seq( @@ -22,7 +22,7 @@ object GPTVisionWithURL extends Example { override protected def run: Future[_] = service .createChatCompletion( - messages = messages, + messages, settings = CreateChatCompletionSettings( model = ModelId.gpt_4_vision_preview, temperature = Some(0), diff --git a/openai-examples/src/main/scala/io/cequence/openaiscala/examples/CreateEditImage.scala b/openai-examples/src/main/scala/io/cequence/openaiscala/examples/CreateImageEdit.scala similarity index 94% rename from openai-examples/src/main/scala/io/cequence/openaiscala/examples/CreateEditImage.scala rename to openai-examples/src/main/scala/io/cequence/openaiscala/examples/CreateImageEdit.scala index 22dfae8b..626452ba 100644 --- a/openai-examples/src/main/scala/io/cequence/openaiscala/examples/CreateEditImage.scala +++ b/openai-examples/src/main/scala/io/cequence/openaiscala/examples/CreateImageEdit.scala @@ -3,7 +3,7 @@ package io.cequence.openaiscala.examples import io.cequence.openaiscala.domain._ import io.cequence.openaiscala.domain.settings._ -object CreateEditImage extends Example { +object CreateImageEdit extends Example { private val localOtterImagePath = sys.env("EXAMPLE_OTTER_IMAGE_PATH") override protected def run = diff --git a/openai-examples/src/main/scala/io/cequence/openaiscala/examples/Example.scala b/openai-examples/src/main/scala/io/cequence/openaiscala/examples/Example.scala index 92219206..18fc6359 100644 --- a/openai-examples/src/main/scala/io/cequence/openaiscala/examples/Example.scala +++ b/openai-examples/src/main/scala/io/cequence/openaiscala/examples/Example.scala @@ -2,7 +2,6 @@ package io.cequence.openaiscala.examples import akka.actor.ActorSystem import akka.stream.Materializer -import io.cequence.openaiscala.OpenAIScalaClientException import io.cequence.openaiscala.domain.response.ChatCompletionResponse import io.cequence.openaiscala.service.{OpenAIService, OpenAIServiceFactory}