Skip to main content

Module items

Module items 

Source
Expand description

Cross-dialect canonical representation.

The central model is content items — a typed, ordered list per message. Anthropic Messages, OpenAI Responses, and Gemini all share this shape natively; OpenAI Chat/Completions is the only dialect that hoists tool calls into a side-array, and that asymmetry is normalized at the dialect adapter boundary.

Invariants enforced here:

  • ItemStreamMessage.items preserves order verbatim from the wire.
  • ToolCall.id is non-empty; ToolResult.tool_call_id references a prior ToolCall in the same conversation.
  • Thinking.signature is opaque and never fabricated; None propagates as None through dialects that support unsigned thinking (all except Anthropic-signed).
  • Text("") is legal in the model; dropping happens in dialect code (Gemini rejects empty parts upstream).

Lossy notes are documented per-dialect; the canonical model itself stays lossless.

Structs§

ItemMeta
ItemRequest
ItemStreamMessage
ThinkingCfg
Tool

Enums§

ContentItem
ResponseFormat
Role
ToolChoice