Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions docs/source/developer-guide/telemetry.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ unset or when the safety sanitizer rejects the runtime value.

### `TorchLlmArgs`

270 captured fields.
271 captured fields.

| Captured key | Annotation | Kind | Converter | Allowed values |
|--------------|------------|------|-----------|----------------|
Expand Down Expand Up @@ -152,7 +152,7 @@ unset or when the safety sanitizer rejects the runtime value.
| `max_stats_len` | `<class 'int'>` | `value` | | |
| `mm_encoder_only` | `<class 'bool'>` | `value` | | |
| `moe_cluster_parallel_size` | `Optional[int]` | `value` | | |
| `moe_config.backend` | `Literal['AUTO', 'CUTLASS', 'CUTEDSL', 'WIDEEP', 'TRTLLM', 'DEEPGEMM', 'DENSEGEMM', 'VANILLA', 'TRITON', 'MARLIN', 'MEGAMOE_DEEPGEMM']` | `categorical` | | `AUTO`, `CUTLASS`, `CUTEDSL`, `WIDEEP`, `TRTLLM`, `DEEPGEMM`, `DENSEGEMM`, `VANILLA`, `TRITON`, `MARLIN`, `MEGAMOE_DEEPGEMM` |
| `moe_config.backend` | `Literal['AUTO', 'CUTLASS', 'CUTEDSL', 'WIDEEP', 'TRTLLM', 'DEEPGEMM', 'DENSEGEMM', 'VANILLA', 'TRITON', 'MARLIN', 'MEGAMOE_DEEPGEMM', 'MEGAMOE_CUTEDSL']` | `categorical` | | `AUTO`, `CUTLASS`, `CUTEDSL`, `WIDEEP`, `TRTLLM`, `DEEPGEMM`, `DENSEGEMM`, `VANILLA`, `TRITON`, `MARLIN`, `MEGAMOE_DEEPGEMM`, `MEGAMOE_CUTEDSL` |
| `moe_config.disable_finalize_fusion` | `<class 'bool'>` | `value` | | |
| `moe_config.max_num_tokens` | `Optional[int]` | `value` | | |
| `moe_config.use_low_precision_moe_combine` | `<class 'bool'>` | `value` | | |
Expand Down Expand Up @@ -192,7 +192,7 @@ unset or when the safety sanitizer rejects the runtime value.
| `ray_placement_config.defer_workers_init` | `<class 'bool'>` | `value` | | |
| `ray_placement_config.per_worker_gpu_share` | `Optional[float]` | `value` | | |
| `ray_placement_config.placement_bundle_indices` | `Optional[List[List[int]]]` | `value` | | |
| `reasoning_parser` | `Optional[str]` | `categorical` | allowlist | `auto`, `deepseek-r1`, `laguna`, `qwen3`, `qwen3_5`, `minimax_m2`, `minimax_m2_append_think`, `nano-v3`, `gemma4`, `kimi_k2`, `kimi_k25` |
| `reasoning_parser` | `Optional[str]` | `categorical` | allowlist | `auto`, `deepseek-r1`, `poolside_v1`, `laguna`, `qwen3`, `qwen3_5`, `minimax_m2`, `minimax_m2_append_think`, `nano-v3`, `gemma4`, `kimi_k2`, `kimi_k25` |
| `reorder_policy_config.policy_args.agent_inflight_seq_num` | `<class 'int'>` | `value` | | |
| `reorder_policy_config.policy_args.agent_percentage` | `<class 'float'>` | `value` | | |
| `reorder_policy_config.policy_name` | `Optional[Literal['AgentTree']]` | `categorical` | | `AgentTree` |
Expand Down Expand Up @@ -243,6 +243,7 @@ unset or when the safety sanitizer rejects the runtime value.
| `sparse_attention_config.window_size` | `<class 'int'>` | `value` | | |
| `speculative_config.acceptance_rate_threshold` | `Optional[float]` | `value` | | |
| `speculative_config.acceptance_rate_window_size` | `Optional[Annotated[int, Ge(ge=0)]]` | `value` | | |
| `speculative_config.advanced_sampling_mode` | `<enum 'AdvancedSamplingMode'>` | `categorical` | | `full`, `no_topk`, `no_topp`, `no_topk_no_topp` |
| `speculative_config.allow_advanced_sampling` | `<class 'bool'>` | `value` | | |
| `speculative_config.begin_thinking_phase_token` | `<class 'int'>` | `value` | | |
| `speculative_config.block_size` | `Optional[Annotated[int, Gt(gt=0)]]` | `value` | | |
Expand Down
5 changes: 3 additions & 2 deletions tensorrt_llm/llmapi/llm_args.py
Original file line number Diff line number Diff line change
Expand Up @@ -4473,8 +4473,9 @@ class BaseLlmArgs(StrictBaseModel):
default=None,
description="The parser to separate reasoning content from output.",
status="prototype",
telemetry=TelemetryField.categorical('auto', 'deepseek-r1', 'laguna',
'qwen3', 'qwen3_5', 'minimax_m2',
telemetry=TelemetryField.categorical('auto', 'deepseek-r1',
'poolside_v1', 'laguna', 'qwen3',
'qwen3_5', 'minimax_m2',
'minimax_m2_append_think',
'nano-v3', 'gemma4', 'kimi_k2',
'kimi_k25'))
Expand Down
25 changes: 23 additions & 2 deletions tensorrt_llm/llmapi/reasoning_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ def parse_delta(self, delta_text: str) -> ReasoningParserResult:


