Signal · Validation and retries
JSON extraction from prose
When a response has prose or a code fence around the JSON, Signal extracts the JSON value and accepts it only if it passes schema validation. Example: a sentence and a json code fence around a valid booking, which takes one request and no retry. The model’s reply is scripted; no model is called.
z.object({ show: z.string(), seats: z.number() })Here is the booking:
```json
{"show":"The Tempest","seats":2}
```
Anything else?{
response: { show: 'The Tempest', seats: 2 },
requests: 1,
retries: 0,
}Runs in this page on the installed package. The input and the expected output are defined by the example.