core.tokenizers.text.parsers.deepseek_r1_reasoning_parser#
Module Contents#
Classes#
Parser for DeepSeek R1 style reasoning output. |
API#
- class core.tokenizers.text.parsers.deepseek_r1_reasoning_parser.DeepSeekR1ReasoningParser#
Bases:
megatron.core.tokenizers.text.parsers.base_parser.BaseParserParser for DeepSeek R1 style reasoning output.
- static parse(text: str, **kwargs) tuple[str, dict[str, str]]#
Extracts the reasoning content from the text using
… tags. Only extracts the first set of think tags. If an initialtag is not present but a tag is, it will infer atag at the beginning of the text. - Parameters:
text (str) – The text to parse.
- Returns:
A tuple containing the unprocessed text and a dictionary with the extracted reasoning content.
- Return type:
tuple[str, dict[str, str]]