# Outlines

CreateWithAI Hub page: https://createwithaihub.com/open-source/outlines
Latest version of this file: https://createwithaihub.com/open-source/outlines.md

- Type: Library · Category: Libraries & Open Source
- Publisher: .txt (dottxt)
- Pricing: Free · License: Apache-2.0
- Runs on: macOS, Windows, Linux

Python library from .txt that constrains LLM generation so outputs match JSON schemas, regexes, choices or grammars.

Outlines is an open-source Python library for structured generation: instead of parsing model output after the fact, it constrains generation so the result matches the type you pass in. Output types can be Literal choices, Python types, Pydantic models or JSON schemas, regular expressions or context-free grammars. The same code runs with local models (transformers, llama.cpp), servers (vLLM, Ollama) and APIs (OpenAI, Gemini). It is made by the team at .txt.

Useful for: Classifying support tickets into a fixed set of labels, or extracting fields into a Pydantic model, with output that is always valid.

## Key features

- Constrained generation from Python types and Pydantic models
- Multiple choice, JSON schema, regex and context-free grammar outputs
- Function-signature-based structure inference
- Local models (transformers, llama.cpp), servers (vLLM, Ollama) and APIs (OpenAI, Gemini)
- Prompt templates and reusable applications

## Connection

- Language: Python
- Focus: Structured output

## Install steps from the official documentation

pip:

```
pip install outlines
```

## Limitations

- The .txt hosted API is in early access by request, with no public pricing
- Python only

## Official links

- Source repository: https://github.com/dottxt-ai/outlines
- Documentation: https://dottxt-ai.github.io/outlines/latest/
- Source: https://github.com/dottxt-ai/outlines (README: description, install, model integrations, core and other features, .txt API early access; LICENSE: Apache-2.0)
