Validator
Auto-generated API reference for Validator.
Interface: Validator
Defined in: validator-guard.ts:31
#Properties
#check
check: (
ctx) =>ValidatorResult|Promise<ValidatorResult>
Defined in: validator-guard.ts:41
Return true (or a \{ ok: true \} object) when the output passes.
Return false (or \{ ok: false, reason \}) to fail.
Async checks are supported β useful for eval LLM-judge or RAG citation lookups.
#Parameters
ctx
#Returns
ValidatorResult | Promise<ValidatorResult>
#maxRetries?
optionalmaxRetries?:number
Defined in: validator-guard.ts:45
Cap retries per run. Default 1.
#name
name:
string
Defined in: validator-guard.ts:33
Stable id for audit logs / dashboards.
#onFail?
optionalonFail?:ValidatorAction
Defined in: validator-guard.ts:43
What to do on failure. Default 'retry' (with up to maxRetries).
#repairPrompt?
optionalrepairPrompt?: (ctx) =>string
Defined in: validator-guard.ts:50
Repair instruction appended to the regenerator on retry. Lets the agent self-correct. Receives the failure context.
#Parameters
ctx
output
string
reason?
string
#Returns
string