[Refactor] move tool parsing logic from protocol.py to the tool parser (#27383)

Co-authored-by: Aaron Pham <contact@aarnphm.xyz>
This commit is contained in:
Chauncey
2025-10-24 17:53:23 +08:00
committed by GitHub
parent e0ef8a2920
commit 3567816932
9 changed files with 131 additions and 75 deletions

View File

@@ -112,6 +112,7 @@ class Hermes2ProToolParser(ToolParser):
return delta_text
def adjust_request(self, request: ChatCompletionRequest) -> ChatCompletionRequest:
request = super().adjust_request(request)
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