Skip to content
ai-supply.store
DiscoverCategoriesLeaderboardsCommunityAgent APIFAQ
Sign inSign up free
catalog / Agentic capability / Instructor
⛨GuardrailAgentic capabilityFree

Instructor

Structured outputs for LLMs using Pydantic — patches any OpenAI-compatible client to return validated Python objects.

@ai-supply
Installs51k
⟳ upstream v1.15.4 · updated 28d ago
↗ Source repository
← More Agentic capabilityAgentic capability leaderboard →How we grade security →Source ↗
! Grade B · 75/100 · ReviewSecurity assessment
✓No compromise signals32capabilities surfaced1known CVE7of 20 OWASP controls clear
Suspicious network referencesBroad capability surfaceSuspicious network referencesPotentially unbounded loop
scanned 16d ago·osv · gitleaks · opengrep · picklescan + heuristics·full breakdown in the Security tab ↓

Instructor

Instructor is the simplest way to get structured, validated outputs from LLMs. It patches openai, anthropic, google-generativeai, and other clients with a single .from_* call, then uses Pydantic models to define the output schema and automatically validates (and retries on failure).

Key Features

  • Pydantic-native — define your output as any Pydantic model; Instructor handles schema generation and parsing
  • Multi-provider — OpenAI, Anthropic, Google Gemini, Ollama, Cohere, Mistral, and more
  • Auto-retry — on validation failure, Instructor feeds the error back to the LLM and retries automatically
  • Streaming — stream partial Pydantic objects as they are generated
  • Hooks — before/after hooks for logging, caching, and metrics
  • Zero prompt engineering — no need to write JSON-formatting instructions in your prompts

Quick Start

pip install instructor
import instructor
from openai import OpenAI
from pydantic import BaseModel

client = instructor.from_openai(OpenAI())

class User(BaseModel):
    name: str
    age: int

user = client.chat.completions.create(
    model="gpt-4o-mini",
    response_model=User,
    messages=[{"role": "user", "content": "Extract: John is 30 years old."}],
)
print(user)  # User(name='John', age=30)

Install via ai-supply

npx ai-supply add instructor-structured-outputs

Curated mirror of the open-source Instructor project (MIT). Install upstream from the repository.

Rating rank
#1
of 35 in Agentic capability
Install rank
#27
of 35 in Agentic capability
Security score
75/100 · B
review
Security rank
#23
of 35 in Agentic capability
Installs
51k
cat avg 186k
This listing vs category average
Installs
this
cat avg
Security (of 100)
this
cat avg
Adoption trend
See the Agentic capability leaderboard →
! Security: Review · 7575/100 · grade Bscanned 16d ago
✓ no compromise signals33 risk-surface · 8/20 OWASP controls flagged

Compromise signals — malicious or tampered code (leaked secrets, backdoors, a dropped executable) — reduce the score, and known dependency CVEs carry a bounded penalty (they warrant review but never QUARANTINE — update the dependency to clear). Other dangerous-by-capability traits are risk surface, expected for some capabilities. Every finding is mapped to its OWASP control below.

Control card · high confidence (static)
framework: pytestframework: guardrails-aiframework: langsmithcovers: secrets-leakcovers: jailbreakcovers: piicovers: hallucination
stringbooleantest_ValidatedUservalidate_agevalidate_answervalidate_options

Findings mapped to the OWASP Top 10 for LLM Applications (2025) and the OWASP Machine Learning Security Top 10. Expand any flagged control for the exact findings — compromise reduces the score; expected/risk-surface do not, except a known CVE, which carries a small bounded penalty (high/critical → Review).

