vllm_mlx.reasoning.mistral_parser¶
Reasoning parser for Mistral / Ministral reasoning models.
View the complete module source at #L1-L72.
API details¶
Each callable below includes its exact signature, type annotations, inputs, defaults, return contract, documented exceptions, implementation source, and parsed docstring sections when the source provides them.
vllm_mlx.reasoning.mistral_parser
¶
Reasoning parser for Mistral / Ministral reasoning models.
Models such as Magistral and Ministral-3-*-Reasoning wrap their reasoning in [THINK]...[/THINK] delimiters (registered as special tokens in the tokenizer) and support a strict switch via 'enable_thinking=False' in chat template kwargs.
This mirrors the Qwen3 parser, which uses
Supports implicit reasoning mode where [THINK] is injected in the prompt and only [/THINK] appears in the output.
vllm_mlx.reasoning.mistral_parser.MistralReasoningParser
¶
Bases: BaseThinkingReasoningParser
Reasoning parser for Mistral/Ministral reasoning models.
Uses [THINK]...[/THINK] tokens to denote reasoning text.
Supports three scenarios: 1. Both tags in output: [THINK]reasoning[/THINK]content 2. Only closing tag (think in prompt): reasoning[/THINK]content 3. No tags: pure content
Example (normal): Input: "[THINK]Let me analyze this...[/THINK]The answer is 42." Output: reasoning="Let me analyze this...", content="The answer is 42."
Example (think in prompt): Input: "Let me analyze this...[/THINK]The answer is 42." Output: reasoning="Let me analyze this...", content="The answer is 42."
Source code in vllm_mlx/reasoning/think_parser.py
vllm_mlx.reasoning.mistral_parser.MistralReasoningParser.start_token
property
¶
Return the Mistral reasoning opening marker.
vllm_mlx.reasoning.mistral_parser.MistralReasoningParser.end_token
property
¶
Return the Mistral reasoning closing marker.
vllm_mlx.reasoning.mistral_parser.MistralReasoningParser.extract_reasoning
¶
Extract reasoning from Mistral/Ministral output.
Handles both explicit [THINK]...[/THINK] tags and implicit mode where [THINK] was in the prompt (only [/THINK] in output).
Parameters:
-
model_output(str) –Complete model output text.
Returns:
-
tuple[str | None, str | None]–(reasoning, content) tuple.
Source code in vllm_mlx/reasoning/mistral_parser.py
Complete contract reference¶
Expand any definition for its exact inputs, annotations, defaults, return contract, directly raised exceptions, source-grounded behavior, and immutable line link. This section includes private and nested definitions that ordinary API generators omit.
vllm_mlx.reasoning.mistral_parser.MistralReasoningParser · class
Reasoning parser for Mistral/Ministral reasoning models.
Parameters
This callable has no explicit inputs.
Returns
- Constructs:
vllm_mlx.reasoning.mistral_parser.MistralReasoningParser
Exceptions and behavior
Class MistralReasoningParser derives from BaseThinkingReasoningParser and declares 3 direct member(s).
No direct raise statement appears in this definition.
vllm_mlx.reasoning.mistral_parser.MistralReasoningParser.start_token · method
Return the Mistral reasoning opening marker.
Parameters
This callable has no explicit inputs.
Returns
- Type:
str - Direct return expressions:
'[THINK]'
Exceptions and behavior
Method MistralReasoningParser.start_token returns '[THINK]'.
No direct raise statement appears in this definition.
vllm_mlx.reasoning.mistral_parser.MistralReasoningParser.end_token · method
Return the Mistral reasoning closing marker.
Parameters
This callable has no explicit inputs.
Returns
- Type:
str - Direct return expressions:
'[/THINK]'
Exceptions and behavior
Method MistralReasoningParser.end_token returns '[/THINK]'.
No direct raise statement appears in this definition.
vllm_mlx.reasoning.mistral_parser.MistralReasoningParser.extract_reasoning · method
vllm_mlx.reasoning.mistral_parser.MistralReasoningParser.extract_reasoning(model_output: str) -> tuple[str | None, str | None]
Extract reasoning from Mistral/Ministral output.
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
model_output |
str |
yes |
none |
Complete model output text. |
Returns
- Type:
tuple[str | None, str | None] - Direct return expressions:
(None, model_output);super().extract_reasoning(model_output)
Exceptions and behavior
Method MistralReasoningParser.extract_reasoning calls super().extract_reasoning, super; has 2 explicit return paths.
No direct raise statement appears in this definition.
Complete symbol map¶
This map also includes private definitions and nested helpers. The signature column exposes every explicit input even when an internal helper has no dedicated parameter prose.
| Symbol | Kind | Signature and inputs | What it does | Source |
|---|---|---|---|---|
MistralReasoningParser |
class | MistralReasoningParser() |
Reasoning parser for Mistral/Ministral reasoning models. | #L19-L72 |
MistralReasoningParser.start_token |
method | MistralReasoningParser.start_token() -> str |
Return the Mistral reasoning opening marker. | #L40-L43 |
MistralReasoningParser.end_token |
method | MistralReasoningParser.end_token() -> str |
Return the Mistral reasoning closing marker. | #L46-L49 |
MistralReasoningParser.extract_reasoning |
method | MistralReasoningParser.extract_reasoning(model_output: str) -> tuple[str \| None, str \| None] |
Extract reasoning from Mistral/Ministral output. | #L51-L72 |