From 7feae62ad713583ea6ef58aa2f7fdef77ef144d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=9D=B4=EA=B7=9C=EB=AF=BC?= <32768535+GyuminJack@users.noreply.github.com> Date: Thu, 12 Sep 2024 00:21:00 +0900 Subject: [PATCH] core[patch]: Support non ASCII characters in tool output if user doesn't output string (#26319) ### simple modify core: add supporting non english character target issue is #26315 same issue on langgraph - https://github.com/langchain-ai/langgraph/issues/1504 --- libs/core/langchain_core/tools/base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/core/langchain_core/tools/base.py b/libs/core/langchain_core/tools/base.py index 9d35aa614fa..c5236ce743f 100644 --- a/libs/core/langchain_core/tools/base.py +++ b/libs/core/langchain_core/tools/base.py @@ -822,7 +822,7 @@ def _is_message_content_block(obj: Any) -> bool: def _stringify(content: Any) -> str: try: - return json.dumps(content) + return json.dumps(content, ensure_ascii=False) except Exception: return str(content)