Merge pull request #200 from mottopanikeiku/fix/nemotron3-later-system-messages
Publish / build (push) Canceled after 0s
Publish / publish (push) Canceled after 0s

fix(nemotron3): render later system messages instead of raising
This commit is contained in:
Konstantin Dunas
2026-10-29 00:44:14 +01:00
committed by GitHub
2 changed files with 12 additions and 6 deletions
+5 -5
View File
@@ -428,16 +428,16 @@ class Nemotron3Renderer:
content = self._render_content(msg.get("content"))
msg_orig_idx = orig_idx(i)
if role == "system":
if i != 0:
raise ValueError("System message must be at the beginning.")
if role == "system" and i == 0:
continue # Already handled above
elif role == "user":
elif role in ("user", "system"):
# The template renders a later system message through the
# user branch, under its own role header.
emit_special(
self._im_start, msg_orig_idx, is_sampled=False, is_content=False
)
user_segments: list[tuple[str, bool]] = [("user\n", False)]
user_segments: list[tuple[str, bool]] = [(f"{role}\n", False)]
if content:
user_segments.append((content, True))
# Reasoning-effort hint rides on the LAST user message only,
+7 -1
View File
@@ -685,7 +685,13 @@ SCENARIOS = (
{"role": "system", "content": "Late instruction"},
{"role": "user", "content": "B"},
],
only_renderers={"laguna-xs-2.1", "laguna-s-2.1"},
only_renderers={
"laguna-xs-2.1",
"laguna-s-2.1",
"nemotron-3",
"nemotron-3-ultra",
"nemotron-3.5",
},
),
_scenario(
"tool-declare-message",