| Name | Type | Description |
|---|---|---|
evaluate_fn* | Callable[[Any], dict[str, Any]] | Node function that evaluates the current draft and returns state updates including evaluation results. |
refine_fn* | Callable[[Any], dict[str, Any]] | |
should_refine_fn* | Callable[[Any], str] | |
state_schema* | type | |
max_iterations | int | Default: 3 |
accepted_route | str | Default: 'accepted' |
refine_route | str | Default: 'refine' |
Build a compiled evaluator-optimizer subgraph.
Creates a LangGraph StateGraph that implements the
evaluate→refine loop pattern. The returned compiled graph can
be used as a node in a parent graph.
Node function that refines the draft based on evaluation feedback.
Routing function that returns accepted_route or refine_route based on state.
The TypedDict class for the subgraph state.
Safety limit on refinement loops.
Route name when evaluation passes.
Route name when refinement is needed.