LlamaCppEx.ChatCompletion (LlamaCppEx v0.7.0)

Copy Markdown View Source

OpenAI-compatible chat completion response struct.

Mirrors the shape of POST /v1/chat/completions responses.

Summary

Types

choice()

@type choice() :: %{
  index: integer(),
  message: %{
    role: String.t(),
    content: String.t(),
    reasoning_content: String.t() | nil
  },
  finish_reason: String.t()
}

t()

@type t() :: %LlamaCppEx.ChatCompletion{
  choices: [choice()],
  created: integer(),
  id: String.t(),
  model: String.t(),
  object: String.t(),
  usage: usage()
}

usage()

@type usage() :: %{
  prompt_tokens: integer(),
  completion_tokens: integer(),
  total_tokens: integer()
}