Expand description
Parser for <think>...</think> tags in model output.
Models like DeepSeek R1, QwQ, and SmolLM3 use <think> tags to wrap
chain-of-thought reasoning content. This module provides incremental
parsing to extract reasoning content separately from final response content.
§Format
<think>This is reasoning content</think>This is final content§Behavior
- Content before
<think>goes tocontent - Content inside
<think>...</think>goes toreasoning_content - Content after
</think>goes tocontent - Multiple
<think>blocks are concatenated - At EOS, treat unclosed
<think>content as reasoning
Structs§
- Think
TagContext - Context for tracking
<think>...</think>tag parsing state within a sequence.
Functions§
- is_
think_ tag_ template - Check if a chat template uses
<think>...</think>tags.