Node#

class langchain_core.runnables.graph.Node(
id: str,
name: str,
data: type[BaseModel] | RunnableType | None,
metadata: dict[str, Any] | None,
)[source]#

Node in a graph.

Create new instance of Node(id, name, data, metadata)

Attributes

data

The data of the node.

id

The unique identifier of the node.

metadata

Optional metadata for the node.

name

The name of the node.

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.

Parameters:
  • id (str)

  • name (str)

  • data (Union[type[BaseModel], RunnableType, None])

  • metadata (Optional[dict[str, Any]])

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:

Node

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