Node#
- class langchain_core.runnables.graph.Node(id: str, name: str, data: type[BaseModel] | RunnableType, metadata: dict[str, Any] | None)[source]#
Node in a graph.
- Parameters:
id (str) – The unique identifier of the node.
name (str) – The name of the node.
data (Union[type[BaseModel], RunnableType]) – The data of the node.
metadata (Optional[dict[str, Any]]) – Optional metadata for the node. Defaults to None.
Create new instance of Node(id, name, data, metadata)
Attributes
data
Alias for field number 2
id
Alias for field number 0
metadata
Alias for field number 3
name
Alias for field number 1
Methods
copy
(*[, id, name])Return a copy of the node with optional new id and name.
count
(value, /)Return number of occurrences of value.
index
(value[, start, stop])Return first index of value.
- copy(*, id: str | None = None, name: str | None = None) Node [source]#
Return a copy of the node with optional new id and name.
- Parameters:
id (str | None) – The new node id. Defaults to None.
name (str | None) – The new node name. Defaults to None.
- Returns:
A copy of the node with the new id and name.
- Return type:
- count(value, /)#
Return number of occurrences of value.
- index(value, start=0, stop=9223372036854775807, /)#
Return first index of value.
Raises ValueError if the value is not present.
Examples using Node