Branch#

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

Branch in a graph.

Create new instance of Branch(condition, ends)

Attributes

condition

A callable that returns a string representation of the condition.

ends

Optional dictionary of end node ids for the branches.

Methods

count(value, /)

Return number of occurrences of value.

index(value[, start, stop])

Return first index of value.

Parameters:
  • condition (Callable[[...], str])

  • ends (dict[str, str] | None)

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.