LLMAssistantAggregator: preserve non-ASCII characters in JSON output

Add ensure_ascii=False to json.dumps() calls for tool call arguments
and function call results to prevent unnecessary unicode escaping.
This commit is contained in:
Akhil
2026-01-22 15:37:44 -06:00
committed by GitHub
parent 308829f92b
commit 3b3c7aa8cc

View File

@@ -833,7 +833,7 @@ class LLMAssistantAggregator(LLMContextAggregator):
"id": frame.tool_call_id, "id": frame.tool_call_id,
"function": { "function": {
"name": frame.function_name, "name": frame.function_name,
"arguments": json.dumps(frame.arguments), "arguments": json.dumps(frame.arguments, ensure_ascii=False),
}, },
"type": "function", "type": "function",
} }
@@ -866,7 +866,7 @@ class LLMAssistantAggregator(LLMContextAggregator):
# Update context with the function call result # Update context with the function call result
if frame.result: if frame.result:
result = json.dumps(frame.result) result = json.dumps(frame.result, ensure_ascii=False)
self._update_function_call_result(frame.function_name, frame.tool_call_id, result) self._update_function_call_result(frame.function_name, frame.tool_call_id, result)
else: else:
self._update_function_call_result(frame.function_name, frame.tool_call_id, "COMPLETED") self._update_function_call_result(frame.function_name, frame.tool_call_id, "COMPLETED")