[Bugfix][Tool Parser] Migrate Granite to the streaming Parser Engine (#49648)

Signed-off-by: Nikhil Kulkarni <nikhilkulkarni1755@gmail.com>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
Co-authored-by: Chauncey <chaunceyjiang@gmail.com>
This commit is contained in:
Nikhil Kulkarni
2026-09-23 10:37:40 +00:00
committed by GitHub
co-authored by Claude Opus 4.8 Chauncey
parent c961121519
commit 15ed1262e7
14 changed files with 631 additions and 369 deletions
@@ -82,6 +82,12 @@ class ParserEngineConfig:
tool_args_json: bool = True
# The tool region body is a single JSON array of ``{"name", "arguments"}``
# objects (one marker → N calls, no closing terminal). The engine splits
# the array into one tool call per element; the array's ``]`` ends the
# region and any trailing text becomes content. Used by Granite.
tool_call_body_array: bool = False
arg_structural_chars: frozenset[str] | None = None
# Special tokens exempt from auto-drop but not state-machine terminals.