Commit 56f9e93
fix: strip text-based tool call blocks from LLM responses
Some models (e.g. MiniMax) emit tool calls as XML-like text content
(<minimax:tool_call>…</minimax:tool_call>) instead of using the
structured tool_calls response field. These would pass through as
the essay text since content was non-empty.
Broadens _strip_think_tags into _strip_llm_artifacts which also
removes <*tool_call>…</*tool_call> blocks (with optional namespace
prefixes and pipe delimiters), plus orphaned opening tags from
token-limit truncation.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>1 parent 0afc622 commit 56f9e93
1 file changed
+34
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
312 | 312 | | |
313 | 313 | | |
314 | 314 | | |
315 | | - | |
316 | | - | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
317 | 330 | | |
318 | 331 | | |
319 | 332 | | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
320 | 350 | | |
321 | 351 | | |
322 | 352 | | |
| |||
438 | 468 | | |
439 | 469 | | |
440 | 470 | | |
441 | | - | |
| 471 | + | |
442 | 472 | | |
443 | 473 | | |
444 | 474 | | |
| |||
661 | 691 | | |
662 | 692 | | |
663 | 693 | | |
664 | | - | |
| 694 | + | |
665 | 695 | | |
666 | 696 | | |
667 | 697 | | |
| |||
0 commit comments