OpenAI.Chat (openai_client v0.3.0)

Given a chat conversation, the model will return a chat completion response.

https://platform.openai.com/docs/api-reference/chat

Link to this section Summary

Functions

Creates a completion for the chat message

Link to this section Types

Link to this type

create_completion_params()

@type create_completion_params() :: %{
  :model => String.t(),
  :messages => [message()],
  optional(:temperature) => float(),
  optional(:top_p) => float(),
  optional(:n) => integer(),
  optional(:stream) => boolean(),
  optional(:stop) => String.t() | [String.t()],
  optional(:max_tokens) => integer(),
  optional(:presence_penalty) => float(),
  optional(:frequency_penalty) => float(),
  optional(:logit_bias) => %{required(String.t()) => float()},
  optional(:user) => String.t()
}
@type message() :: %{role: String.t(), content: String.t()}

Link to this section Functions

Link to this function

create_completion(client, params, opts \\ [])

Creates a completion for the chat message