OWASP Top 10 for LLM Applications
⚠LLM03Supply Chaincritical
Vulnerable/compromised dependencies, models or archives in the artifact.
•Dependency manifest — 5 pip requirements declared · 567-labs-instructor-cd698be/examples/chain-of-density/requirements.txtrisk surface
•Dependency manifest — 6 pip requirements declared · 567-labs-instructor-cd698be/examples/citation_with_extraction/requirements.txtrisk surface
•Dependency manifest — 7 pip requirements declared · 567-labs-instructor-cd698be/examples/logfire-fastapi/requirements.txtrisk surface
•Dependency manifest — 4 pip requirements declared · 567-labs-instructor-cd698be/examples/logfire/requirements.txtrisk surface
•Dependency manifest — 39 pip requirements declared · 567-labs-instructor-cd698be/requirements.txtrisk surface
•Vulnerable dependencies — 225 known vulnerabilities in: pillow@9.5.0, pymdown-extensions@9.9.2, aiohttp@3.9.5, filelock@3.19.1, idna@3.9.0, aiohttp@3.13.5, idna@3.11.0, requests@2.32.5 (CWE-1395)known CVE · -25 pts
⚠LLM01Prompt Injectionhigh
Adversarial instructions embedded in an artifact that hijack a downstream LLM.
•Prompt-injection phrasing — instruction-subversion language detected · 567-labs-instructor-cd698be/CHANGELOG.md (CWE-77)expected
⚠LLM05Improper Output Handlinghigh
Code that pipes model/user output into shell, eval, SQL or paths unsafely.
•Suspicious code patterns — pipe-to-shell install · 567-labs-instructor-cd698be/CONTRIBUTING.md (CWE-494)expected
•Suspicious code patterns — dynamic code execution · 567-labs-instructor-cd698be/docs/examples/sqlmodel.md (CWE-95)expected
•Suspicious code patterns — OS command execution · 567-labs-instructor-cd698be/examples/stream_action_items/run.py (CWE-78)expected
•Suspicious code patterns — environment/secret exfiltration · 567-labs-instructor-cd698be/instructor/cli/usage.py (CWE-200)expected
•Suspicious code patterns — dynamic os import · 567-labs-instructor-cd698be/tests/processing/test_formatting.pyexpected
•Suspicious code patterns — OS command execution; dynamic code execution · 567-labs-instructor-cd698be/tests/test_lazy_imports.py (CWE-78)expected
⚠LLM06Excessive Agencyhigh
Over-broad tool/permission surface or unrestricted egress.
•External endpoints declared — 1 distinct host(s) · 567-labs-instructor-cd698be/.cursor/rules/readme.mdexpected
•External endpoints declared — 2 distinct host(s) · 567-labs-instructor-cd698be/.github/workflows/scheduled-release.ymlexpected
•External endpoints declared — 3 distinct host(s) · 567-labs-instructor-cd698be/.gitignoreexpected
•External endpoints declared — 7 distinct host(s) · 567-labs-instructor-cd698be/CONTRIBUTING.mdexpected
•External endpoints declared — 12 distinct host(s) · 567-labs-instructor-cd698be/README.mdexpected
•External endpoints declared — 5 distinct host(s) · 567-labs-instructor-cd698be/docs/blog/.authors.ymlexpected
•External endpoints declared — 4 distinct host(s) · 567-labs-instructor-cd698be/docs/blog/posts/anthropic-web-search-structured.mdexpected
•Egress to a private/loopback host — 127.0.0.1 · 567-labs-instructor-cd698be/docs/blog/posts/full-fastapi-visibility.md (CWE-918)expected
•Broad capability surface — 3 high-impact capability categories referenced — verify least-privilege · 567-labs-instructor-cd698be/docs/blog/posts/introducing-structured-outputs-with-cerebras-inference.md (CWE-272)risk surface
•External endpoints declared — 10 distinct host(s) · 567-labs-instructor-cd698be/docs/blog/posts/open_source.mdexpected
•External endpoints declared — 6 distinct host(s) · 567-labs-instructor-cd698be/docs/blog/posts/rag-and-beyond.mdexpected
•External endpoints declared — 8 distinct host(s) · 567-labs-instructor-cd698be/docs/contributing.mdexpected
•External endpoints declared — 13 distinct host(s) · 567-labs-instructor-cd698be/docs/index.mdexpected
•External endpoints declared — 20 distinct host(s) · 567-labs-instructor-cd698be/sitemap.yamlexpected
•External endpoints declared — 23 distinct host(s) · 567-labs-instructor-cd698be/tests/test_utils.pyexpected
⚠LLM10Unbounded Consumptionmedium
Unbounded loops/recursion causing DoS or runaway cost.
Enforced at runtime by the gateway (rate limits + spend caps + size caps); static check flags unbounded loops.
•Potentially unbounded loop — an infinite loop (while True / while(1) / for(;;)) may cause runaway consumption · 567-labs-instructor-cd698be/docs/blog/posts/youtube-flashcards.md (CWE-835)risk surface
§LLM09MisinformationGovernance
Artifacts designed to produce false/deceptive output.
Detectable only by runtime behavioral evaluation; addressed via responsible-use attestation.
✓LLM02Sensitive Information DisclosurePassed
✓LLM04Data and Model PoisoningPassed
Backdoors/poisoning in training data or serialized models.
Behavioral poisoning needs model execution; static check covers unsafe serialization + dataset skew only.
✓LLM07System Prompt LeakagePassed
✓LLM08Vector and Embedding WeaknessesPassed
PII or plaintext source leakage in embedding/vector exports.
Embedding inversion/poisoning is largely runtime; static check covers PII in vector exports.
OWASP Machine Learning Security Top 10
⚠ML06AI Supply Chaincritical
Compromised PyPI/npm packages, typosquats, unsafe serialized models.
•Dependency manifest — 5 pip requirements declared · 567-labs-instructor-cd698be/examples/chain-of-density/requirements.txtrisk surface
•Dependency manifest — 6 pip requirements declared · 567-labs-instructor-cd698be/examples/citation_with_extraction/requirements.txtrisk surface
•Dependency manifest — 7 pip requirements declared · 567-labs-instructor-cd698be/examples/logfire-fastapi/requirements.txtrisk surface
•Dependency manifest — 4 pip requirements declared · 567-labs-instructor-cd698be/examples/logfire/requirements.txtrisk surface
•Dependency manifest — 39 pip requirements declared · 567-labs-instructor-cd698be/requirements.txtrisk surface
•Vulnerable dependencies — 225 known vulnerabilities in: pillow@9.5.0, pymdown-extensions@9.9.2, aiohttp@3.9.5, filelock@3.19.1, idna@3.9.0, aiohttp@3.13.5, idna@3.11.0, requests@2.32.5 (CWE-1395)known CVE · -25 pts
⚠ML02Data Poisoninghigh
Poisoned training datasets with triggers or anomalous distributions.
Static check covers trigger phrasing, PII and label skew; full poisoning detection is runtime.
•Prompt-injection phrasing — instruction-subversion language detected · 567-labs-instructor-cd698be/CHANGELOG.md (CWE-77)expected
⚠ML09Output Integrityhigh
Middleware tampering with model outputs in transit.
Gateway enforces TLS + response integrity; static check flags output-rewriting code.
•Suspicious code patterns — pipe-to-shell install · 567-labs-instructor-cd698be/CONTRIBUTING.md (CWE-494)expected
•Suspicious code patterns — dynamic code execution · 567-labs-instructor-cd698be/docs/examples/sqlmodel.md (CWE-95)expected
•Suspicious code patterns — OS command execution · 567-labs-instructor-cd698be/examples/stream_action_items/run.py (CWE-78)expected
•Suspicious code patterns — environment/secret exfiltration · 567-labs-instructor-cd698be/instructor/cli/usage.py (CWE-200)expected
•Suspicious code patterns — dynamic os import · 567-labs-instructor-cd698be/tests/processing/test_formatting.pyexpected
•Suspicious code patterns — OS command execution; dynamic code execution · 567-labs-instructor-cd698be/tests/test_lazy_imports.py (CWE-78)expected
§ML01Input Manipulation (Adversarial)Governance
Models vulnerable to adversarial perturbations.
Requires runtime robustness evaluation; addressed via publisher robustness attestation.
§ML03Model InversionGovernance
Training data reconstructable from a model's outputs.
Runtime/evaluation property; addressed via model-card data-provenance + DP attestation.
§ML04Membership InferenceGovernance
Determining whether a record was in the training set.
Runtime/evaluation property; addressed via overfitting disclosure + DP attestation.
§ML08Model SkewingGovernance
Models trained on skewed data producing biased output.
Requires fairness evaluation; addressed via model-card bias/limitations disclosure.
✓ML05Model TheftPassed
Unlicensed re-distribution / license-incompatible derivatives.
Static check verifies license declaration; extraction throttling is runtime.
✓ML07Transfer Learning AttackPassed
Backdoored base models / LoRA adapters propagating to derivatives.
Backdoor detection needs behavioral probing; static check covers unsafe serialization + provenance.
✓ML10Model Poisoning (Weights)Passed
Tampered model weight files; integrity must be verifiable.
Static check enforces safe formats + records a content hash for downstream verification.
Other findings (17) · hygiene / uncategorized
•Unrecognized file type — '.coveragerc' is not on the allowlist · 567-labs-instructor-cd698be/.coveragercrisk surface
•Unrecognized file type — '.mdc' is not on the allowlist · 567-labs-instructor-cd698be/.cursor/rules/documentation-sync.mdcrisk surface
•Unrecognized file type — '.cursorignore' is not on the allowlist · 567-labs-instructor-cd698be/.cursorignorerisk surface
•Unrecognized file type — '.gitignore' is not on the allowlist · 567-labs-instructor-cd698be/.gitignorerisk surface
•Unrecognized file type — '.?' is not on the allowlist · 567-labs-instructor-cd698be/LICENSErisk surface
•Suspicious network references — raw IP URL (6 URLs) · 567-labs-instructor-cd698be/docs/blog/posts/full-fastapi-visibility.mdrisk surface
•Suspicious network references — suspicious TLD (13 URLs) · 567-labs-instructor-cd698be/docs/blog/posts/open_source.mdrisk surface
•Suspicious network references — raw IP URL (2 URLs) · 567-labs-instructor-cd698be/docs/concepts/fastapi.mdrisk surface
•Suspicious network references — suspicious TLD (8 URLs) · 567-labs-instructor-cd698be/docs/integrations/together.mdrisk surface
•Unrecognized file type — '.jsonl' is not on the allowlist · 567-labs-instructor-cd698be/examples/distilations/math_finetunes.jsonlrisk surface
•Unrecognized file type — '.diff' is not on the allowlist · 567-labs-instructor-cd698be/examples/gpt-engineer/changes.diffrisk surface
•Suspicious network references — raw IP URL (1 URLs) · 567-labs-instructor-cd698be/examples/logfire-fastapi/Readme.mdrisk surface
•Suspicious network references — suspicious TLD (1 URLs) · 567-labs-instructor-cd698be/examples/patching/together.pyrisk surface
•Suspicious network references — suspicious TLD (7 URLs) · 567-labs-instructor-cd698be/instructor/v2/auto_client.pyrisk surface
•Unrecognized file type — '.pyi' is not on the allowlist · 567-labs-instructor-cd698be/instructor/v2/dsl/partial.pyirisk surface
•Suspicious network references — suspicious TLD (4 URLs) · 567-labs-instructor-cd698be/instructor/v2/providers/openai/client.pyrisk surface
•Suspicious network references — suspicious TLD (23 URLs) · 567-labs-instructor-cd698be/tests/test_utils.pyrisk surface
✔ verified source · pinned 567-labs-instructor-cd698be
Check against a policy

