[Bugfix] Handle bare and malformed tool call openers in Gemma4 parser (#53444)
Signed-off-by: wuhangxian <1391938827@qq.com> Co-authored-by: Chauncey <chaunceyjiang@gmail.com>
This commit is contained in:
@@ -303,6 +303,7 @@ def gemma4_config() -> ParserEngineConfig:
|
||||
"TOOL_START": TOOL_CALL_START,
|
||||
"TOOL_END": TOOL_CALL_END,
|
||||
"CALL_PREFIX": "call:",
|
||||
"COLON": ":",
|
||||
"OPEN_BRACE": "{",
|
||||
"OPEN_PAREN": "(",
|
||||
},
|
||||
@@ -348,6 +349,13 @@ def gemma4_config() -> ParserEngineConfig:
|
||||
ParserState.TOOL_NAME,
|
||||
(),
|
||||
),
|
||||
# Bare opener: some checkpoints emit "<|tool_call>:name{...}"
|
||||
# without the "call" prefix. Match the colon directly so the
|
||||
# tool call is not silently dropped.
|
||||
(ParserState.TOOL_PREAMBLE, "COLON"): Transition(
|
||||
ParserState.TOOL_NAME,
|
||||
(),
|
||||
),
|
||||
(ParserState.TOOL_NAME, "OPEN_BRACE"): Transition(
|
||||
ParserState.TOOL_ARGS,
|
||||
(),
|
||||
|
||||
Reference in New Issue
Block a user