LlmCall.Capabilities (llm_call v0.4.0)

Copy Markdown View Source

What a completion protocol supports.

Capabilities are explicit so unsupported canonical fields can be rejected before a transport sends anything, instead of being dropped silently.

builtin_tools declares provider-hosted tools (web search, grounding, server tools): false rejects them, :passthrough forwards any name the caller supplies, and a list forwards only those names. The library does not validate a hosted tool against a local schema; the identifier stays the provider's. A codec still maps it into its own tool shape — Anthropic sends the name as type and derives a callable name from a _YYYYMMDD suffix — so "verbatim" is not a promise.

They are protocol-level: capabilities/2 takes the request for signature symmetry but does not inspect the model. A model-specific limit surfaces as a provider error, not a fabricated local guess.

Reporting versus controlling

prompt_cache says the protocol reports cache accounting: Usage carries cache_read_tokens and cache_write_tokens. It does not say the canonical IR can place a cache breakpoint, because it cannot; there is no request field for one. All four reference codecs report the read counter; OpenAI Chat, OpenAI Responses and Anthropic also report writes, and Gemini does not, so cache_write_tokens stays nil there. Every one declares this true.

The same distinction applies to stateful: it says the protocol can continue a conversation server-side, which reaches a provider that offers it through provider_options (previous_response_id, store), not through a canonical field.

Summary

Types

t()

What a protocol supports.

Types

t()

@type t() :: %LlmCall.Capabilities{
  builtin_tools: false | :passthrough | [String.t()],
  file_input: LlmCall.Capabilities.Input.t(),
  image_input: LlmCall.Capabilities.Input.t(),
  modalities: [LlmCall.modality()],
  parallel_tool_calls: boolean(),
  prompt_cache: boolean(),
  reasoning: LlmCall.Reasoning.Capabilities.t() | nil,
  stateful: boolean(),
  streaming: boolean(),
  streaming_tool_calls: boolean(),
  structured_output: :none | :json_object | :json_schema,
  tool_choice: boolean(),
  tools: boolean()
}

What a protocol supports.

prompt_cache is a reporting capability, not a request one: see the "Reporting versus controlling" section.

image_input and file_input name the source kinds the codec accepts — see LlmCall.Capabilities.Input.