Expand description
§normalize
Universal local-LLM consistency layer.
This module rewrites model-specific output dialects into the strict
OpenAI-shaped crate::domain::agent::LlmStreamEvent sequence that the
rest of the codebase expects. Adapters wrap the LLM stream once at the
port boundary; every downstream surface (Axum, CLI, Tauri, proxy)
consumes the canonical form.
§Module map
tags—format:*constants used to pick a parser.error— non-fatalerror::NormalizationErrorsurfaced from parsers.parser— theparser::ToolCallParsertrait +parser::ParserOutput.parsers— concrete parser implementations, one file per dialect.registry— the single dispatch site that maps tags to parsers.
§Adding a new dialect
- Add a
pub const FORMAT_*totags. - Drop a new file under
parsers. - Add one match arm to
registry::get_parser.
The registry is the only place that knows the full set of parsers, by design — see the module docs there.
Modules
| Module | LOC | Complexity | Coverage |
|---|---|---|---|
error.rs | |||
history.rs | |||
parser.rs | |||
registry.rs | |||
stream.rs | |||
tags.rs | |||
parsers/ |
Re-exports§
pub use error::NormalizationError;pub use error::NormalizationErrorKind;pub use history::strip_thinking_debt;pub use parser::ParserOutput;pub use parser::ToolCallParser;pub use registry::get_parser;pub use stream::NormalizingStream;
Modules§
- error
- Non-fatal error reporting from normalization parsers.
- history
- Cross-turn “thinking debt” removal for chat history.
- parser
- The
ToolCallParsertrait and its companionParserOutput. - parsers
- parsers
- registry
- Tag-driven parser dispatch.
- stream
NormalizingStream— the single wrap point that canonicalises an LLM event stream.- tags
- Format-tag constants used to select a normalization parser.