Permit unicode outputs when dumping json in GetElementsTool (#4276)

Adds ensure_ascii=False when dumping json in the GetElementsTool
Fixes issue https://github.com/hwchase17/langchain/issues/4265
This commit is contained in:
Wuxian Zhang 2023-05-08 05:43:03 +08:00 committed by GitHub
parent a1001b29eb
commit 6f386628c2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -89,7 +89,7 @@ class GetElementsTool(BaseBrowserTool):
page = get_current_page(self.sync_browser)
# Navigate to the desired webpage before using this tool
results = _get_elements(page, selector, attributes)
return json.dumps(results)
return json.dumps(results, ensure_ascii=False)
async def _arun(
self,
@ -103,4 +103,4 @@ class GetElementsTool(BaseBrowserTool):
page = await aget_current_page(self.async_browser)
# Navigate to the desired webpage before using this tool
results = await _aget_elements(page, selector, attributes)
return json.dumps(results)
return json.dumps(results, ensure_ascii=False)