# 567-labs/instructor

structured outputs for llms

Repository: https://github.com/567-labs/instructor
Canonical: https://ross.abutalabs.com/products/instructor
Homepage: https://python.useinstructor.com/
Language: Python
License: MIT
License Family: permissive
Topics: openai, python, pydantic-v2, openai-functions, validation, openai-function-calli
Last push: 2026-08-09T14:55:49+00:00

## Health v2 (maintenance only)
Score: 92/100 (v2, computed 2026-09-02T17:46:02.011165+00:00)
- activity 96, release rhythm 90, longevity 84
- inputs: {"age_days": 1176, "days_push": 24, "days_rel": 66, "gap_med": 7, "n_releases_24m": 44}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 13782, forks 1205 (observed 2026-08-28T04:11:04.763450+00:00)

## What it is
Instructor is a Python library that patches LLM clients to return validated, type-safe structured data using Pydantic models, with automatic retries and streaming. It supports 15+ providers including OpenAI, Anthropic, Google Gemini, Mistral, Cohere, and local models via Ollama and llama.cpp.

## Use cases
- extract structured data from llm responses
- get validated  from gpt-4 or claude
- parse resumes or documents into pydantic models with an llm
- retry llm calls automatically when validation fails
- stream partial structured outputs from a language model
- use function calling across multiple llm providers with one interface

## When to choose
- you need schema-first structured extraction from any LLM with type safety
- you want Pydantic validation and automatic reasking on failed outputs
- you need a unified interface across OpenAI, Anthropic, Gemini, and other providers

## When to avoid
- you need full agent frameworks with tools, traces, and observability (consider PydanticAI)
- you want raw unstructured LLM text generation
- you are not working in Python or another supported language runtime

## Facets
- artifact type: library
- maturity: stable
- function: llm-inference, serialization, sdk, middleware
- domain: large-language-models, artificial-intelligence, developer-tools
- platform: python, cross-platform
- tags: structured-outputs, pydantic, openai, function-calling, data-extraction, validation, retries, multi-provider, natural-language-processing

## Member repositories
- 567-labs/instructor (main) score 92

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:11:04.763450+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-29T17:13:02.567191+00:00, confidence not recorded.
  - readme: https://github.com/567-labs/instructor (fetched 2026-08-28T04:11:04.763450+00:00, sha 6f1fb687b0f2)
  - homepage: https://python.useinstructor.com/ (fetched 2026-08-29T08:07:27.106961+00:00, sha a5c4f6548e67)
  - site_page: https://python.useinstructor.com/learning/getting_started/installation (fetched 2026-08-29T08:07:27.116732+00:00, sha b8179c5ec873)
  - site_page: https://python.useinstructor.com/getting-started (fetched 2026-08-29T08:07:27.121677+00:00, sha 920e815ad85d)
  - site_page: https://python.useinstructor.com/installation (fetched 2026-08-29T08:07:27.123829+00:00, sha 0364db8a18a9)
  - registry_pypi: https://pypi.org/pypi/instructor/json (fetched 2026-08-29T08:07:27.133623+00:00, sha c430633aa726)
  - site_page: https://python.useinstructor.com/integrations (fetched 2026-08-29T08:07:27.119260+00:00, sha 3a80e78b3d25)
  - site_page: https://python.useinstructor.com/faq (fetched 2026-08-29T08:07:27.125545+00:00, sha d57b3d29787c)
  - site_page: https://python.useinstructor.com/concepts/reask_validation (fetched 2026-08-29T08:07:27.127453+00:00, sha e89d5453376e)
  - site_page: https://python.useinstructor.com/integrations/openai (fetched 2026-08-29T08:07:27.129392+00:00, sha abb99fe81f59)
- Data as of 2026-08-30T08:39:29.467469+00:00.
