If#

class council.runners.If(predicate: Callable[[ChainContext], bool], runner: RunnerBase, else_runner: RunnerBase | None = None)[source]#

Bases: RunnerBase

Runner that executes only if the predicate returns True

__init__(predicate: Callable[[ChainContext], bool], runner: RunnerBase, else_runner: RunnerBase | None = None)[source]#
Parameters:
  • predicate – a predicate function

  • runner – a runner to be executed only if the predicate returns True

  • else_runner – an optional runner to be executed only if the predicate returns False

render_as_dict(include_children: bool = True) Dict[str, Any]#

returns the graph of operation as a dictionary

render_as_json() str#

returns the graph of operation as a JSON string