try_json_stringify() — langchain Function Reference
Architecture documentation for the try_json_stringify() function in stdout.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 96c47add_b1f1_76fe_1236_08539f2b3eb7["try_json_stringify()"] 59f19799_80e1_28d9_4d71_5c10f6e0cdef["stdout.py"] 96c47add_b1f1_76fe_1236_08539f2b3eb7 -->|defined in| 59f19799_80e1_28d9_4d71_5c10f6e0cdef b252af5f_f3da_9a3b_bb22_6bb086a26c24["_on_chain_start()"] b252af5f_f3da_9a3b_bb22_6bb086a26c24 -->|calls| 96c47add_b1f1_76fe_1236_08539f2b3eb7 25068213_8527_c3a1_7102_969839bea7d5["_on_chain_end()"] 25068213_8527_c3a1_7102_969839bea7d5 -->|calls| 96c47add_b1f1_76fe_1236_08539f2b3eb7 6f164286_18e6_e796_9a88_f99f0dbeb302["_on_chain_error()"] 6f164286_18e6_e796_9a88_f99f0dbeb302 -->|calls| 96c47add_b1f1_76fe_1236_08539f2b3eb7 16520e60_bcd5_3318_4d51_7e1e52cfb3f2["_on_llm_start()"] 16520e60_bcd5_3318_4d51_7e1e52cfb3f2 -->|calls| 96c47add_b1f1_76fe_1236_08539f2b3eb7 1eaa1a8f_26a8_bc8d_88c5_7584917da023["_on_llm_end()"] 1eaa1a8f_26a8_bc8d_88c5_7584917da023 -->|calls| 96c47add_b1f1_76fe_1236_08539f2b3eb7 febff251_8a54_2c2e_5395_fbe085a1f45d["_on_llm_error()"] febff251_8a54_2c2e_5395_fbe085a1f45d -->|calls| 96c47add_b1f1_76fe_1236_08539f2b3eb7 style 96c47add_b1f1_76fe_1236_08539f2b3eb7 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/core/langchain_core/tracers/stdout.py lines 14–27
def try_json_stringify(obj: Any, fallback: str) -> str:
"""Try to stringify an object to JSON.
Args:
obj: Object to stringify.
fallback: Fallback string to return if the object cannot be stringified.
Returns:
A JSON string if the object can be stringified, otherwise the fallback string.
"""
try:
return json.dumps(obj, indent=2, ensure_ascii=False)
except Exception:
return fallback
Domain
Subdomains
Defined In
Called By
Source
Frequently Asked Questions
What does try_json_stringify() do?
try_json_stringify() is a function in the langchain codebase, defined in libs/core/langchain_core/tracers/stdout.py.
Where is try_json_stringify() defined?
try_json_stringify() is defined in libs/core/langchain_core/tracers/stdout.py at line 14.
What calls try_json_stringify()?
try_json_stringify() is called by 6 function(s): _on_chain_end, _on_chain_error, _on_chain_start, _on_llm_end, _on_llm_error, _on_llm_start.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free