Class StreamingContentParser
Parses streaming LLM output to detect and separate thinking content from response content. Handles <think>...</think> tags that may span chunk boundaries (used by Qwen, DeepSeek, and similar models).
public sealed class StreamingContentParser
- Inheritance
-
StreamingContentParser
- Inherited Members
Properties
IsThinking
Whether the parser is currently inside a thinking block.
public bool IsThinking { get; }
Property Value
Methods
Flush()
Flush any buffered content (e.g., an incomplete tag at end of stream).
public IReadOnlyList<StreamSegment> Flush()
Returns
ProcessChunk(string)
Process a streaming chunk and return classified segments. The returned list is reused across calls — consume before the next call.
public IReadOnlyList<StreamSegment> ProcessChunk(string chunk)
Parameters
chunkstring
Returns
Reset()
Reset to initial state.
public void Reset()