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:
AaaCabbage 2023-06-27 04:14:48 +08:00 committed by GitHub
parent 70f7c2bb2e
commit b3f8324de9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -69,7 +69,7 @@ def _create_function_message(
"""
if not isinstance(observation, str):
try:
content = json.dumps(observation)
content = json.dumps(observation, ensure_ascii=False)
except Exception:
content = str(observation)
else:

View File

@ -68,7 +68,7 @@ def _create_function_message(
"""
if not isinstance(observation, str):
try:
content = json.dumps(observation)
content = json.dumps(observation, ensure_ascii=False)
except Exception:
content = str(observation)
else: