-
Notifications
You must be signed in to change notification settings - Fork 2.7k
[#17146][fix] Fix Laguna's reasoning parser #17151
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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 | ||
|
|
@@ -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( | ||
| "thinking") is None and chat_template_kwargs.get( | ||
| "enable_thinking") is None: | ||
| chat_template_kwargs["enable_thinking"] = True | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||
| super().__init__(chat_template_kwargs=chat_template_kwargs) | ||
|
|
||
|
|
||
| @register_reasoning_parser("minimax_m3") | ||
| class MiniMaxM3ReasoningParser(DeepSeekR1Parser): | ||
| """Reasoning parser for MiniMax-M3. | ||
|
|
@@ -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", | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1237,6 +1237,7 @@ | |
| "allowed_values": [ | ||
| "auto", | ||
| "deepseek-r1", | ||
| "poolside_v1", | ||
| "laguna", | ||
| "qwen3", | ||
| "qwen3_5", | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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']) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 testsRepository: 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.jsonRepository: 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.pyRepository: NVIDIA/TensorRT-LLM Length of output: 50376 Synchronize 🤖 Prompt for AI Agents |
||
| default: null | ||
| status: prototype | ||
| required: false | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -19,6 +19,7 @@ | |||||||||||||||||||||||||||||||||||
| import pytest | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| from tensorrt_llm.llmapi.reasoning_parser import (NemotronV3ReasoningParser, | ||||||||||||||||||||||||||||||||||||
| PoolsideV1ReasoningParser, | ||||||||||||||||||||||||||||||||||||
| ReasoningParserFactory, | ||||||||||||||||||||||||||||||||||||
| resolve_auto_reasoning_parser) | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
|
|
@@ -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}]) | ||||||||||||||||||||||||||||||||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Only |
||||||||||||||||||||||||||||||||||||
| 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
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win Cover explicit Line 110 covers only 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
Suggested change
🧰 Tools🪛 Ruff (0.16.0)[error] 116-116: f-string without any placeholders Remove extraneous (F541) 🤖 Prompt for AI AgentsSource: 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
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 || trueRepository: 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 || trueRepository: 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 || trueRepository: 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
🧰 Tools🪛 Ruff (0.16.0)[error] 116-116: f-string without any placeholders Remove extraneous (F541) 🤖 Prompt for AI AgentsSource: Path instructions |
||||||||||||||||||||||||||||||||||||
| TOOL_START = "<|tool_calls_section_begin|>" | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
|
|
@@ -278,32 +321,30 @@ def test_qwen3_reasoning_parser_stream(delta_texts: list, content: list, | |||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| @pytest.mark.parametrize(("text", "content", "reasoning_context"), [ | ||||||||||||||||||||||||||||||||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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<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] | ||||||||||||||||||||||||||||||||||||
|
|
@@ -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"]) | ||||||||||||||||||||||||||||||||||||
|
|
@@ -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") | ||||||||||||||||||||||||||||||||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||||||||||||||||||||||||||||||||||||
| 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") | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
Uh oh!
There was an error while loading. Please reload this page.