Commit 3ad308b
runtime: tool responses use role=user (not role=tool) to match set_chat_template
Lab test after temperature drop showed the first turn works
beautifully (XML tool_call emitted, diag/summary ran). Second
turn (sending tool response back) returned rkllm_run=-1.
Cause: our session-level set_chat_template configured only the
user prefix (<|im_start|>user\\n) + postfix (<|im_end|>\\n
<|im_start|>assistant\\n). When we sent role='tool', the runtime
had no per-role template for 'tool' and rejected the call with
return code -1.
Fix: send tool results as role='user' content=<tool_response>
{name,result}</tool_response>. The runtime applies the user-role
template (matching set_chat_template's prefix/postfix), and the
<tool_response> wrapping matches the training-data format so the
model semantically recognises it as the tool turn.
KV cache preserved via keep_history=1.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>1 parent d857c4d commit 3ad308b
1 file changed
Lines changed: 8 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1284 | 1284 | | |
1285 | 1285 | | |
1286 | 1286 | | |
1287 | | - | |
1288 | | - | |
1289 | | - | |
1290 | | - | |
1291 | | - | |
1292 | | - | |
1293 | | - | |
| 1287 | + | |
| 1288 | + | |
| 1289 | + | |
| 1290 | + | |
| 1291 | + | |
| 1292 | + | |
| 1293 | + | |
| 1294 | + | |
1294 | 1295 | | |
1295 | | - | |
1296 | 1296 | | |
1297 | 1297 | | |
1298 | 1298 | | |
| |||
0 commit comments