Current section

Files

Jump to
llama_cpp_ex lib llama_cpp_ex chat_completion.ex
Raw

lib/llama_cpp_ex/chat_completion.ex

defmodule LlamaCppEx.ChatCompletion do
@moduledoc """
OpenAI-compatible chat completion response struct.
Mirrors the shape of `POST /v1/chat/completions` responses.
"""
@type t :: %__MODULE__{
id: String.t(),
object: String.t(),
created: integer(),
model: String.t(),
choices: [choice()],
usage: usage()
}
@type choice :: %{
index: integer(),
message: %{
role: String.t(),
content: String.t(),
reasoning_content: String.t() | nil
},
finish_reason: String.t()
}
@type usage :: %{
prompt_tokens: integer(),
completion_tokens: integer(),
total_tokens: integer()
}
defstruct [:id, :object, :created, :model, :choices, :usage]
end