OpenAICoreService

io.cequence.openaiscala.service.OpenAICoreService

Central service to access core public OpenAI WS endpoints as defined at the API ref. page or compatible ones provided e.g. by FastChat FastChat.

The following services are supported:

  • '''Models''': listModels
  • '''Completions''': createCompletion
  • '''Chat Completions''': createChatCompletion
  • '''Embeddings''': createEmbeddings

Attributes

Since:

July 2023

Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes

Members list

Concise view

Type members

Inherited classlikes

Attributes

Inherited from:
OpenAIServiceConsts
Graph
Supertypes
class Object
trait Matchable
class Any

Value members

Abstract methods

def close(): Unit

Closes the underlying ws client, and releases all its resources.

Closes the underlying ws client, and releases all its resources.

Attributes

Creates a model response for the given chat conversation.

Creates a model response for the given chat conversation.

Attributes

messages

A list of messages comprising the conversation so far.

Returns:

chat completion response

See also:
def createCompletion(prompt: String, settings: CreateCompletionSettings): Future[TextCompletionResponse]

Creates a completion for the provided prompt and parameters.

Creates a completion for the provided prompt and parameters.

Attributes

prompt

The prompt(s) to generate completions for, encoded as a string, array of strings, array of tokens, or array of token arrays. Note that <|endoftext|> is the document separator that the model sees during training, so if a prompt is not specified the model will generate as if from the beginning of a new document.

Returns:

text completion response

See also:
def createEmbeddings(input: Seq[String], settings: CreateEmbeddingsSettings): Future[EmbeddingResponse]

Creates an embedding vector representing the input text.

Creates an embedding vector representing the input text.

Attributes

input

Input text to get embeddings for, encoded as a string or array of tokens. To get embeddings for multiple inputs in a single request, pass an array of strings or array of token arrays. Each input must not exceed 8192 tokens in length.

Returns:

list of embeddings inside an envelope

See also:
def listModels: Future[Seq[ModelInfo]]

Lists the currently available models, and provides basic information about each one such as the owner and availability.

Lists the currently available models, and provides basic information about each one such as the owner and availability.

Attributes

Returns:

models

See also:

Inherited fields

protected val configFileName: String

Attributes

Inherited from:
OpenAIServiceConsts
protected val configPrefix: String

Attributes

Inherited from:
OpenAIServiceConsts
protected val defaultCoreUrl: String

Attributes

Inherited from:
OpenAIServiceConsts
protected val defaultReadoutTimeout: Int

Attributes

Inherited from:
OpenAIServiceConsts
protected val defaultRequestTimeout: Int

Attributes

Inherited from:
OpenAIServiceConsts