Skip to content

The agent engineering platform.

langchain-community: fix unicode escaping issue with SlackToolkit (#16616)

taimod3d9244fee62
diff --git a/libs/community/langchain_community/tools/slack/get_channel.py b/libs/community/langchain_community/tools/slack/get_channel.py
index a3dbe13939..4cee16a935 100644
--- a/libs/community/langchain_community/tools/slack/get_channel.py
+++ b/libs/community/langchain_community/tools/slack/get_channel.py
@@ -31,7 +31,7 @@ class SlackGetChannel(SlackBaseTool):
and "created" in channel
and "num_members" in channel
]
- return json.dumps(filtered_result)
+ return json.dumps(filtered_result, ensure_ascii=False)
except Exception as e:
return "Error creating conversation: {}".format(e)
diff --git a/libs/community/langchain_community/tools/slack/get_message.py b/libs/community/langchain_community/tools/slack/get_message.py
index c0e9cde342..06ec9a9f57 100644
--- a/libs/community/langchain_community/tools/slack/get_message.py
+++ b/libs/community/langchain_community/tools/slack/get_message.py
@@ -39,6 +39,6 @@ class SlackGetMessage(SlackBaseTool):
for message in messages
if "user" in message and "text" in message and "ts" in message
]
- return json.dumps(filtered_messages)
+ return json.dumps(filtered_messages, ensure_ascii=False)
except Exception as e:
return "Error creating conversation: {}".format(e)