nl2sql

RefinerNode

Overview


Responsibilities


Position in Execution Graph

Upstream:

Downstream:

Trigger conditions:

flowchart LR
    RetryHandler[retry_handler] --> Refiner[RefinerNode] --> Planner[ASTPlannerNode]

Inputs

From SubgraphExecutionState:

Validation performed:


Outputs

Mutations to SubgraphExecutionState:

Side effects:


Internal Flow (Step-by-Step)

  1. If no LLM configured, emit MISSING_LLM and stop.
  2. Serialize relevant tables and failed plan.
  3. Build error and reasoning strings.
  4. Invoke LLM with refinement prompt.
  5. Emit PLAN_FEEDBACK warning and return RefinerResponse.
  6. On exception, emit REFINER_FAILED.

Contracts & Interfaces

Implements a LangGraph node callable:

def __call__(self, state: SubgraphExecutionState) -> Dict[str, Any]

Key contracts:


Determinism Guarantees


Error Handling

Emits PipelineError with:

Logs failures via logger.error.


Retry + Idempotency


Performance Characteristics


Observability


Configuration


Extension Points


Known Limitations