outlines
View on GitHubStructured Outputs
Python library for generating schema-constrained outputs from language models. Supports types such as Pydantic models, JSON schemas, and grammars, with integrations for local and hosted inference backends.
Use Cases
Generate schema-valid JSON from LLMsExtract structured fields from emails and documentsClassify products into structured categoriesCreate typed customer support ticketsGenerate data constrained by enums and literalsProduce structured event details from incomplete descriptionsImplement reliable function-calling workflows
Built With
- Language
- Python
- Frameworks
- Pydantic · Transformers · vLLM · Ollama · llama.cpp · SGLang · LM Studio · TensorRT-LLM
Tags
structured outputs · constrained generation · JSON generation · grammar constraints · schema validation · LLM programming · provider-agnostic