ReasoningParser

Trait ReasoningParser 

Source
pub trait ReasoningParser: Send + Debug {
    // Required methods
    fn detect_and_parse_reasoning(
        &mut self,
        text: &str,
        token_ids: &[u32],
    ) -> ParserResult;
    fn parse_reasoning_streaming_incremental(
        &mut self,
        text: &str,
        token_ids: &[u32],
    ) -> ParserResult;
}

Required Methods§

Source

fn detect_and_parse_reasoning( &mut self, text: &str, token_ids: &[u32], ) -> ParserResult

Parses a standalone, non-streaming input chunk. Implementations may reset or ignore internal streaming state and should return the split of normal vs reasoning text for this complete input. Marker tokens must not be included in either output.

Source

fn parse_reasoning_streaming_incremental( &mut self, text: &str, token_ids: &[u32], ) -> ParserResult

Parses a streaming chunk and updates internal state. The return value should be the delta: only the newly discovered normal and reasoning text attributable to this chunk (not the cumulative totals). Marker tokens must not be included in either output.

Implementors§