← AI GitHub

AI GitHub

Instructor JS for schema-validated TypeScript responses

Bring schema-based parsing and retries to JavaScript model clients.

Language ModelsPublished 2 min read

Key Takeaways

  • The TypeScript client accepts a schema for the model response and wraps a compatible provider interaction.
  • Start with a provider integration documented for JavaScript and a small output schema.
  • Start with a schema for one support-ticket classification.
  • Keep the output schema and retry limits narrow.

How it works

The TypeScript client accepts a schema for the model response and wraps a compatible provider interaction. Validation turns a response into a value downstream code can use with an explicit contract.

What you need

Start with a provider integration documented for JavaScript and a small output schema. Put retry limits and timeout handling in the same test that checks parsed values.

What to try first

Start with a schema for one support-ticket classification. Feed the tool an empty ticket and an unfamiliar category, then see how retries and error reporting behave.

Test a provider that returns incomplete responses under a small output limit. The application needs a visible error path for inputs that remain invalid across attempts.

Where to look for failures

Keep the output schema and retry limits narrow. Check the documented provider support and handle exhausted retries as a distinct outcome in your application.

Related Franklin pages

Test both a valid structured response and one that requires recovery. A good application contract specifies what happens after the allowed attempts are exhausted.

For the distinction between requesting structured output and enforcing its format, see Franklin’s glossary. Structured output

Project documentation

Try it for your workflow

Explore the project’s documentation for setup and usage, or save this page to a collection for later.

Read the project documentation ↗