8000 Copybara import of the project: · CentML/adk-python@c4cd180 · GitHub
[go: up one dir, main page]

Skip to content

Commit c4cd180

Browse files
nauyiahccopybara-github
authored andcommitted
Copybara import of the project:
-- 50b09bb by Yuan Chai <350365422@qq.com>: fix: improve json serialization by allowing non-ascii characters -- c66977a by Yuan Chai <350365422@qq.com>: fix: serialize function call arguments to JSON string Previously accepted JSON objects directly, which was less robust. Now serialize arguments to JSON strings using `_safe_json_serialize`, ensuring stability and handling non-ASCII characters correctly. COPYBARA_INTEGRATE_REVIEW=google#605 from nauyiahc:fix_non_ascii_char a52513c PiperOrigin-RevId: 764396496
1 parent 3cd4cd3 commit c4cd180

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/google/adk/models/lite_llm.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ def _safe_json_serialize(obj) -> str:
136136

137137
try:
138138
# Try direct JSON serialization first
139-
return json.dumps(obj)
139+
return json.dumps(obj, ensure_ascii=False)
140140
except (TypeError, OverflowError):
141141
return str(obj)
142142

@@ -186,7 +186,7 @@ def _content_to_message_param(
186186
id=part.function_call.id,
187187
function=Function(
188188
name=part.function_call.name,
189-
arguments=json.dumps(part.function_call.args),
189+
arguments=_safe_json_serialize(part.function_call.args),
190190
),
191191
)
192192
)

0 commit comments

Comments
 (0)
0