View Source ExOpenAi.Chat (ex_open_ai v0.1.7)

Represents a chat request to the OpenAI API.

examples

Examples

iex> params = %{
...>   model: "text-model",
...>   messages: [
...>     %{content: "hello"}
...>   ]
...> }
iex> ExOpenAi.Chat.create(params)
{:ok, %ExOpenAi.Chat{...}}

iex> ExOpenAi.Chat.create(%{})
{:error, %{}}

Link to this section Summary

Link to this section Types

@type t() :: %ExOpenAi.Chat{
  choices: list(),
  created: integer(),
  id: String.t(),
  object: String.t(),
  usage: map()
}

Link to this section Functions

Link to this function

create(data, options \\ [])

View Source
Link to this function

create_stream(data, options \\ [])

View Source
@spec create_stream(ExOpenAi.Api.data(), list()) :: ExOpenAi.Parser.parsed_response()
@spec do_new(
  %ExOpenAi.Chat{
    choices: term(),
    created: term(),
    id: term(),
    object: term(),
    usage: term()
  },
  attributes :: list()
) :: %ExOpenAi.Chat{
  choices: term(),
  created: term(),
  id: term(),
  object: term(),
  usage: term()
}
Link to this function

keep_it_simple(response, arg2)

View Source
@spec keep_it_simple(map(), boolean()) :: list() | map()
@spec new() :: %ExOpenAi.Chat{
  choices: term(),
  created: term(),
  id: term(),
  object: term(),
  usage: term()
}
@spec new(attributes :: list()) :: %ExOpenAi.Chat{
  choices: term(),
  created: term(),
  id: term(),
  object: term(),
  usage: term()
}