Signal · Validation and retriesRetry on validation failure (
Retry on validation failure (onRetry)
When a response fails schema validation, Signal calls the .onRetry() handler with the error and the attempt number, appends the response and the validation error to the conversation, and sends the request again. Example: seats arrives as a string, and the second response passes. The model’s replies are scripted, the correction message is Signal’s, and no model is called.
z.object({ show: z.string(), seats: z.number() })'Two for The Tempest on Saturday, please. Grace'
Run, turn by turn
{"show":"The Tempest","seats":"two"}{
attempt: 1,
message: 'Response failed schema validation: seats: Invalid input: expected number, received string',
}Runs in this page on the installed package. The input and the expected output are defined by the example.