@register_reasoning_parser("deepseek-r1", reasoning_at_start=True)
@register_reasoning_parser("laguna")
@register_reasoning_parser("qwen3")
# Qwen3.5 (and forced-thinking Qwen3 variants) use a chat template that
# pre-injects `<think>\n` into the assistant prompt prefix, so the model
Expand Down Expand Up @@ -247,6 +246,28 @@ def finish(self) -> ReasoningParserResult:
return self._parser.finish()


@register_reasoning_parser("poolside_v1")
@register_reasoning_parser("laguna")
class PoolsideV1ReasoningParser(DeepSeekV4ReasoningParser):
"""Poolside parser selected by thinking-mode chat template kwargs.

Same behavior as Deepseek-V4's, except that reasoning defaults to true
to respect the official documentation.
"""

def __init__(
self,
*,
chat_template_kwargs: Optional[dict[str, Any]] = None,
) -> None:
chat_template_kwargs = dict(chat_template_kwargs or {})
if chat_template_kwargs.get(
Comment thread
2ez4bz marked this conversation as resolved.
"thinking") is None and chat_template_kwargs.get(
"enable_thinking") is None:
chat_template_kwargs["enable_thinking"] = True

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The docstring says "to respect the official documentation" — please cite it (link/quote in the comment). This default is the only thing distinguishing this class from deepseek_v4, and it's the one line that determines whether a request with no chat_template_kwargs gets its whole response classified as reasoning.

super().__init__(chat_template_kwargs=chat_template_kwargs)


