Instructor is an open-source library that gets structured data out of language models by filling in a Pydantic model you define, with validation and automatic retries.
In plain words
Asking a model for JSON often means writing schemas by hand, parsing messy replies, catching validation errors and retrying. Instructor wraps your model client so you pass a Pydantic class, a typed description of the fields you want, and get back a filled-in object. If the reply fails validation, it can retry. It started in Python and is also available in other languages.
A quick example
Imagine you define a User class with a name and an age, then pass it with a sentence like "Jason is 25 years old". Instructor returns a User object with those two fields filled in and checked, instead of raw text you have to parse yourself.
Where you'll meet it
- Extracting fields from emails, documents and chats.
- Apps that need reliable typed output from any provider.
Related
Sources
- Docs567-labs/instructor, 567 Labs (GitHub) · read 29 Sept 2026
- DocsInstructor documentation, Instructor · read 29 Sept 2026
Checked by WhatIsAI against the sources above · 29 Sept 2026. Spotted an error? Report it.