Expand description
Thinking/reasoning content parsing and streaming accumulation.
Reasoning models (DeepSeek R1, Qwen3, etc.) output a “thinking” phase that
can appear either as a structured reasoning_content SSE field or as inline
<think>…</think> tags in the message content.
This module is the single source of truth for parsing those tags across all surfaces (CLI, Axum, Tauri). It supports four tag families:
| Format | Models |
|---|---|
<think>…</think> | DeepSeek R1, Qwen3, most reasoning models |
<reasoning>…</reasoning> | Alternative / custom models |
<seed:think>…</seed:think> | Seed-OSS models |
<|START_THINKING|>…<|END_THINKING|> | Command-R7B style |
§Modules
| Module | Contents |
|---|---|
types | ParsedThinkingContent, ThinkingEvent |
normalize | normalize_thinking_tags — variant-tag normalisation |
parse | parse_thinking_content, embed_thinking_content, has_thinking_content, format_thinking_duration |
accumulator | ThinkingAccumulator — streaming FSM for split-tag detection |
Re-exports§
pub use accumulator::ThinkingAccumulator;pub use parse::embed_thinking_content;pub use parse::format_thinking_duration;pub use parse::has_thinking_content;pub use parse::parse_thinking_content;pub use types::ParsedThinkingContent;pub use types::ThinkingEvent;
Modules§
- accumulator
- Stateful streaming accumulator for thinking-tag detection.
- normalize
- Tag normalisation for variant thinking-tag formats.
- parse
- Complete-message parsing and embedding of thinking content.
- types
- Public data types for thinking/reasoning content.