mirror of
https://github.com/hwchase17/langchain.git
synced 2025-07-05 20:58:25 +00:00
feat: fix the Chinese characters in the solution content will be conv… (#6734)
fix the Chinese characters in the solution content will be converted to ascii encoding, resulting in an abnormally long number of tokens Co-authored-by: qixin <qixin@fintec.ai>
This commit is contained in:
parent
70f7c2bb2e
commit
b3f8324de9
@ -69,7 +69,7 @@ def _create_function_message(
|
|||||||
"""
|
"""
|
||||||
if not isinstance(observation, str):
|
if not isinstance(observation, str):
|
||||||
try:
|
try:
|
||||||
content = json.dumps(observation)
|
content = json.dumps(observation, ensure_ascii=False)
|
||||||
except Exception:
|
except Exception:
|
||||||
content = str(observation)
|
content = str(observation)
|
||||||
else:
|
else:
|
||||||
|
@ -68,7 +68,7 @@ def _create_function_message(
|
|||||||
"""
|
"""
|
||||||
if not isinstance(observation, str):
|
if not isinstance(observation, str):
|
||||||
try:
|
try:
|
||||||
content = json.dumps(observation)
|
content = json.dumps(observation, ensure_ascii=False)
|
||||||
except Exception:
|
except Exception:
|
||||||
content = str(observation)
|
content = str(observation)
|
||||||
else:
|
else:
|
||||||
|
Loading…
Reference in New Issue
Block a user