# `vllm_mlx.reasoning.think_parser`

Base parser for models using <think>...</think> tags for reasoning.

[View the complete module source at #L1-L462](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/reasoning/think_parser.py#L1-L462).

## 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.think_parser
    options:
      members:
        - logger
        - BaseThinkingReasoningParser
      filters: []
      show_if_no_docstring: true

## 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.

<details class="api-contract" id="contract-vllm_mlx.reasoning.think_parser.BaseThinkingReasoningParser" markdown="1">
<summary><code>vllm_mlx.reasoning.think_parser.BaseThinkingReasoningParser</code> · class</summary>

```python
vllm_mlx.reasoning.think_parser.BaseThinkingReasoningParser(tokenizer = None)
```

Base parser for models using <think>...</think> style tags.

**Parameters**

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `tokenizer` | `not annotated` | `no` | `None` | Optional positional or keyword input; defaults to `None`. |

**Returns**

- Constructs: `vllm_mlx.reasoning.think_parser.BaseThinkingReasoningParser`

**Exceptions and behavior**

Class `BaseThinkingReasoningParser` derives from `ReasoningParser` and declares 12 direct member(s).
No direct `raise` statement appears in this definition.

[View source #L29-L462](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/reasoning/think_parser.py#L29-L462).

</details>

<details class="api-contract" id="contract-vllm_mlx.reasoning.think_parser.BaseThinkingReasoningParser.start_token" markdown="1">
<summary><code>vllm_mlx.reasoning.think_parser.BaseThinkingReasoningParser.start_token</code> · method</summary>

```python
vllm_mlx.reasoning.think_parser.BaseThinkingReasoningParser.start_token() -> str
```

The token/tag that starts reasoning content (e.g., '<think>').

**Parameters**

This callable has no explicit inputs.

**Returns**

- Type: `str`

**Exceptions and behavior**

Method `BaseThinkingReasoningParser.start_token` contains no state mutation, call, raise, return, await, or yield.
No direct `raise` statement appears in this definition.

[View source #L50-L51](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/reasoning/think_parser.py#L50-L51).

</details>

<details class="api-contract" id="contract-vllm_mlx.reasoning.think_parser.BaseThinkingReasoningParser.end_token" markdown="1">
<summary><code>vllm_mlx.reasoning.think_parser.BaseThinkingReasoningParser.end_token</code> · method</summary>

```python
vllm_mlx.reasoning.think_parser.BaseThinkingReasoningParser.end_token() -> str
```

The token/tag that ends reasoning content (e.g., '</think>').

**Parameters**

This callable has no explicit inputs.

**Returns**

- Type: `str`

**Exceptions and behavior**

Method `BaseThinkingReasoningParser.end_token` contains no state mutation, call, raise, return, await, or yield.
No direct `raise` statement appears in this definition.

[View source #L55-L56](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/reasoning/think_parser.py#L55-L56).

</details>

<details class="api-contract" id="contract-vllm_mlx.reasoning.think_parser.BaseThinkingReasoningParser.__init__" markdown="1">
<summary><code>vllm_mlx.reasoning.think_parser.BaseThinkingReasoningParser.__init__</code> · method</summary>

```python
vllm_mlx.reasoning.think_parser.BaseThinkingReasoningParser.__init__(tokenizer = None) -> not annotated
```

Method `BaseThinkingReasoningParser.__init__` updates `self._phase`, `self._content_started`, `self._content_buffer`, `self._in_tool_call`; calls `super().__init__`, `super`.

**Parameters**

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `tokenizer` | `not annotated` | `no` | `None` | Optional positional or keyword input; defaults to `None`. |

**Returns**

- Type: `not annotated`

**Exceptions and behavior**

Method `BaseThinkingReasoningParser.__init__` updates `self._phase`, `self._content_started`, `self._content_buffer`, `self._in_tool_call`; calls `super().__init__`, `super`.
No direct `raise` statement appears in this definition.

[View source #L63-L71](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/reasoning/think_parser.py#L63-L71).

</details>

<details class="api-contract" id="contract-vllm_mlx.reasoning.think_parser.BaseThinkingReasoningParser.reset_state" markdown="1">
<summary><code>vllm_mlx.reasoning.think_parser.BaseThinkingReasoningParser.reset_state</code> · method</summary>

```python
vllm_mlx.reasoning.think_parser.BaseThinkingReasoningParser.reset_state() -> not annotated
```

Reset state machine for a new streaming request.

**Parameters**

This callable has no explicit inputs.

**Returns**

- Type: `not annotated`

**Exceptions and behavior**

Method `BaseThinkingReasoningParser.reset_state` updates `self._phase`, `self._content_started`, `self._content_buffer`, `self._in_tool_call`.
No direct `raise` statement appears in this definition.

[View source #L73-L79](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/reasoning/think_parser.py#L73-L79).

</details>

<details class="api-contract" id="contract-vllm_mlx.reasoning.think_parser.BaseThinkingReasoningParser.extract_reasoning" markdown="1">
<summary><code>vllm_mlx.reasoning.think_parser.BaseThinkingReasoningParser.extract_reasoning</code> · method</summary>

```python
vllm_mlx.reasoning.think_parser.BaseThinkingReasoningParser.extract_reasoning(model_output: str) -> tuple[str | None, str | None]
```

Extract reasoning from complete 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: `self._promote_tool_calls(reasoning, content)`; `self._promote_tool_calls(reasoning, None)`; `(None, model_output)`

**Exceptions and behavior**

Method `BaseThinkingReasoningParser.extract_reasoning` calls `self._extract_complete_reasoning`, `self._promote_tool_calls`, `text.partition`, `reasoning.strip`; has 3 explicit return paths.
No direct `raise` statement appears in this definition.

[View source #L81-L110](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/reasoning/think_parser.py#L81-L110).

</details>

<details class="api-contract" id="contract-vllm_mlx.reasoning.think_parser.BaseThinkingReasoningParser.extract_reasoning_streaming" markdown="1">
<summary><code>vllm_mlx.reasoning.think_parser.BaseThinkingReasoningParser.extract_reasoning_streaming</code> · method</summary>

```python
vllm_mlx.reasoning.think_parser.BaseThinkingReasoningParser.extract_reasoning_streaming(previous_text: str, current_text: str, delta_text: str) -> DeltaMessage | None
```

Extract reasoning from a streaming delta using state-machine tracking.

**Parameters**

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `previous_text` | `str` | `yes` | `none` | Text accumulated before this delta. |
| `current_text` | `str` | `yes` | `none` | Text including this delta. |
| `delta_text` | `str` | `yes` | `none` | Just the new text in this chunk. |

**Returns**

- Type: `DeltaMessage | None`
- Direct return expressions: `None`; `self._transition_to_content(reasoning, content)`; `DeltaMessage(reasoning=before) if before else None`; `DeltaMessage(reasoning=after) if after else None`; `DeltaMessage(reasoning=delta_text)`; `self._thinking_tool_call(previous_text, current_text, delta_text)`; `DeltaMessage(reasoning=reasoning) if reasoning else None`; `self._content_delta(delta_text)`

**Exceptions and behavior**

Method `BaseThinkingReasoningParser.extract_reasoning_streaming` updates `self._phase`, `self._in_tool_call`, `self._tool_call_buffer`; calls `delta_text.find`, `len`, `after.find`, `self._transition_to_content`; has 8 explicit return paths.
No direct `raise` statement appears in this definition.

[View source #L112-L224](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/reasoning/think_parser.py#L112-L224).

</details>

<details class="api-contract" id="contract-vllm_mlx.reasoning.think_parser.BaseThinkingReasoningParser._extract_complete_reasoning" markdown="1">
<summary><code>vllm_mlx.reasoning.think_parser.BaseThinkingReasoningParser._extract_complete_reasoning</code> · method</summary>

```python
vllm_mlx.reasoning.think_parser.BaseThinkingReasoningParser._extract_complete_reasoning(text: str) -> tuple[str | None, str | None]
```

Split complete output into leading reasoning spans and final content.

**Parameters**

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `text` | `str` | `yes` | `none` | Required positional or keyword input. |

**Returns**

- Type: `tuple[str | None, str | None]`
- Direct return expressions: `(reasoning, content)`

**Exceptions and behavior**

Method `BaseThinkingReasoningParser._extract_complete_reasoning` calls `remainder.lstrip`, `stripped.startswith`, `len`, `after_start.partition`; returns `(reasoning, content)`.
No direct `raise` statement appears in this definition.

[View source #L226-L260](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/reasoning/think_parser.py#L226-L260).

</details>

<details class="api-contract" id="contract-vllm_mlx.reasoning.think_parser.BaseThinkingReasoningParser._transition_to_content" markdown="1">
<summary><code>vllm_mlx.reasoning.think_parser.BaseThinkingReasoningParser._transition_to_content</code> · method</summary>

```python
vllm_mlx.reasoning.think_parser.BaseThinkingReasoningParser._transition_to_content(reasoning: str | None, content: str | None) -> DeltaMessage | None
```

Return a delta while suppressing leading post-transition think blocks.

**Parameters**

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `reasoning` | `str \| None` | `yes` | `none` | Required positional or keyword input. |
| `content` | `str \| None` | `yes` | `none` | Required positional or keyword input. |

**Returns**

- Type: `DeltaMessage | None`
- Direct return expressions: `None`; `DeltaMessage(reasoning=reasoning_text or None, content=final_content or None)`

**Exceptions and behavior**

Method `BaseThinkingReasoningParser._transition_to_content` calls `self._promote_tool_calls`, `self._content_delta`, `DeltaMessage`; has 2 explicit return paths.
No direct `raise` statement appears in this definition.

[View source #L262-L276](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/reasoning/think_parser.py#L262-L276).

</details>

<details class="api-contract" id="contract-vllm_mlx.reasoning.think_parser.BaseThinkingReasoningParser._content_delta" markdown="1">
<summary><code>vllm_mlx.reasoning.think_parser.BaseThinkingReasoningParser._content_delta</code> · method</summary>

```python
vllm_mlx.reasoning.think_parser.BaseThinkingReasoningParser._content_delta(delta_text: str) -> DeltaMessage | None
```

Emit content after consuming repeated leading think blocks.

**Parameters**

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `delta_text` | `str` | `yes` | `none` | Required positional or keyword input. |

**Returns**

- Type: `DeltaMessage | None`
- Direct return expressions: `None`; `DeltaMessage(content=delta_text) if delta_text else None`; `DeltaMessage(reasoning=''.join(reasoning_parts) or None, content=buffer)`; `DeltaMessage(reasoning=''.join(reasoning_parts))`

**Exceptions and behavior**

Method `BaseThinkingReasoningParser._content_delta` updates `self._content_buffer`, `self._content_started`; calls `DeltaMessage`, `self._content_buffer.lstrip`, `buffer.startswith`, `buffer[len(self.end_token):].lstrip`; has 4 explicit return paths.
No direct `raise` statement appears in this definition.

[View source #L278-L325](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/reasoning/think_parser.py#L278-L325).

</details>

<details class="api-contract" id="contract-vllm_mlx.reasoning.think_parser.BaseThinkingReasoningParser._thinking_tool_call" markdown="1">
<summary><code>vllm_mlx.reasoning.think_parser.BaseThinkingReasoningParser._thinking_tool_call</code> · method</summary>

```python
vllm_mlx.reasoning.think_parser.BaseThinkingReasoningParser._thinking_tool_call(previous_text: str, current_text: str, delta_text: str) -> DeltaMessage | None
```

Handle streaming while inside a <tool_call> during thinking phase.

**Parameters**

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `previous_text` | `str` | `yes` | `none` | Required positional or keyword input. |
| `current_text` | `str` | `yes` | `none` | Required positional or keyword input. |
| `delta_text` | `str` | `yes` | `none` | Required positional or keyword input. |

**Returns**

- Type: `DeltaMessage | None`
- Direct return expressions: `DeltaMessage(content=final_content or None, reasoning=r_text or None)`; `DeltaMessage(content=promoted, reasoning=reasoning)`; `DeltaMessage(content=final_content or None)`; `None`

**Exceptions and behavior**

Method `BaseThinkingReasoningParser._thinking_tool_call` updates `self._tool_call_buffer`, `self._in_tool_call`, `self._phase`; calls `self._tool_call_buffer.find`, `len`, `logger.warning`, `remainder.find`; has 4 explicit return paths.
No direct `raise` statement appears in this definition.

[View source #L327-L396](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/reasoning/think_parser.py#L327-L396).

</details>

<details class="api-contract" id="contract-vllm_mlx.reasoning.think_parser.BaseThinkingReasoningParser.finalize_stream" markdown="1">
<summary><code>vllm_mlx.reasoning.think_parser.BaseThinkingReasoningParser.finalize_stream</code> · method</summary>

```python
vllm_mlx.reasoning.think_parser.BaseThinkingReasoningParser.finalize_stream() -> DeltaMessage | None
```

Flush any buffered tool call text at end of stream.

**Parameters**

This callable has no explicit inputs.

**Returns**

- Type: `DeltaMessage | None`
- Direct return expressions: `DeltaMessage(content=promoted)`; `None`

**Exceptions and behavior**

Method `BaseThinkingReasoningParser.finalize_stream` updates `self._tool_call_buffer`, `self._in_tool_call`; calls `logger.warning`, `DeltaMessage`; has 2 explicit return paths.
No direct `raise` statement appears in this definition.

[View source #L398-L406](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/reasoning/think_parser.py#L398-L406).

</details>

<details class="api-contract" id="contract-vllm_mlx.reasoning.think_parser.BaseThinkingReasoningParser._promote_tool_calls" markdown="1">
<summary><code>vllm_mlx.reasoning.think_parser.BaseThinkingReasoningParser._promote_tool_calls</code> · method</summary>

```python
vllm_mlx.reasoning.think_parser.BaseThinkingReasoningParser._promote_tool_calls(reasoning: str | None, content: str | None) -> tuple[str | None, str | None]
```

Method `BaseThinkingReasoningParser._promote_tool_calls` calls `cls._TOOL_CALL_CLOSED_RE.sub`, `cls._TOOL_CALL_UNCLOSED_RE.search`, `unclosed_match.group`, `unclosed_match.start`; has 2 explicit return paths.

**Parameters**

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `reasoning` | `str \| None` | `yes` | `none` | Required positional or keyword input. |
| `content` | `str \| None` | `yes` | `none` | Required positional or keyword input. |

**Returns**

- Type: `tuple[str | None, str | None]`
- Direct return expressions: `(reasoning, content)`; `(cleaned, result_content)`

**Exceptions and behavior**

Method `BaseThinkingReasoningParser._promote_tool_calls` calls `cls._TOOL_CALL_CLOSED_RE.sub`, `cls._TOOL_CALL_UNCLOSED_RE.search`, `unclosed_match.group`, `unclosed_match.start`; has 2 explicit return paths.
No direct `raise` statement appears in this definition.

[View source #L409-L462](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/reasoning/think_parser.py#L409-L462).

</details>

<details class="api-contract" id="contract-vllm_mlx.reasoning.think_parser.BaseThinkingReasoningParser._promote_tool_calls._collect_closed" markdown="1">
<summary><code>vllm_mlx.reasoning.think_parser.BaseThinkingReasoningParser._promote_tool_calls._collect_closed</code> · nested function</summary>

```python
vllm_mlx.reasoning.think_parser.BaseThinkingReasoningParser._promote_tool_calls._collect_closed(match) -> not annotated
```

Nested Function `BaseThinkingReasoningParser._promote_tool_calls._collect_closed` calls `closed.append`, `match.group`; returns `''`.

**Parameters**

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `match` | `not annotated` | `yes` | `none` | Required positional or keyword input. |

**Returns**

- Type: `not annotated`
- Direct return expressions: `''`

**Exceptions and behavior**

Nested Function `BaseThinkingReasoningParser._promote_tool_calls._collect_closed` calls `closed.append`, `match.group`; returns `''`.
No direct `raise` statement appears in this definition.

[View source #L419-L421](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/reasoning/think_parser.py#L419-L421).

</details>

## 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 |
| --- | --- | --- | --- | --- |
| [`BaseThinkingReasoningParser`](#contract-vllm_mlx.reasoning.think_parser.BaseThinkingReasoningParser) | class | `BaseThinkingReasoningParser(tokenizer = None)` | Base parser for models using <think>...</think> style tags. | [#L29-L462](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/reasoning/think_parser.py#L29-L462) |
| [`BaseThinkingReasoningParser.start_token`](#contract-vllm_mlx.reasoning.think_parser.BaseThinkingReasoningParser.start_token) | method | `BaseThinkingReasoningParser.start_token() -> str` | The token/tag that starts reasoning content (e.g., '<think>'). | [#L50-L51](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/reasoning/think_parser.py#L50-L51) |
| [`BaseThinkingReasoningParser.end_token`](#contract-vllm_mlx.reasoning.think_parser.BaseThinkingReasoningParser.end_token) | method | `BaseThinkingReasoningParser.end_token() -> str` | The token/tag that ends reasoning content (e.g., '</think>'). | [#L55-L56](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/reasoning/think_parser.py#L55-L56) |
| [`BaseThinkingReasoningParser.__init__`](#contract-vllm_mlx.reasoning.think_parser.BaseThinkingReasoningParser.__init__) | method | `BaseThinkingReasoningParser.__init__(tokenizer = None) -> not annotated` | Method `BaseThinkingReasoningParser.__init__` updates `self._phase`, `self._content_started`, `self._content_buffer`, `self._in_tool_call`; calls `super().__init__`, `super`. | [#L63-L71](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/reasoning/think_parser.py#L63-L71) |
| [`BaseThinkingReasoningParser.reset_state`](#contract-vllm_mlx.reasoning.think_parser.BaseThinkingReasoningParser.reset_state) | method | `BaseThinkingReasoningParser.reset_state() -> not annotated` | Reset state machine for a new streaming request. | [#L73-L79](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/reasoning/think_parser.py#L73-L79) |
| [`BaseThinkingReasoningParser.extract_reasoning`](#contract-vllm_mlx.reasoning.think_parser.BaseThinkingReasoningParser.extract_reasoning) | method | `BaseThinkingReasoningParser.extract_reasoning(model_output: str) -> tuple[str \| None, str \| None]` | Extract reasoning from complete output. | [#L81-L110](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/reasoning/think_parser.py#L81-L110) |
| [`BaseThinkingReasoningParser.extract_reasoning_streaming`](#contract-vllm_mlx.reasoning.think_parser.BaseThinkingReasoningParser.extract_reasoning_streaming) | method | `BaseThinkingReasoningParser.extract_reasoning_streaming(previous_text: str, current_text: str, delta_text: str) -> DeltaMessage \| None` | Extract reasoning from a streaming delta using state-machine tracking. | [#L112-L224](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/reasoning/think_parser.py#L112-L224) |
| [`BaseThinkingReasoningParser._extract_complete_reasoning`](#contract-vllm_mlx.reasoning.think_parser.BaseThinkingReasoningParser._extract_complete_reasoning) | method | `BaseThinkingReasoningParser._extract_complete_reasoning(text: str) -> tuple[str \| None, str \| None]` | Split complete output into leading reasoning spans and final content. | [#L226-L260](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/reasoning/think_parser.py#L226-L260) |
| [`BaseThinkingReasoningParser._transition_to_content`](#contract-vllm_mlx.reasoning.think_parser.BaseThinkingReasoningParser._transition_to_content) | method | `BaseThinkingReasoningParser._transition_to_content(reasoning: str \| None, content: str \| None) -> DeltaMessage \| None` | Return a delta while suppressing leading post-transition think blocks. | [#L262-L276](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/reasoning/think_parser.py#L262-L276) |
| [`BaseThinkingReasoningParser._content_delta`](#contract-vllm_mlx.reasoning.think_parser.BaseThinkingReasoningParser._content_delta) | method | `BaseThinkingReasoningParser._content_delta(delta_text: str) -> DeltaMessage \| None` | Emit content after consuming repeated leading think blocks. | [#L278-L325](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/reasoning/think_parser.py#L278-L325) |
| [`BaseThinkingReasoningParser._thinking_tool_call`](#contract-vllm_mlx.reasoning.think_parser.BaseThinkingReasoningParser._thinking_tool_call) | method | `BaseThinkingReasoningParser._thinking_tool_call(previous_text: str, current_text: str, delta_text: str) -> DeltaMessage \| None` | Handle streaming while inside a <tool_call> during thinking phase. | [#L327-L396](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/reasoning/think_parser.py#L327-L396) |
| [`BaseThinkingReasoningParser.finalize_stream`](#contract-vllm_mlx.reasoning.think_parser.BaseThinkingReasoningParser.finalize_stream) | method | `BaseThinkingReasoningParser.finalize_stream() -> DeltaMessage \| None` | Flush any buffered tool call text at end of stream. | [#L398-L406](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/reasoning/think_parser.py#L398-L406) |
| [`BaseThinkingReasoningParser._promote_tool_calls`](#contract-vllm_mlx.reasoning.think_parser.BaseThinkingReasoningParser._promote_tool_calls) | method | `BaseThinkingReasoningParser._promote_tool_calls(reasoning: str \| None, content: str \| None) -> tuple[str \| None, str \| None]` | Method `BaseThinkingReasoningParser._promote_tool_calls` calls `cls._TOOL_CALL_CLOSED_RE.sub`, `cls._TOOL_CALL_UNCLOSED_RE.search`, `unclosed_match.group`, `unclosed_match.start`; has 2 explicit return paths. | [#L409-L462](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/reasoning/think_parser.py#L409-L462) |
| [`BaseThinkingReasoningParser._promote_tool_calls._collect_closed`](#contract-vllm_mlx.reasoning.think_parser.BaseThinkingReasoningParser._promote_tool_calls._collect_closed) | nested function | `BaseThinkingReasoningParser._promote_tool_calls._collect_closed(match) -> not annotated` | Nested Function `BaseThinkingReasoningParser._promote_tool_calls._collect_closed` calls `closed.append`, `match.group`; returns `''`. | [#L419-L421](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/reasoning/think_parser.py#L419-L421) |
