ax-refine

Installation
SKILL.md

Ax Refine And BestOfN

Use bestOfN(...) when you can score complete outputs independently. Use refine(...) when failed rounds should produce feedback that changes the next attempt.

Validation And Assertions

Keep reward scoring, whole-output assertions, and streaming assertions separate:

  • Use schema validation for shape, types, and field-level constraints.
  • Use addAssert(...) for whole-output hard invariants. Failed assertions feed correction text into the normal retry loop.
  • Use addStreamingAssert(...) for partial streaming hard invariants. It aborts the current stream attempt as soon as the partial field fails, then feeds correction text into the normal retry loop.
  • Use bestOfN(...) for complete-candidate selection.
  • Use refine(...) for reward-scored retry rounds with generated feedback.

APIs

import { bestOfN, refine } from '@ax-llm/ax';
Installs
48
First Seen
Jun 17, 2026
ax-refine from ax-llm.github.io