Signal · Validation and retries

Retries exhausted (E_VALIDATION_FAILED)

When every response fails schema validation, the call rejects with code E_VALIDATION_FAILED once the retries are used up: two by default, set with .retries(). An invalid response is never returned. Example: the same invalid reply to all three requests; the model’s replies are scripted and no model is called.

Schema
z.object({ show: z.string(), seats: z.number() })
Run, request by request
Conversation
user
  Two for The Tempest on Saturday, please. Grace
Scripted model reply
{"show":"The Tempest","seats":"two"}
Output matches the expected value

Runs in this page on the installed package. The input and the expected output are defined by the example.