fix(glm47): improve tool call parsing and content normalization (#37386)

Signed-off-by: karanb192 <karan@example.com>
Co-authored-by: karanb192 <karan@example.com>
This commit is contained in:
Karan Bansal
2026-03-18 08:12:21 +00:00
committed by GitHub
co-authored by karanb192
parent 8c31f47c63
commit fad09e8a1f
4 changed files with 193 additions and 6 deletions
+6 -1
View File
@@ -206,7 +206,12 @@ class Glm4MoeModelToolParser(ToolParser):
)
else:
if len(tool_calls) > 0:
content = model_output[: model_output.find(self.tool_calls_start_token)]
content: str | None = model_output[
: model_output.find(self.tool_calls_start_token)
]
# Normalize empty/whitespace-only content to None
if not content or not content.strip():
content = None
return ExtractedToolCallInformation(
tools_called=True, tool_calls=tool_calls, content=content
)