Expand description
Tool-call normalizer: converts raw model text output (in-band markers)
into structured normalizer::ToolInvocations for kernel dispatch.
ToolCallNormalizer — converts raw LLM text output into structured
ToolInvocations.
Models served via OpenAI-compatible APIs (e.g. mlx_lm.server) sometimes
emit tool-intent as in-band text markers rather than the structured
tool_calls JSON field. Normalizers detect and decode those markers so the
kernel can dispatch them identically to first-class tool calls.
§Built-in implementations
| Type | Format |
|---|---|
LfmNormalizer | LiquidAI LFM <|tool_call_start|>[fn(k=v)]<|tool_call_end|> |
StructuredToolCallNormalizer | OpenAI Responses function_call output and Chat Completions tool_calls |
§Example
use rig_compose::normalizer::{LfmNormalizer, ToolCallNormalizer};
let raw = "<|tool_call_start|>[get_weather(city='Berlin')]<|tool_call_end|>";
let normalizer = LfmNormalizer;
let calls = normalizer.normalize(raw).expect("parse ok");
assert_eq!(calls[0].name, "get_weather");Structs§
- LfmNormalizer
- Normalizer for LiquidAI LFM models (e.g.
LFM2.5-1.2B-Thinking) served throughmlx_lm.serveror similar OpenAI-compatible shims that emit tool intent as in-band text rather than the structuredtool_callsfield. - Structured
Tool Call Normalizer - Normalizer for structured tool-call JSON returned by common provider APIs.
- Tool
Invocation - A structured tool invocation extracted from raw model output.
- Tool
Invocation Result - Result of dispatching one normalized
ToolInvocation.
Enums§
- Tool
Dispatch Action - Decision returned by a
ToolDispatchHookbefore a tool invocation runs.
Traits§
- Tool
Call Normalizer - Normalizes raw LLM text output into structured
ToolInvocations. - Tool
Dispatch Hook - Hook for policy, accounting, and tracing around normalized tool dispatch.
Functions§
- dispatch_
tool_ invocations - Dispatch normalized tool invocations sequentially through a
ToolRegistry. - dispatch_
tool_ invocations_ with_ hooks - Dispatch normalized tool invocations with policy/accounting hooks.