Skip to content

vllm.reasoning.hunyuan_a13b_reasoning_parser

Classes:

HunyuanA13BReasoningParser

Bases: ReasoningParser

Reasoning parser for Hunyuan A13B Model.

HunyuanReasoningParser

This class implements a reasoning parser specifically designed
for the Hunyuan A13B Model. It is responsible for parsing and
extracting structured reasoning and answer segments from model
outputs that follow a specific pattern.

Key Features:
    - For non-stream output , Recognizes and extracts reasoning ("think")
     and answer ("answer") sections from text using regular expressions.
    - For stream process, it requires a token id sequences to change the
      reasoning state and other state so it maintains internal state to
      manage parsing across multiple token.


think start: "<think>

": [14023, 771, 397] think ends: " ": [198, 524, 27963, 397, 27, 9399, 397] response ends: " ": [524, 9399, 29]

Methods:

extract_reasoning(model_output, request)

Extract the reasoning content & content sections, respectively. If the sequence doesn't match what we expect, i.e., the model generates something else, all content is considered non-reasoning content.

Parameters:

Returns:

  • str | None –

    tuple[Optional[str], Optional[str]]: Tuple pair containing the

  • str | None –

    reasoning content and non-reasoning content.

extract_reasoning_streaming(previous_text, current_text, delta_text, previous_token_ids, current_token_ids, delta_token_ids)

Extract content using token ID sequence state machine.