@register_reasoning_parser("minimax_m3")
class MiniMaxM3ReasoningParser(DeepSeekR1Parser):
"""Reasoning parser for MiniMax-M3.
Expand Down Expand Up @@ -302,7 +323,7 @@ def parse(self, text: str) -> ReasoningParserResult:
"qwen3_next": "qwen3",
"deepseek_v3": "deepseek-r1",
"deepseek_v32": "deepseek-r1",
"laguna": "laguna",
"laguna": "poolside_v1",
"deepseek_v4": "deepseek_v4",
"nemotron_h": "nemotron-v3",
"nemotron_h_puzzle": "nemotron-v3",
Expand Down
1 change: 1 addition & 0 deletions tensorrt_llm/usage/llm_args_golden_manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -1237,6 +1237,7 @@
"allowed_values": [
"auto",
"deepseek-r1",
"poolside_v1",
"laguna",
"qwen3",
"qwen3_5",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ commands:
flags:
- "--post_processor_hook"
reasoning_parser:
type: Choice(['auto', 'deepseek-r1', 'deepseek_v4', 'gemma4', 'kimi_k2', 'kimi_k25', 'laguna', 'minimax_m2', 'minimax_m2_append_think', 'minimax_m3', 'nano-v3', 'nemotron-v3', 'qwen3', 'qwen3_5'])
type: Choice(['auto', 'deepseek-r1', 'deepseek_v4', 'gemma4', 'kimi_k2', 'kimi_k25', 'laguna', 'minimax_m2', 'minimax_m2_append_think', 'minimax_m3', 'nano-v3', 'nemotron-v3', 'poolside_v1', 'qwen3', 'qwen3_5'])

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail

rg -n -C 3 \
  'reasoning_parser|minimax_m3|deepseek_v4|nemotron-v3' \
  tensorrt_llm docs tests

Repository: NVIDIA/TensorRT-LLM

Length of output: 50376


🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail

printf '%s\n' '--- reasoning_parser references ---'
rg -n -C 5 \
  'reasoning_parser|TelemetryField\.categorical|deepseek_v4|nemotron-v3|minimax_m3' \
  tensorrt_llm/llmapi/llm_args.py \
  docs/source/developer-guide/telemetry.md \
  tensorrt_llm/usage/llm_args_golden_manifest.json \
  tests/unittest/api_stability/references/trtllm_serve_cli.yaml

printf '%s\n' '--- relevant file sections ---'
sed -n '330,390p' tests/unittest/api_stability/references/trtllm_serve_cli.yaml
rg -n -C 12 'reasoning_parser' tensorrt_llm/llmapi/llm_args.py
rg -n -C 8 'reasoning_parser' docs/source/developer-guide/telemetry.md
rg -n -C 8 'reasoning_parser' tensorrt_llm/usage/llm_args_golden_manifest.json

Repository: NVIDIA/TensorRT-LLM

Length of output: 32151


🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail

printf '%s\n' '--- parser dispatch and validation ---'
rg -n -C 6 \
  'reasoning_parser|nemotron-v3|minimax_m3|deepseek_v4' \
  tensorrt_llm \
  --glob '*.py' \
  --glob '!tests/**'

printf '%s\n' '--- CLI choice generation ---'
rg -n -C 8 \
  'Choice\(.*reasoning_parser|reasoning_parser.*Choice|serve.*reasoning_parser|reasoning_parser.*choices' \
  tensorrt_llm scripts tests \
  --glob '*.py' \
  --glob '*.yaml'

printf '%s\n' '--- telemetry implementation and manifest generator ---'
rg -n -C 10 \
  'class TelemetryField|categorical\(|golden_manifest|allowed_values|allowlist' \
  tensorrt_llm/usage scripts tensorrt_llm/llmapi/llm_args.py \
  --glob '*.py'

printf '%s\n' '--- all exact parser-value references ---'
rg -n \
  "'(minimax_m3|deepseek_v4|nemotron-v3)'|\"(minimax_m3|deepseek_v4|nemotron-v3)\"" \
  tensorrt_llm tests docs \
  --glob '*.py' \
  --glob '*.yaml' \
  --glob '*.md' \
  --glob '*.json'

Repository: NVIDIA/TensorRT-LLM

Length of output: 50376


🏁 Script executed:

#!/usr/bin/env bash
set -u

printf '%s\n' '--- reasoning_parser definitions and consumers ---'
rg -n -C 10 'reasoning_parser' \
  tensorrt_llm/llmapi/llm_args.py \
  tensorrt_llm/llmapi \
  tensorrt_llm/serve \
  tensorrt_llm/entrypoints \
  scripts \
  tests \
  --glob '*.py' \
  --glob '*.yaml' \
  --glob '*.json' 2>/dev/null || true

printf '%s\n' '--- exact values outside generated/reference files ---'
rg -n \
  'minimax_m3|deepseek_v4|nemotron-v3' \
  tensorrt_llm/llmapi/llm_args.py \
  tensorrt_llm/serve \
  tensorrt_llm/entrypoints \
  scripts \
  --glob '*.py' 2>/dev/null || true

printf '%s\n' '--- telemetry implementation and generator files ---'
rg -l \
  'class TelemetryField|def categorical|generate_llm_args_golden_manifest|allowed_values' \
  tensorrt_llm scripts \
  --glob '*.py' 2>/dev/null | sort

printf '%s\n' '--- manifest entry ---'
sed -n '1225,1260p' tensorrt_llm/usage/llm_args_golden_manifest.json

printf '%s\n' '--- source field ---'
sed -n '4468,4485p' tensorrt_llm/llmapi/llm_args.py

Repository: NVIDIA/TensorRT-LLM

Length of output: 50376


Synchronize reasoning_parser telemetry metadata. deepseek_v4, minimax_m3, and nemotron-v3 are registered parser choices but are absent from the telemetry allowlist, golden manifest, and telemetry table. Add them to TelemetryField.categorical(...), regenerate tensorrt_llm/usage/llm_args_golden_manifest.json, and update the table. Test coverage: no test functions changed; this file is an API-stability reference.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/unittest/api_stability/references/trtllm_serve_cli.yaml` at line 371,
Synchronize the reasoning_parser telemetry metadata with the registered choices
shown in the CLI reference: add deepseek_v4, minimax_m3, and nemotron-v3 to the
corresponding TelemetryField.categorical allowlist and telemetry table, then
regenerate tensorrt_llm/usage/llm_args_golden_manifest.json. Preserve the
existing API-stability reference and ordering conventions.

default: null
status: prototype
required: false
Expand Down
87 changes: 68 additions & 19 deletions tests/unittest/llmapi/test_reasoning_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import pytest

from tensorrt_llm.llmapi.reasoning_parser import (NemotronV3ReasoningParser,
PoolsideV1ReasoningParser,
ReasoningParserFactory,
resolve_auto_reasoning_parser)

Expand Down Expand Up @@ -88,6 +89,48 @@ def test_deepseek_v4_reasoning_parser_streams_when_thinking():
for result in results] == ["hid", "den", ""]


@pytest.mark.parametrize("chat_template_kwargs", [{
"thinking": True
}, {
"enable_thinking": True
}, None, {}, {
"random_key": "random_value"
}])
def test_poolside_v1_reasoning_parser_extracts_when_thinking(
chat_template_kwargs: dict):
reasoning_parser = ReasoningParserFactory.create_reasoning_parser(
"poolside_v1", chat_template_kwargs)

result = reasoning_parser.parse(f"hidden{R1_END}visible")

assert result.content == "visible"
assert result.reasoning_content == "hidden"


@pytest.mark.parametrize("chat_template_kwargs", [{"enable_thinking": False}])

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only enable_thinking: False is covered on the non-thinking path; {"thinking": False} goes through a different branch of the is None check and isn't tested. Also, a parametrize with a single value is just a hardcoded arg — either add {"thinking": False} to the list or inline it. (f"visible" on line 116 has no placeholder.)

def test_poolside_v1_reasoning_parser_extracts_when_not_thinking(
chat_template_kwargs: dict):
reasoning_parser = ReasoningParserFactory.create_reasoning_parser(
"poolside_v1", chat_template_kwargs)

result = reasoning_parser.parse(f"visible")
Comment on lines +110 to +116

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Cover explicit thinking=False and remove the lint error.

Line 110 covers only enable_thinking=False. Add thinking=False to verify that this explicit option prevents the default thinking mode. Line 116 has an unnecessary f-string and triggers Ruff F541.

Proposed fix
-@pytest.mark.parametrize("chat_template_kwargs", [{"enable_thinking": False}])
+@pytest.mark.parametrize("chat_template_kwargs", [
+    {"thinking": False},
+    {"enable_thinking": False},
+])
 def test_poolside_v1_reasoning_parser_extracts_when_not_thinking(
         chat_template_kwargs: dict):
@@
-    result = reasoning_parser.parse(f"visible")
+    result = reasoning_parser.parse("visible")
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
@pytest.mark.parametrize("chat_template_kwargs", [{"enable_thinking": False}])
def test_poolside_v1_reasoning_parser_extracts_when_not_thinking(
chat_template_kwargs: dict):
reasoning_parser = ReasoningParserFactory.create_reasoning_parser(
"poolside_v1", chat_template_kwargs)
result = reasoning_parser.parse(f"visible")
`@pytest.mark.parametrize`("chat_template_kwargs", [
{"thinking": False},
{"enable_thinking": False},
])
def test_poolside_v1_reasoning_parser_extracts_when_not_thinking(
chat_template_kwargs: dict):
reasoning_parser = ReasoningParserFactory.create_reasoning_parser(
"poolside_v1", chat_template_kwargs)
result = reasoning_parser.parse("visible")
🧰 Tools
🪛 Ruff (0.16.0)

[error] 116-116: f-string without any placeholders

Remove extraneous f prefix

(F541)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/unittest/llmapi/test_reasoning_parser.py` around lines 110 - 116,
Update test_poolside_v1_reasoning_parser_extracts_when_not_thinking to
parameterize both enable_thinking=False and thinking=False, ensuring either
explicit option disables the default thinking mode. Replace the unnecessary
f-string in the reasoning_parser.parse call with a regular string literal to
remove Ruff F541.

Source: Linters/SAST tools


assert result.content == "visible"
assert result.reasoning_content == ""


def test_poolside_v1_reasoning_parser_streams_when_thinking():
reasoning_parser = ReasoningParserFactory.create_reasoning_parser(
"poolside_v1", {"enable_thinking": True})

deltas = ["hid", f"den{R1_END}visible", " tail"]
results = [reasoning_parser.parse_delta(delta) for delta in deltas]

assert [result.content for result in results] == ["", "visible", " tail"]
assert [result.reasoning_content
for result in results] == ["hid", "den", ""]


Comment on lines +92 to +133

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

fd -t f . tests/integration/test_lists | sort
rg -n -i -C 2 'test_reasoning_parser|llmapi/test_reasoning_parser' \
  tests/integration/test_lists || true

Repository: NVIDIA/TensorRT-LLM

Length of output: 5335


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo '--- changed-file summary ---'
git diff --stat

echo '--- target test file diff ---'
git diff -- tests/unittest/llmapi/test_reasoning_parser.py

echo '--- test-list registrations ---'
rg -n -i -C 3 'test_reasoning_parser|llmapi/test_reasoning_parser' \
  tests/integration/test_lists || true

echo '--- test names in the target file ---'
rg -n '^def test_|^async def test_' tests/unittest/llmapi/test_reasoning_parser.py

echo '--- relevant target-file sections ---'
cat -n tests/unittest/llmapi/test_reasoning_parser.py | sed -n '1,170p'
cat -n tests/unittest/llmapi/test_reasoning_parser.py | sed -n '300,365p'
cat -n tests/unittest/llmapi/test_reasoning_parser.py | sed -n '700,760p'

Repository: NVIDIA/TensorRT-LLM

Length of output: 16692


🏁 Script executed:

#!/bin/bash
set -euo pipefail

git diff --stat
git diff -- tests/unittest/llmapi/test_reasoning_parser.py
rg -n -i -C 3 'test_reasoning_parser|llmapi/test_reasoning_parser' tests/integration/test_lists || true
rg -n '^def test_|^async def test_' tests/unittest/llmapi/test_reasoning_parser.py
cat -n tests/unittest/llmapi/test_reasoning_parser.py | sed -n '1,170p'
cat -n tests/unittest/llmapi/test_reasoning_parser.py | sed -n '300,365p'
cat -n tests/unittest/llmapi/test_reasoning_parser.py | sed -n '700,760p'

Repository: NVIDIA/TensorRT-LLM

Length of output: 16525


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo '--- QA list documentation ---'
cat -n tests/integration/test_lists/qa/README.md | sed -n '1,220p'

echo '--- QA references to unit-test paths and reasoning parser ---'
rg -n -i -C 2 'unittest/|reasoning_parser|llmapi' tests/integration/test_lists/qa || true

echo '--- test-db references to the target file ---'
rg -n -i -C 2 'unittest/llmapi/test_reasoning_parser.py' \
  tests/integration/test_lists/test-db

echo '--- available coverage artifacts ---'
fd -t f -i 'cbts_touchmap.sqlite' . || true
fd -t f -i '*coverage*' tests/integration tests/unittest . 2>/dev/null | head -100 || true

Repository: NVIDIA/TensorRT-LLM

Length of output: 10160


🏁 Script executed:

#!/bin/bash
set -euo pipefail

cat -n tests/integration/test_lists/qa/README.md | sed -n '1,220p'
rg -n -i -C 2 'unittest/|reasoning_parser|llmapi' \
  tests/integration/test_lists/qa || true
rg -n -i -C 2 'unittest/llmapi/test_reasoning_parser.py' \
  tests/integration/test_lists/test-db
fd -t f -i 'cbts_touchmap.sqlite' . || true
fd -t f -i '*coverage*' tests/integration tests/unittest . 2>/dev/null | head -100 || true

Repository: NVIDIA/TensorRT-LLM

Length of output: 9985


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo '--- parser implementation ---'
rg -n -C 8 'class PoolsideV1ReasoningParser|chat_template_kwargs|enable_thinking|thinking' \
  tensorrt_llm tests/unittest/llmapi/test_reasoning_parser.py | head -240

echo '--- QA list context around unit-test entries ---'
cat -n tests/integration/test_lists/qa/llm_function_core.txt | sed -n '775,805p'

Repository: NVIDIA/TensorRT-LLM

Length of output: 25474


🏁 Script executed:

#!/bin/bash
set -euo pipefail

rg -n -C 8 'class PoolsideV1ReasoningParser|chat_template_kwargs|enable_thinking|thinking' \
  tensorrt_llm tests/unittest/llmapi/test_reasoning_parser.py | head -240
cat -n tests/integration/test_lists/qa/llm_function_core.txt | sed -n '775,805p'

Repository: NVIDIA/TensorRT-LLM

Length of output: 25395


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo '--- matching test files and integration definitions ---'
fd -t f -i 'test_reasoning_parser.py' .
fd -t f -i '_test_openai_embeddings.py' .
fd -t d 'unittest' tests/integration/defs tests 2>/dev/null | head -40 || true

echo '--- test-db list scope ---'
cat -n tests/integration/test_lists/test-db/l0_a10.yml | sed -n '125,160p'

Repository: NVIDIA/TensorRT-LLM

Length of output: 2345


🏁 Script executed:

#!/bin/bash
set -euo pipefail

fd -t f -i 'test_reasoning_parser.py' .
fd -t f -i '_test_openai_embeddings.py' .
fd -t d 'unittest' tests/integration/defs tests 2>/dev/null | head -40 || true
cat -n tests/integration/test_lists/test-db/l0_a10.yml | sed -n '125,160p'

Repository: NVIDIA/TensorRT-LLM

Length of output: 2262


Add unittest/llmapi/test_reasoning_parser.py to tests/integration/test_lists/qa/llm_function_core.txt.

  • CI registration already exists in tests/integration/test_lists/test-db/l0_a10.yml.
  • Added tests cover thinking, streaming, alias resolution, and auto-detection.
  • Existing cases at lines 367–378 and 405–408 cover enable_thinking=False.
  • Coverage verdict: sufficient after manual-QA registration.
🧰 Tools
🪛 Ruff (0.16.0)

[error] 116-116: f-string without any placeholders

Remove extraneous f prefix

(F541)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/unittest/llmapi/test_reasoning_parser.py` around lines 92 - 133,
Register the reasoning-parser unittest module containing
test_poolside_v1_reasoning_parser_extracts_when_thinking and
test_poolside_v1_reasoning_parser_streams_when_thinking in the manual-QA
integration test list. Preserve the existing test-list registration structure
and avoid adding duplicate entries.

Source: Path instructions

TOOL_START = "<|tool_calls_section_begin|>"


Expand Down Expand Up @@ -278,32 +321,30 @@ def test_qwen3_reasoning_parser_stream(delta_texts: list, content: list,


@pytest.mark.parametrize(("text", "content", "reasoning_context"), [

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The rewrite dropped the two cases that actually document the new default's blast radius: plain "a" (no tags) and "<think>a</think>c". Under thinking-on + reasoning_at_start=True, parse("a") now yields content="", reasoning_content="a" — a real behavior change for anyone passing --reasoning_parser laguna today. Add that case explicitly so the intent is pinned rather than silently untested.

("a<think>b</think>c", "c", "b"),
("<think>a</think>b", "b", "a"),
("<think>a", "", "a"),
("a", "a", ""),
("<think>", "", ""),
("hidden</think>visible", "visible", "hidden"),
("</think>visible", "visible", ""),
("</think>", "", ""),
])
def test_laguna_reasoning_parser(text: str, content: str,
reasoning_context: str):
reasoning_parser = ReasoningParserFactory.create_reasoning_parser("laguna")
def test_poolside_v1_reasoning_parser(text: str, content: str,
reasoning_context: str):
reasoning_parser = ReasoningParserFactory.create_reasoning_parser(
"poolside_v1")
result = reasoning_parser.parse(text)
assert result.content == content
assert result.reasoning_content == reasoning_context


@pytest.mark.parametrize(("delta_texts", "content", "reasoning_context"), [
(["<think>a", "l</think>r", "b"], ["", "r", "b"], ["a", "l", ""]),
(["<th", "ink>a</think>b"], ["", "b"], ["", "a"]),
(["<think>a</th", "ink>b"], ["", "b"], ["a", ""]),
(["<think>", "a</think>b"], ["", "b"], ["", "a"]),
(["<think>a</think>", "b"], ["", "b"], ["a", ""]),
(["<think>a</th", "ank></th", "ink>b"], ["", "", "b"
], ["a", "</thank>", ""]),
(["a", "l</think>r", "b"], ["", "r", "b"], ["a", "l", ""]),
(["a</th", "ink>b"], ["", "b"], ["a", ""]),
(["", "a</think>b"], ["", "b"], ["", "a"]),
(["a</think>", "b"], ["", "b"], ["a", ""]),
(["a</th", "ank></th", "ink>b"], ["", "", "b"], ["a", "</thank>", ""]),
])
def test_laguna_reasoning_parser_stream(delta_texts: list, content: list,
reasoning_context: list):
reasoning_parser = ReasoningParserFactory.create_reasoning_parser("laguna")
def test_poolside_v1_reasoning_parser_stream(delta_texts: list, content: list,
reasoning_context: list):
reasoning_parser = ReasoningParserFactory.create_reasoning_parser(
"poolside_v1")
for i, delta_text in enumerate(delta_texts):
result = reasoning_parser.parse_delta(delta_text)
assert result.content == content[i]
Expand Down Expand Up @@ -681,7 +722,7 @@ def test_auto_detect_laguna(tmp_path):
_write_config(model_dir, "laguna")

result = resolve_auto_reasoning_parser(model_dir)
assert result == "laguna"
assert result == "poolside_v1"


@pytest.mark.parametrize("model_type", ["nemotron_h", "nemotron_h_puzzle"])
Expand All @@ -695,6 +736,14 @@ def test_auto_detect_nemotron_h(tmp_path, model_type):
assert result == "nemotron-v3"


def test_poolside_v1_alias_same_parser():
"""'Poolside_v1' and its alias 'laguna' resolve to the same parser."""
Poolside_v1 = ReasoningParserFactory.create_reasoning_parser("poolside_v1")

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Poolside_v1 — capitalized local reads like a class. Use poolside / poolside_v1 to match test_nemotron_v3_alias_same_parser right below.

laguna = ReasoningParserFactory.create_reasoning_parser("laguna")
assert isinstance(Poolside_v1, PoolsideV1ReasoningParser)
assert isinstance(laguna, PoolsideV1ReasoningParser)


def test_nemotron_v3_alias_same_parser():
"""'nemotron-v3' and the legacy 'nano-v3' resolve to the same parser."""
nemotron = ReasoningParserFactory.create_reasoning_parser("nemotron-v3")
Expand Down
Loading