feat: add Hermes tool call parser#1596
Open
scubamount wants to merge 6 commits into
Open
Conversation
Add support for Hermes-style tool call format: <|tool_call_start|>[func_name(arg1=val1)]<|tool_call_end|> Supports both bracket format (Python-style keyword args) and JSON format. Adds to the fallback chain in parse_tool_calls() and strips markers when parsing fails to prevent raw markup leaking to API responses.
Contributor
Author
|
Cross-ref: this PR is the server-side counterpart to NousResearch/hermes-agent#37229 (fix: normalize local tool JSON fallbacks). These two PRs are co-dependent:
Without both, local model tool calling is broken:
Both should merge together for a complete fix. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds fallback support for the Hermes-style/Liquid tool call wire format:
Some clients/agents emit tool calls using these markers instead of oMLX's currently supported XML/prose bracket formats. Without this fallback, oMLX can surface raw marker text to users instead of returning structured tool calls.
This PR:
<|tool_call_start|>...<|tool_call_end|>[read_file(path='/tmp/a.log')][tool_a(...), tool_b(...)]<|tool_call_end|>cannot leak if it arrives without a visible open markerlfm2as ambiguous and relying on architecture/name checksVerification