run_to_dict() — langchain Function Reference
Architecture documentation for the run_to_dict() function in _compat.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 6419a709_5a71_380e_6b85_33722fb97374["run_to_dict()"] 75bf479b_1332_0b5c_5710_656c22821d19["_compat.py"] 6419a709_5a71_380e_6b85_33722fb97374 -->|defined in| 75bf479b_1332_0b5c_5710_656c22821d19 style 6419a709_5a71_380e_6b85_33722fb97374 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/core/langchain_core/tracers/_compat.py lines 24–36
def run_to_dict(run: Run, **kwargs: Any) -> dict[str, Any]:
"""Convert run to dict, compatible with both Pydantic v1 and v2.
Args:
run: The run to convert.
**kwargs: Additional arguments passed to `model_dump`/`dict`.
Returns:
Dictionary representation of the run.
"""
if _RUN_IS_PYDANTIC_V2:
return run.model_dump(**kwargs)
return run.dict(**kwargs) # type: ignore[deprecated]
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does run_to_dict() do?
run_to_dict() is a function in the langchain codebase, defined in libs/core/langchain_core/tracers/_compat.py.
Where is run_to_dict() defined?
run_to_dict() is defined in libs/core/langchain_core/tracers/_compat.py at line 24.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free