LlamaCppEx.ChatCompletionChunk (LlamaCppEx v0.8.3)

Copy Markdown View Source

OpenAI-compatible streaming chat completion chunk struct.

Mirrors the shape of server-sent events from POST /v1/chat/completions with stream: true.

Summary

Types

chunk_choice()

@type chunk_choice() :: %{
  index: integer(),
  delta: %{
    optional(:role) => String.t(),
    optional(:content) => String.t(),
    optional(:reasoning_content) => String.t()
  },
  finish_reason: String.t() | nil
}

t()

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