dumps() — langchain Function Reference
Architecture documentation for the dumps() function in dump.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 46e40d05_c4e1_f364_4649_1ff3401a3e37["dumps()"] a51258b9_512f_dc1c_b25c_dc1d97b3a5d8["dump.py"] 46e40d05_c4e1_f364_4649_1ff3401a3e37 -->|defined in| a51258b9_512f_dc1c_b25c_dc1d97b3a5d8 5cbc4686_165a_f32c_5474_0a55a2f6b29d["_dump_pydantic_models()"] 46e40d05_c4e1_f364_4649_1ff3401a3e37 -->|calls| 5cbc4686_165a_f32c_5474_0a55a2f6b29d style 46e40d05_c4e1_f364_4649_1ff3401a3e37 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/core/langchain_core/load/dump.py lines 70–102
def dumps(obj: Any, *, pretty: bool = False, **kwargs: Any) -> str:
"""Return a JSON string representation of an object.
Note:
Plain dicts containing an `'lc'` key are automatically escaped to prevent
confusion with LC serialization format. The escape marker is removed during
deserialization.
Args:
obj: The object to dump.
pretty: Whether to pretty print the json.
If `True`, the json will be indented by either 2 spaces or the amount
provided in the `indent` kwarg.
**kwargs: Additional arguments to pass to `json.dumps`
Returns:
A JSON string representation of the object.
Raises:
ValueError: If `default` is passed as a kwarg.
"""
if "default" in kwargs:
msg = "`default` should not be passed to dumps"
raise ValueError(msg)
obj = _dump_pydantic_models(obj)
serialized = _serialize_value(obj)
if pretty:
indent = kwargs.pop("indent", 2)
return json.dumps(serialized, indent=indent, **kwargs)
return json.dumps(serialized, **kwargs)
Domain
Subdomains
Defined In
Calls
Source
Frequently Asked Questions
What does dumps() do?
dumps() is a function in the langchain codebase, defined in libs/core/langchain_core/load/dump.py.
Where is dumps() defined?
dumps() is defined in libs/core/langchain_core/load/dump.py at line 70.
What does dumps() call?
dumps() calls 1 function(s): _dump_pydantic_models.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free