Don't skip special tokens with hermes-style tool calling (#25281)

Signed-off-by: Max de Bayser <mbayser@br.ibm.com>
This commit is contained in:
Maximilien de Bayser 2025-09-19 21:33:25 -03:00 committed by GitHub
parent 3da17c2cc2
commit a36c675817
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -98,6 +98,15 @@ class Hermes2ProToolParser(ToolParser):
else:
return delta_text
def adjust_request(
self, request: ChatCompletionRequest) -> ChatCompletionRequest:
if request.tools and request.tool_choice != 'none':
# do not skip special tokens because the tool_call tokens are
# marked "special" in some models. Since they are skipped
# prior to the call to the tool parser, it breaks tool calling.
request.skip_special_tokens = False
return request
def extract_tool_calls(
self,
model_output: str,