Skip to content

fix: jan parser is broken with nested tool call tag in arguments#2

Open
louis-jan wants to merge 1 commit into
fix/hermes-tool-call-parserfrom
fix/jan-parser-nested-tool-call-tag
Open

fix: jan parser is broken with nested tool call tag in arguments#2
louis-jan wants to merge 1 commit into
fix/hermes-tool-call-parserfrom
fix/jan-parser-nested-tool-call-tag

Conversation

@louis-jan

@louis-jan louis-jan commented Dec 23, 2025

Copy link
Copy Markdown

Fix nested tool_call tag in tool call arguments

Purpose

This PR fixed a case where nested <tool_call> in argument values will break the parser hence it create broken output.
Also added unit tests for other cases

text = """<tool_call>
{"name": "final_answer", "arguments": {"q": "Search about <tool_call> in vllm"}}
</tool_call>"""

Tool call:

{"arguments":{"q": "Search about "}}

Content:

in vllm

Parser stop before seeing <tool_call> tag
Screenshot_2025-12-23_at_12 22 15

It breaks so the rest of the tool call goes to content part
Screenshot_2025-12-23_at_12 24 37

@nguyenhoangthuan99 nguyenhoangthuan99 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@louis-jan louis-jan force-pushed the fix/jan-parser-nested-tool-call-tag branch from 0934d3a to 36cc954 Compare December 25, 2025 04:06
nguyenhoangthuan99 pushed a commit that referenced this pull request Feb 2, 2026
…3058)

Signed-off-by: ramos <49182011+nemoramo@users.noreply.github.com>
Signed-off-by: mayufeng <mayufeng@example.com>
Co-authored-by: mayufeng <mayufeng@example.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants