Expand description
Tool-call dialect specification.
A DialectSpec describes, as plain data, how a model wraps tool calls
inside its text output: the envelope markers, the body encodings to try,
and the whitespace layout it uses when emitting a call. It is the single
source of truth consumed by every layer that must agree on a dialect:
- the delimited stream parser (
normalize::parsers::delimited) scans fortool_open/tool_closeand decodes bodies viabody_codecs; - the decode-time GBNF grammar (
request_pipeline::constrain) is generated from the same markers andEmissionProfile; - detection (
gglib-gguf) produces specs — either derived from the model’s own chat template or theDialectSpec::qwen_xmlbuiltin.
Because parser, grammar, and detection all read one value, they cannot
drift: anything the grammar permits, the parser can parse, provable via
DialectSpec::render_call.
Specs are persisted per model (JSON in the dialect_spec column), so the
serde shape is forward-compatible: later-added fields must carry
#[serde(default)].
Structs§
- Dialect
Spec - A model’s tool-call dialect, described entirely as data.
- Emission
Profile - Whitespace layout a dialect uses when emitting a call.
Enums§
- Body
Codec - How a tool-call body is encoded between the envelope markers.
Constants§
- DERIVED_
DIALECT_ ID - Spec
idfor dialects derived from a model’s chat template. - DERIVED_
ID_ PREFIX - Synthetic tool-call ID prefix used by template-derived specs.
- QWEN_
ID_ PREFIX - Synthetic tool-call ID prefix used by the built-in Qwen dialect.
- QWEN_
XML_ DIALECT_ ID - Spec
idof the built-in Qwen/Hermes<tool_call>dialect.