Problem Statement
At this moment, condition function for edges has access to the graph state only, but can't access invocation state. This makes it very difficult to conditionally enable some nodes based on the invocation_state received in the graph invocation
Proposed Solution
Change the add_edge from:
def add_edge(
self,
from_node: str | GraphNode,
to_node: str | GraphNode,
condition: Callable[[GraphState], bool] | None = None,
) -> GraphEdge:
To:
def add_edge(
self,
from_node: str | GraphNode,
to_node: str | GraphNode,
condition: Callable[[GraphState, dict[str, Any] | None], bool] | None = None,
) -> GraphEdge:
To condition functions to look like:
def should_generate_first(state: GraphState, invocation_state: dict[str, Any] | None = None) -> bool:
Use Case
This allow some nodes to be executed based on some input from the graph invocation.
Alternatives Solutions
No response
Additional Context
No response
Problem Statement
At this moment, condition function for edges has access to the graph state only, but can't access invocation state. This makes it very difficult to conditionally enable some nodes based on the
invocation_statereceived in the graph invocationProposed Solution
Change the
add_edgefrom:To:
To condition functions to look like:
Use Case
This allow some nodes to be executed based on some input from the graph invocation.
Alternatives Solutions
No response
Additional Context
No response