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

count(value,ย /)

Return number of occurrences of value.

index(value[,ย start,ย stop])

Return first index of value.

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.