[Bugfix][Parser] Recover genuine tool calls after unclosed Qwen3 <function= opener in prose (#59928)
Signed-off-by: Abhay Joshi <105213625+abhayjoshi201@users.noreply.github.com> Signed-off-by: Artem Perevedentsev <aperevedents@nvidia.com> Co-authored-by: Gemini <noreply@google.com> Co-authored-by: Artem Perevedentsev <aperevedents@nvidia.com>
This commit is contained in:
co-authored by
Gemini
Artem Perevedentsev
parent
8a8e2baa02
commit
3f466c852c
@@ -169,10 +169,37 @@ def qwen3_config(
|
||||
ParserState.TOOL_BETWEEN,
|
||||
(EventType.TOOL_CALL_END,),
|
||||
),
|
||||
# regression issue 58227
|
||||
# <function=...</tool_call>
|
||||
# function name is not closed, go to content
|
||||
(ParserState.TOOL_NAME, "TOOL_END"): Transition(
|
||||
ParserState.CONTENT,
|
||||
(EventType.TOOL_CALL_END,),
|
||||
),
|
||||
# regression issue 58227
|
||||
# <function=...<tool_call>
|
||||
# unclosed tool call followed by another tool call
|
||||
(ParserState.TOOL_NAME, "TOOL_START"): Transition(
|
||||
ParserState.TOOL_PREAMBLE,
|
||||
(EventType.TOOL_CALL_END, EventType.TOOL_CALL_START),
|
||||
),
|
||||
# regression issue 58227
|
||||
# <function=...<function=
|
||||
# unclosed function name followed by another function name
|
||||
(ParserState.TOOL_NAME, "FUNC_PREFIX"): Transition(
|
||||
ParserState.TOOL_NAME,
|
||||
(EventType.TOOL_CALL_END, EventType.TOOL_CALL_START),
|
||||
),
|
||||
(ParserState.TOOL_ARGS, "FUNC_END"): Transition(
|
||||
ParserState.TOOL_BETWEEN,
|
||||
(EventType.TOOL_CALL_END,),
|
||||
),
|
||||
# regression issue 58227
|
||||
# <function=abc>...<function=
|
||||
(ParserState.TOOL_ARGS, "FUNC_PREFIX"): Transition(
|
||||
ParserState.TOOL_NAME,
|
||||
(EventType.TOOL_CALL_END, EventType.TOOL_CALL_START),
|
||||
),
|
||||
(ParserState.TOOL_ARGS, "PARAM_START"): Transition(
|
||||
ParserState.TOOL_ARGS,
|
||||
(EventType.ARG_VALUE_CHUNK,),
|
||||
|
||||
Reference in New Issue
Block a user