The same gate an agent runs before installing (POST /api/v1/trust/instructor-structured-outputs/check). Click a policy:

Consume Instructor programmatically. Authenticate with an API key or session — see Authorize an agent.

# Agents: CHECK BEFORE YOU INSTALL (no auth) — score, grade, level, capability manifest
curl https://ai-supply.store/api/v1/trust/instructor-structured-outputs

# Gate against your org policy (returns { pass, violations })
curl -X POST https://ai-supply.store/api/v1/trust/instructor-structured-outputs/check \
  -H "Content-Type: application/json" \
  -d '{"minGrade":"B","denyPermissions":["shell"],"denyUnknownEgress":true}'

# CLI
npx ai-supply add instructor-structured-outputs

# REST (install → download)
curl -X POST https://ai-supply.store/api/v1/listings/instructor-structured-outputs/install \
  -H "Authorization: Bearer $AIM_KEY"

# MCP tool
install_listing({ "slug": "instructor-structured-outputs" })
OpenAPI spec →
vlatest
! Security: Review · 751mo ago

Curated mirror — latest upstream source. See the repository for tagged releases.

Sign in and install this listing to leave a review.

More from @ai-supply

View profile →
◉Agent
MetaGPT
Multi-agent framework that assigns GPT roles (PM, engineer, QA) to solve complex software tasks end-to-end.
↓ 1.0M
⇄Connector
vLLM
High-throughput, memory-efficient LLM inference engine with PagedAttention and continuous batching.
↓ 892k
⇄Connector
Meilisearch
Lightning-fast open-source search engine with typo-tolerance, semantic hybrid search, and sub-50ms response times.
↓ 811k
△Eval
Weights & Biases (wandb)
ML experiment tracking and visualization — log metrics, hyperparameters, models, and media in real time.
↓ 784k
ai-supply.store

Free, security-vetted AI capabilities — skills, MCPs, plugins, agents, datasets and more, each graded and freshness-tracked, and built for humans and agents alike.

api · v3.1status · all green
Contact
support@ai-supply.storesecurity@ai-supply.store
Catalog
  • Discover
  • Categories
  • Leaderboards
  • Benchmarks
  • Security
  • Scan a repo
Community
  • Community
  • FAQ
For agents
  • Quickstart (60s)
  • Authorize an agent
  • Agent API
  • OpenAPI spec
For builders
  • Publish
  • Dashboard
Account
  • Create account
  • Sign in
  • Settings
Legal
  • Terms
  • Publisher Agreement
  • Acceptable Use
  • Privacy