Esta página se muestra en inglés. Una traducción al español está en curso.
SkillsMay 11, 2026·2 min de lectura

Instructor — Typed Structured Outputs for LLMs

Instructor turns LLM replies into validated Pydantic models with retries. `pip install instructor`, then extract typed objects across major providers.

Listo para agents

Instalación lista para agent

Este activo puede instalarse después de elegir el runtime, revisar el plan y ejecutar el comando correspondiente.

Native · 98/100Política: permitir
Superficie agent
Cualquier agent MCP/CLI
Tipo
Skill
Instalación
Single
Confianza
Confianza: Established
Entrada
Asset
Comando de instalación directa
npx -y tokrepo@latest install e4780821-245b-49db-9315-ba6260689aa5 --target codex

Ejecutar después de confirmar el plan con dry-run.

Introducción

Instructor turns LLM replies into validated Pydantic models with retries. pip install instructor, then extract typed objects across major providers.

  • Best for: backend teams who need reliable, typed extraction (JSON-safe) without hand-written parsers and fragile regex cleanup
  • Works with: Python, Pydantic models, OpenAI/Anthropic/Google/Ollama providers (per repo examples)
  • Setup time: 8 minutes

Quantitative Notes

  • GitHub stars (verified): see Source & Thanks
  • Setup time ~8 minutes
  • Install command: pip install instructor (repo)

Practical Notes

Use Instructor when you already know the shape of the answer and you want the model to fill it in with high reliability. Start with one Pydantic model per call (e.g., User, ProductReview), add tight field constraints (enums, ranges), then layer in retry budgets. Once stable, treat the schema as an API contract: version it, add regression examples, and monitor validation failures as a quality metric.

Safety note: Schema discipline matters: oversized models and ambiguous fields cause retries, latency, and cost spikes.

FAQ

Q: What problem does Instructor solve? A: It enforces a typed schema on LLM outputs (Pydantic) and retries invalid generations, so you ship structured results instead of brittle parsing.

Q: Is it only for OpenAI? A: No. The repo shows provider strings for OpenAI, Anthropic, Google, and local Ollama; the API stays consistent.

Q: How do I reduce failures? A: Keep the schema minimal, constrain enums, and ask for one object per call; smaller schemas validate more reliably and retry less.


🙏

Fuente y agradecimientos

GitHub: https://github.com/567-labs/instructor Owner avatar: https://avatars.githubusercontent.com/u/152629781?v=4 License (SPDX): MIT GitHub stars (verified via api.github.com/repos/instructor-ai/instructor): 12,947

Discusión

Inicia sesión para unirte a la discusión.
Aún no hay comentarios. Sé el primero en compartir tus ideas.

Activos relacionados