io.cequence.openaiscala.service.OpenAIChatCompletionService.scala Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of openai-scala-core_3 Show documentation
Show all versions of openai-scala-core_3 Show documentation
Core module of OpenAI Scala client
The newest version!
package io.cequence.openaiscala.service
import io.cequence.openaiscala.domain.BaseMessage
import io.cequence.openaiscala.domain.response.ChatCompletionResponse
import io.cequence.openaiscala.domain.settings.CreateChatCompletionSettings
import io.cequence.wsclient.service.CloseableService
import scala.concurrent.Future
/**
* Service that offers ONLY OpenAI chat completion endpoint. Note that this trais is
* usable also for OpenAI-API-compatible services such as FastChat, Ollama, or OctoML.
*
* @since March
* 2024
*/
trait OpenAIChatCompletionService extends OpenAIServiceConsts with CloseableService {
/**
* Creates a model response for the given chat conversation.
*
* @param messages
* A list of messages comprising the conversation so far.
* @param settings
* @return
* chat completion response
* @see
* OpenAI Doc
*/
def createChatCompletion(
messages: Seq[BaseMessage],
settings: CreateChatCompletionSettings = DefaultSettings.CreateChatCompletion
): Future[ChatCompletionResponse]
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy