instructor
View on GitHubstructured outputs for llms
Python library that turns any LLM into a validated structured-output client: define a Pydantic model, call create(response_model=...), and get typed objects with automatic retries, streaming, and nested-object support across OpenAI, Anthropic, Google, Ollama and more.
Use Cases
Extract typed structured data from natural languageValidate and auto-retry LLM JSON responsesStream partial Pydantic objects as they generateExtract nested/complex objects from unstructured textUse one structured-output API across many LLM providersParse documents, forms, and emails into schemasEntity and field extraction pipelinesText classification with typed labelsBatch structured extraction jobsReplace hand-written JSON schema/parsing code
Built With
- Language
- Python
- Frameworks
- pydantic · openai-python · anthropic-sdk · google-genai · litellm · ollama · groq · cohere · mistral · typer · tenacity · jinja2 · aiohttp · mkdocs
Tags
structured-outputs · pydantic · json-schema · function-calling · validation · retries · streaming · llm-extraction · type-safety · multi-provider · python · openai · anthropic · ollama · data-extraction · llm-ops