mirror of
https://github.com/hwchase17/langchain.git
synced 2025-07-16 09:48:04 +00:00
Add UTF-8 json ouput support while langchain.debug is set to True. (#5802)
Before: <img width="984" alt="image" src="https://github.com/hwchase17/langchain/assets/4317474/2b0807b4-a1d6-4df2-87cc-92b1c8e10534"> After: <img width="992" alt="image" src="https://github.com/hwchase17/langchain/assets/4317474/128c2c7d-2ed5-4c95-954d-b0964c83526a"> Thanks in advance. @agola11
This commit is contained in:
parent
a0d847f636
commit
b7999a9bc1
@ -8,7 +8,7 @@ from langchain.input import get_bolded_text, get_colored_text
|
|||||||
|
|
||||||
def try_json_stringify(obj: Any, fallback: str) -> str:
|
def try_json_stringify(obj: Any, fallback: str) -> str:
|
||||||
try:
|
try:
|
||||||
return json.dumps(obj, indent=2)
|
return json.dumps(obj, indent=2, ensure_ascii=False)
|
||||||
except Exception:
|
except Exception:
|
||||||
return fallback
|
return fallback
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user