Branch#

class langchain_core.runnables.graph.Branch(condition: Callable[..., str], ends: dict[str, str] | None)[source]#

Branch in a graph.

Parameters:
  • condition (Callable[[...], str]) – A callable that returns a string representation of the condition.

  • ends (dict[str, str] | None) – Optional dictionary of end node ids for the branches. Defaults to None.

Create new instance of Branch(condition, ends)

Attributes

condition

Alias for field number 0

ends

Alias for field number 1

Methods

__init__()

count(value, /)

Return number of occurrences of value.

index(value[, start, stop])

Return first index of value.

__init__()#
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.