Groq.ChatCompletion (Groq v0.1.0)

Summary

Types

@type choice() :: %{
  finish_reason: String.t() | nil,
  index: pos_integer(),
  message: choice_message(),
  logprobs: choice_logprobs() | nil
}
Link to this type

choice_logprobs()

@type choice_logprobs() :: %{content: [choice_logprobs_content()]}
Link to this type

choice_logprobs_content()

@type choice_logprobs_content() :: %{
  token: String.t(),
  logprob: float(),
  bytes: [integer()],
  top_logprobs: [logprob()]
}
Link to this type

choice_message()

@type choice_message() :: %{
  content: String.t() | nil,
  tool_calls: [tool_call()],
  role: String.t()
}
Link to this type

function_call()

@type function_call() :: %{name: String.t(), arguments: String.t()}
@type logprob() :: %{token: String.t(), logprob: float(), bytes: [integer()]}
@type message() :: %{
  :role => String.t(),
  :content => String.t(),
  optional(:name) => String.t(),
  optional(:seed) => binary() | integer()
}
@type params() :: %{
  :model => String.t(),
  :messages => [message()],
  optional(:temperature) => float(),
  optional(:max_tokens) => integer(),
  optional(:top_p) => float(),
  optional(:stream) => boolean(),
  optional(:stop) => binary(),
  optional(:response_format) => response_mode_opts()
}
Link to this type

response_mode_opts()

@type response_mode_opts() :: %{type: String.t()}
@type t() :: %Groq.ChatCompletion{
  choices: [choice()],
  created: pos_integer(),
  id: String.t(),
  model: String.t(),
  system_fingerprint: String.t(),
  usage: usage()
}
@type tool_call() :: %{id: binary(), type: String.t(), function: function_call()}
@type usage() :: %{
  completion_tokens: pos_integer(),
  prompt_tokens: pos_integer(),
  total_tokens: pos_integer()
}

Functions

Link to this function

create(req_params, opts \\ [])