OpenAI.Completions (openai_client v0.5.1)

Given a prompt, the model will return one or more predicted completions, and can also return the probabilities of alternative tokens at each position.

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

Link to this section Summary

Functions

Creates a completion for the provided prompt and parameters

Link to this section Types

Link to this type

create_params()

@type create_params() :: %{
  :model => String.t(),
  optional(:prompt) => String.t() | [String.t()],
  optional(:suffix) => String.t(),
  optional(:max_tokens) => integer(),
  optional(:temperature) => float(),
  optional(:top_p) => float(),
  optional(:n) => integer(),
  optional(:stream) => boolean(),
  optional(:logprobs) => integer(),
  optional(:echo) => boolean(),
  optional(:stop) => String.t() | [String.t()],
  optional(:presence_penalty) => float(),
  optional(:frequency_penalty) => float(),
  optional(:best_of) => integer(),
  optional(:logit_bias) => %{required(String.t()) => float()},
  optional(:response_format) => response_format(),
  optional(:tools) => [tool()],
  optional(:tool_choice) => String.t() | tool_choice(),
  optional(:user) => String.t()
}
Link to this type

response_format()

@type response_format() :: %{type: String.t()}
@type tool() :: %{type: String.t(), function: tool_function()}
Link to this type

tool_choice()

@type tool_choice() :: %{type: String.t(), function: tool_function()}
Link to this type

tool_choice_function()

@type tool_choice_function() :: %{name: String.t()}
Link to this type

tool_function()

@type tool_function() :: %{
  :name => String.t(),
  optional(:description) => String.t(),
  optional(:parameters) => map()
}

Link to this section Functions

Link to this function

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

Creates a completion for the provided prompt and parameters