node_data_json() — langchain Function Reference
Architecture documentation for the node_data_json() function in graph.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 34379327_05b8_129e_590e_63948fab3a3d["node_data_json()"] 81a6280b_4752_84db_f1fa_1a3b8040d481["graph.py"] 34379327_05b8_129e_590e_63948fab3a3d -->|defined in| 81a6280b_4752_84db_f1fa_1a3b8040d481 436d3a55_ec61_7819_2986_6664246558c2["to_json()"] 436d3a55_ec61_7819_2986_6664246558c2 -->|calls| 34379327_05b8_129e_590e_63948fab3a3d e36afb73_0117_69fe_01c8_c476692e8baa["node_data_str()"] 34379327_05b8_129e_590e_63948fab3a3d -->|calls| e36afb73_0117_69fe_01c8_c476692e8baa style 34379327_05b8_129e_590e_63948fab3a3d fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/core/langchain_core/runnables/graph.py lines 197–249
def node_data_json(
node: Node, *, with_schemas: bool = False
) -> dict[str, str | dict[str, Any]]:
"""Convert the data of a node to a JSON-serializable format.
Args:
node: The `Node` to convert.
with_schemas: Whether to include the schema of the data if it is a Pydantic
model.
Returns:
A dictionary with the type of the data and the data itself.
"""
if node.data is None:
json: dict[str, Any] = {}
elif isinstance(node.data, RunnableSerializable):
json = {
"type": "runnable",
"data": {
"id": node.data.lc_id(),
"name": node_data_str(node.id, node.data),
},
}
elif isinstance(node.data, Runnable):
json = {
"type": "runnable",
"data": {
"id": to_json_not_implemented(node.data)["id"],
"name": node_data_str(node.id, node.data),
},
}
elif inspect.isclass(node.data) and is_basemodel_subclass(node.data):
json = (
{
"type": "schema",
"data": node.data.model_json_schema(
schema_generator=_IgnoreUnserializable
),
}
if with_schemas
else {
"type": "schema",
"data": node_data_str(node.id, node.data),
}
)
else:
json = {
"type": "unknown",
"data": node_data_str(node.id, node.data),
}
if node.metadata is not None:
json["metadata"] = node.metadata
return json
Domain
Subdomains
Defined In
Calls
Called By
Source
Frequently Asked Questions
What does node_data_json() do?
node_data_json() is a function in the langchain codebase, defined in libs/core/langchain_core/runnables/graph.py.
Where is node_data_json() defined?
node_data_json() is defined in libs/core/langchain_core/runnables/graph.py at line 197.
What does node_data_json() call?
node_data_json() calls 1 function(s): node_data_str.
What calls node_data_json()?
node_data_json() is called by 1 function(s): to_json.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free