outlines


Nameoutlines JSON
Version 1.1.0 PyPI version JSON
download
home_pageNone
SummaryProbabilistic Generative Model Programming
upload_time2025-07-10 18:27:32
maintainerNone
docs_urlNone
authorOutlines Developers
requires_python<3.13,>=3.9
licenseApache-2.0
keywords machine learning deep learning language models structured generation
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <div align="center" style="margin-bottom: 1em;">

<img src="./docs/assets/images/logo-light-mode.svg#gh-light-mode-only" alt="Outlines Logo" width=300></img>
<img src="./docs/assets/images/logo-dark-mode.svg#gh-dark-mode-only" alt="Outlines Logo" width=300></img>


 🗒️ *Structured outputs for LLMs* 🗒️

Made with ❤👷️ by the team at [.txt](https://dottxt.co)
<br>Trusted by NVIDIA, Cohere, HuggingFace, vLLM, etc.

<!-- Project Badges -->
[![PyPI Version][pypi-version-badge]][pypi]
[![Downloads][downloads-badge]][pypistats]
[![Stars][stars-badge]][stars]

<!-- Community Badges -->
[![Discord][discord-badge]][discord]
[![Blog][dottxt-blog-badge]][dottxt-blog]
[![Twitter][twitter-badge]][twitter]

</div>

Need a high-performance commercial solution for structured outputs? Email us at [contact@dottxt.co](mailto:contact@dottxt.co), or [schedule a call](https://cal.com/team/dottxt/sales).

## Table of Contents

- [Why Outlines?](#why-outlines)
- [Quickstart](#quickstart)
- [Real-World Examples](#real-world-examples)
  - [🙋‍♂️ Customer Support Triage](#customer-support-triage)
  - [📦 E-commerce Product Categorization](#e-commerce-product-categorization)
  - [📊 Parse Event Details with Incomplete Data](#parse-event-details-with-incomplete-data)
  - [🗂️ Categorize Documents into Predefined Types](#categorize-documents-into-predefined-types)
  - [📅 Schedule a Meeting with Function Calling](#schedule-a-meeting-with-function-calling)
  - [📝 Dynamically Generate Prompts with Re-usable Templates](#dynamically-generate-prompts-with-re-usable-templates)
- [They Use Outlines](#they-use-outlines)
- [Model Integrations](#model-integrations)
- [Core Features](#core-features)
- [Other Features](#other-features)
- [About .txt](#about-txt)
- [Community](#community)

<div align="center"><img src="./docs/assets/images/install.png" width=300></img></div>

## Why Outlines?

LLMs are powerful but their outputs are unpredictable. Most solutions attempt to fix bad outputs after generation using parsing, regex, or fragile code that breaks easily.

Outlines guarantees structured outputs during generation — directly from any LLM.

- **Works with any model** - Same code runs across OpenAI, Ollama, vLLM, and more
- **Simple integration** - Just pass your desired output type: `model(prompt, output_type)`
- **Guaranteed valid structure** - No more parsing headaches or broken JSON
- **Provider independence** - Switch models without changing code


### The Outlines Philosophy

<div align="center"><img src="./docs/assets/images/use_philosophy.png" width=300></img></div>

Outlines follows a simple pattern that mirrors Python's own type system. Simply specify the desired output type, and Outlines will ensure your data matches that structure exactly:

- For a yes/no response, use `Literal["Yes", "No"]`
- For numerical values, use `int`
- For complex objects, define a structure with a [Pydantic model](https://docs.pydantic.dev/latest/)

## Quickstart

Getting started with outlines is simple:

### 1. Install outlines

``` shell
pip install outlines
```

### 2. Connect to your preferred model

``` python
import outlines
from transformers import AutoTokenizer, AutoModelForCausalLM


MODEL_NAME = "microsoft/Phi-3-mini-4k-instruct"
model = outlines.from_transformers(
    AutoModelForCausalLM.from_pretrained(MODEL_NAME, device_map="auto"),
    AutoTokenizer.from_pretrained(MODEL_NAME)
)
```

### 3. Start with simple structured outputs

``` python
from typing import Literal
from pydantic import BaseModel


# Simple classification
sentiment = model(
    "Analyze: 'This product completely changed my life!'",
    Literal["Positive", "Negative", "Neutral"]
)
print(sentiment)  # "Positive"

# Extract specific types
temperature = model("What's the boiling point of water in Celsius?", int)
print(temperature)  # 100
```

### 4. Create complex structures

``` python
from pydantic import BaseModel
from enum import Enum

class Rating(Enum):
    poor = 1
    fair = 2
    good = 3
    excellent = 4

class ProductReview(BaseModel):
    rating: Rating
    pros: list[str]
    cons: list[str]
    summary: str

review = model(
    "Review: The XPS 13 has great battery life and a stunning display, but it runs hot and the webcam is poor quality.",
    ProductReview,
    max_new_tokens=200,
)

review = ProductReview.model_validate_json(review)
print(f"Rating: {review.rating.name}")  # "Rating: good"
print(f"Pros: {review.pros}")           # "Pros: ['great battery life', 'stunning display']"
print(f"Summary: {review.summary}")     # "Summary: Good laptop with great display but thermal issues"
```

## Real-world examples

Here are production-ready examples showing how Outlines solves common problems:

<details id="customer-support-triage"><summary><b>🙋‍♂️ Customer Support Triage</b>
<br>This example shows how to convert a free-form customer email into a structured service ticket. By parsing attributes like priority, category, and escalation flags, the code enables automated routing and handling of support issues.
</summary>

``` python
import outlines
from enum import Enum
from pydantic import BaseModel
from transformers import AutoTokenizer, AutoModelForCausalLM
from typing import List


MODEL_NAME = "microsoft/Phi-3-mini-4k-instruct"
model = outlines.from_transformers(
    AutoModelForCausalLM.from_pretrained(MODEL_NAME, device_map="auto"),
    AutoTokenizer.from_pretrained(MODEL_NAME)
)


def alert_manager(ticket):
    print("Alert!", ticket)


class TicketPriority(str, Enum):
    low = "low"
    medium = "medium"
    high = "high"
    urgent = "urgent"

class ServiceTicket(BaseModel):
    priority: TicketPriority
    category: str
    requires_manager: bool
    summary: str
    action_items: List[str]


customer_email = """
Subject: URGENT - Cannot access my account after payment

I paid for the premium plan 3 hours ago and still can't access any features.
I've tried logging out and back in multiple times. This is unacceptable as I
have a client presentation in an hour and need the analytics dashboard.
Please fix this immediately or refund my payment.
"""

prompt = f"""
<|im_start|>user
Analyze this customer email:

{customer_email}
<|im_end|>
<|im_start|>assistant
"""

ticket = model(
    prompt,
    ServiceTicket,
    max_new_tokens=500
)

# Use structured data to route the ticket
ticket = ServiceTicket.model_validate_json(ticket)
if ticket.priority == "urgent" or ticket.requires_manager:
    alert_manager(ticket)
```
</details>

<details id="e-commerce-product-categorization"><summary><b>📦 E-commerce product categorization</b>
<br>This use case demonstrates how outlines can transform product descriptions into structured categorization data (e.g., main category, sub-category, and attributes) to streamline tasks such as inventory management. Each product description is processed automatically, reducing manual categorization overhead.
</summary>

```python
import outlines
from pydantic import BaseModel
from transformers import AutoTokenizer, AutoModelForCausalLM
from typing import List, Optional


MODEL_NAME = "microsoft/Phi-3-mini-4k-instruct"
model = outlines.from_transformers(
    AutoModelForCausalLM.from_pretrained(MODEL_NAME, device_map="auto"),
    AutoTokenizer.from_pretrained(MODEL_NAME)
)


def update_inventory(product, category, sub_category):
    print(f"Updated {product.split(',')[0]} in category {category}/{sub_category}")


class ProductCategory(BaseModel):
    main_category: str
    sub_category: str
    attributes: List[str]
    brand_match: Optional[str]

# Process product descriptions in batches
product_descriptions = [
    "Apple iPhone 15 Pro Max 256GB Titanium, 6.7-inch Super Retina XDR display with ProMotion",
    "Organic Cotton T-Shirt, Men's Medium, Navy Blue, 100% Sustainable Materials",
    "KitchenAid Stand Mixer, 5 Quart, Red, 10-Speed Settings with Dough Hook Attachment"
]

template = outlines.Template.from_string("""
<|im_start|>user
Categorize this product:

{{ description }}
<|im_end|>
<|im_start|>assistant
""")

# Get structured categorization for all products
categories = model(
    [template(description=desc) for desc in product_descriptions],
    ProductCategory,
    max_new_tokens=200
)

# Use categorization for inventory management
categories = [
    ProductCategory.model_validate_json(category) for category in categories
]
for product, category in zip(product_descriptions, categories):
    update_inventory(product, category.main_category, category.sub_category)
```
</details>

<details id="parse-event-details-with-incomplete-data"><summary><b>📊 Parse event details with incomplete data</b>
<br>This example uses outlines to parse event descriptions into structured information (like event name, date, location, type, and topics), even handling cases where the data is incomplete. It leverages union types to return either structured event data or a fallback “I don’t know” answer, ensuring robust extraction in varying scenarios.
</summary>

```python
import outlines
from typing import Union, List, Literal
from pydantic import BaseModel
from enum import Enum
from transformers import AutoTokenizer, AutoModelForCausalLM


MODEL_NAME = "microsoft/Phi-3-mini-4k-instruct"
model = outlines.from_transformers(
    AutoModelForCausalLM.from_pretrained(MODEL_NAME, device_map="auto"),
    AutoTokenizer.from_pretrained(MODEL_NAME)
)

class EventType(str, Enum):
    conference = "conference"
    webinar = "webinar"
    workshop = "workshop"
    meetup = "meetup"
    other = "other"


class EventInfo(BaseModel):
    """Structured information about a tech event"""
    name: str
    date: str
    location: str
    event_type: EventType
    topics: List[str]
    registration_required: bool

# Create a union type that can either be a structured EventInfo or "I don't know"
EventResponse = Union[EventInfo, Literal["I don't know"]]

# Sample event descriptions
event_descriptions = [
    # Complete information
    """
    Join us for DevCon 2023, the premier developer conference happening on November 15-17, 2023
    at the San Francisco Convention Center. Topics include AI/ML, cloud infrastructure, and web3.
    Registration is required.
    """,

    # Insufficient information
    """
    Tech event next week. More details coming soon!
    """
]

# Process events
results = []
for description in event_descriptions:
    prompt = f"""
<|im_start>system
You are a helpful assistant
<|im_end|>
<|im_start>user
Extract structured information about this tech event:

{description}

If there is enough information, return a JSON object with the following fields:

- name: The name of the event
- date: The date where the event is taking place
- location: Where the event is taking place
- event_type: either 'conference', 'webinar', 'workshop', 'meetup' or 'other'
- topics: a list of topics of the conference
- registration_required: a boolean that indicates whether registration is required

If the information available does not allow you to fill this JSON, and only then, answer 'I don't know'.
<|im_end|>
<|im_start|>assistant
"""
    # Union type allows the model to return structured data or "I don't know"
    result = model(prompt, EventResponse, max_new_tokens=200)
    results.append(result)

# Display results
for i, result in enumerate(results):
    print(f"Event {i+1}:")
    if isinstance(result, str):
        print(f"  {result}")
    else:
        # It's an EventInfo object
        print(f"  Name: {result.name}")
        print(f"  Type: {result.event_type}")
        print(f"  Date: {result.date}")
        print(f"  Topics: {', '.join(result.topics)}")
    print()

# Use structured data in downstream processing
structured_count = sum(1 for r in results if isinstance(r, EventInfo))
print(f"Successfully extracted data for {structured_count} of {len(results)} events")
```
</details>

<details id="categorize-documents-into-predefined-types"><summary><b>🗂️ Categorize documents into predefined types</b>
<br>In this case, outlines classifies documents into predefined categories (e.g., “Financial Report,” “Legal Contract”) using a literal type specification. The resulting classifications are displayed in both a table format and through a category distribution summary, illustrating how structured outputs can simplify content management.
</summary>

```python
import outlines
from typing import Literal, List
import pandas as pd
from transformers import AutoTokenizer, AutoModelForCausalLM


MODEL_NAME = "microsoft/Phi-3-mini-4k-instruct"
model = outlines.from_transformers(
    AutoModelForCausalLM.from_pretrained(MODEL_NAME, device_map="auto"),
    AutoTokenizer.from_pretrained(MODEL_NAME)
)


# Define classification categories using Literal
DocumentCategory = Literal[
    "Financial Report",
    "Legal Contract",
    "Technical Documentation",
    "Marketing Material",
    "Personal Correspondence"
]

# Sample documents to classify
documents = [
    "Q3 Financial Summary: Revenue increased by 15% year-over-year to $12.4M. EBITDA margin improved to 23% compared to 19% in Q3 last year. Operating expenses...",

    "This agreement is made between Party A and Party B, hereinafter referred to as 'the Parties', on this day of...",

    "The API accepts POST requests with JSON payloads. Required parameters include 'user_id' and 'transaction_type'. The endpoint returns a 200 status code on success."
]

template = outlines.Template.from_string("""
<|im_start|>user
Classify the following document into exactly one category among the following categories:
- Financial Report
- Legal Contract
- Technical Documentation
- Marketing Material
- Personal Correspondence

Document:
{{ document }}
<|im_end|>
<|im_start|>assistant
""")

# Classify documents
def classify_documents(texts: List[str]) -> List[DocumentCategory]:
    results = []

    for text in texts:
        prompt = template(document=text)
        # The model must return one of the predefined categories
        category = model(prompt, DocumentCategory, max_new_tokens=200)
        results.append(category)

    return results

# Perform classification
classifications = classify_documents(documents)

# Create a simple results table
results_df = pd.DataFrame({
    "Document": [doc[:50] + "..." for doc in documents],
    "Classification": classifications
})

print(results_df)

# Count documents by category
category_counts = pd.Series(classifications).value_counts()
print("\nCategory Distribution:")
print(category_counts)
```
</details>

<details>
<summary id="schedule-a-meeting-with-function-calling"><b>📅 Schedule a meeting from requests with Function Calling</b>
<br>This example demonstrates how outlines can interpret a natural language meeting request and translate it into a structured format matching a predefined function’s parameters. Once the meeting details are extracted (e.g., title, date, duration, attendees), they are used to automatically schedule the meeting.
</summary>

```python
import outlines
import json
from typing import List, Optional
from datetime import date
from transformers import AutoTokenizer, AutoModelForCausalLM


MODEL_NAME = "microsoft/phi-4"
model = outlines.from_transformers(
    AutoModelForCausalLM.from_pretrained(MODEL_NAME, device_map="auto"),
    AutoTokenizer.from_pretrained(MODEL_NAME)
)


# Define a function with typed parameters
def schedule_meeting(
    title: str,
    date: date,
    duration_minutes: int,
    attendees: List[str],
    location: Optional[str] = None,
    agenda_items: Optional[List[str]] = None
):
    """Schedule a meeting with the specified details"""
    # In a real app, this would create the meeting
    meeting = {
        "title": title,
        "date": date,
        "duration_minutes": duration_minutes,
        "attendees": attendees,
        "location": location,
        "agenda_items": agenda_items
    }
    return f"Meeting '{title}' scheduled for {date} with {len(attendees)} attendees"

# Natural language request
user_request = """
I need to set up a product roadmap review with the engineering team for next
Tuesday at 2pm. It should last 90 minutes. Please invite john@example.com,
sarah@example.com, and the product team at product@example.com.
"""

# Outlines automatically infers the required structure from the function signature
prompt = f"""
<|im_start|>user
Extract the meeting details from this request:

{user_request}
<|im_end|>
<|im_start|>assistant
"""
meeting_params = model(prompt, schedule_meeting, max_new_tokens=200)

# The result is a dictionary matching the function parameters
meeting_params = json.loads(meeting_params)
print(meeting_params)

# Call the function with the extracted parameters
result = schedule_meeting(**meeting_params)
print(result)
# "Meeting 'Product Roadmap Review' scheduled for 2023-10-17 with 3 attendees"
```
</details>

<details>
<summary id="dynamically-generate-prompts-with-re-usable-templates"><b>📝 Dynamically generate prompts with re-usable templates</b>
<br>Using Jinja-based templates, this example shows how to generate dynamic prompts for tasks like sentiment analysis. It illustrates how to easily re-use and customize prompts—including few-shot learning strategies—for different content types while ensuring the outputs remain structured.
</summary>

```python
import outlines
from typing import List, Literal
from transformers import AutoTokenizer, AutoModelForCausalLM


MODEL_NAME = "microsoft/phi-4"
model = outlines.from_transformers(
    AutoModelForCausalLM.from_pretrained(MODEL_NAME, device_map="auto"),
    AutoTokenizer.from_pretrained(MODEL_NAME)
)


# 1. Create a reusable template with Jinja syntax
sentiment_template = outlines.Template.from_string("""
<|im_start>user
Analyze the sentiment of the following {{ content_type }}:

{{ text }}

Provide your analysis as either "Positive", "Negative", or "Neutral".
<|im_end>
<|im_start>assistant
""")

# 2. Generate prompts with different parameters
review = "This restaurant exceeded all my expectations. Fantastic service!"
prompt = sentiment_template(content_type="review", text=review)

# 3. Use the templated prompt with structured generation
result = model(prompt, Literal["Positive", "Negative", "Neutral"])
print(result)  # "Positive"

# Templates can also be loaded from files
example_template = outlines.Template.from_file("templates/few_shot.txt")

# Use with examples for few-shot learning
examples = [
    ("The food was cold", "Negative"),
    ("The staff was friendly", "Positive")
]
few_shot_prompt = example_template(examples=examples, query="Service was slow")
print(few_shot_prompt)
```
</details>

## They use outlines

<div align="center">
<img src="./docs/assets/images/readme-light.png#gh-light-mode-only" alt="Users Logo"></img>
<img src="./docs/assets/images/readme-dark.png#gh-dark-mode-only" alt="Users Logo"></img>
</div>

## Model Integrations

| Model type | Description | Documentation |
|---------|-------------|:-------------:|
| **Server Support** | vLLM and Ollama | [Server Integrations →](https://dottxt-ai.github.io/outlines/latest/features/models/) |
| **Local Model Support** | transformers and llama.cpp | [Model Integrations →](https://dottxt-ai.github.io/outlines/latest/features/models/) |
| **API Support** | OpenAI and Gemini | [API Integrations →](https://dottxt-ai.github.io/outlines/latest/features/models/) |

## Core Features

| Feature | Description | Documentation |
|---------|-------------|:-------------:|
| **Multiple Choices** | Constrain outputs to predefined options | [Multiple Choices Guide →](https://dottxt-ai.github.io/outlines/latest/features/core/output_types/#multiple-choices) |
| **Function Calls** | Infer structure from function signatures | [Function Guide →](https://dottxt-ai.github.io/outlines/latest/features/core/output_types/#json-schemas) |
| **JSON/Pydantic** | Generate outputs matching JSON schemas | [JSON Guide →](https://dottxt-ai.github.io/outlines/latest/features/core/output_types/#json-schemas) |
| **Regular Expressions** | Generate text following a regex pattern | [Regex Guide →](https://dottxt-ai.github.io/outlines/latest/features/core/output_types/#regex-patterns) |
| **Grammars** | Enforce complex output structures | [Grammar Guide →](https://dottxt-ai.github.io/outlines/latest/features/core/output_types/#context-free-grammars) |

## Other Features

| Feature | Description | Documentation |
|---------|-------------|:-------------:|
| **Prompt templates** | Separate complex prompts from code | [Template Guide →](https://dottxt-ai.github.io/outlines/latest/features/utility/template/) |
| **Custome types** | Intuitive interface to build complex types | [Python Types Guide →](https://dottxt-ai.github.io/outlines/latest/features/core/output_types/#basic-python-types) |
| **Applications** | Encapsulate templates and types into functions | [Application Guide →](https://dottxt-ai.github.io/outlines/latest/features/utility/application/) |

## About .txt

<div align="center">
<img src="./docs/assets/images/dottxt-light.svg#gh-light-mode-only" alt="dottxt logo" width=100></img>
<img src="./docs/assets/images/dottxt-dark.svg#gh-dark-mode-only" alt="dottxt logo" width=100></img>
</div>

Outlines is developed and maintained by [.txt](https://dottxt.co), a company dedicated to making LLMs more reliable for production applications.

Our focus is on advancing structured generation technology through:

- 🧪 **Cutting-edge Research**: We publish our findings on [structured generation](http://blog.dottxt.co/performance-gsm8k.html)
- 🚀 **Enterprise-grade solutions**: You can license [our enterprise-grade libraries](https://docs.dottxt.co).
- 🧩 **Open Source Collaboration**: We believe in building in public and contributing to the community

Follow us on [Twitter](https://twitter.com/dottxtai) or check out our [blog](https://blog.dottxt.co/) to stay updated on our latest work in making LLMs more reliable.

## Community

<div align="center" style="margin-bottom: 1em;">

[![Contributors][contributors-badge]][contributors]
[![Stars][stars-badge]][stars]
[![Downloads][downloads-badge]][pypistats]
[![Discord badge][discord-badge]][discord]

</div>

- 💡 **Have an idea?** Come chat with us on [Discord][discord]
- 🐞 **Found a bug?** Open an [issue](https://github.com/dottxt-ai/outlines/issues)
- 🧩  **Want to contribute?** Consult our [contribution guide](https://dottxt-ai.github.io/outlines/latest/community/contribute/).


## Cite Outlines

```
@article{willard2023efficient,
  title={Efficient Guided Generation for Large Language Models},
  author={Willard, Brandon T and Louf, R{\'e}mi},
  journal={arXiv preprint arXiv:2307.09702},
  year={2023}
}
```

[contributors]: https://github.com/dottxt-ai/outlines/graphs/contributors
[contributors-badge]: https://img.shields.io/github/contributors/dottxt-ai/outlines?style=flat-square&logo=github&logoColor=white&color=ECEFF4
[dottxt-blog]: https://blog.dottxt.co/
[dottxt-blog-badge]: https://img.shields.io/badge/dottxt%20blog-a6b4a3
[dottxt-twitter]: https://twitter.com/dottxtai
[dottxt-twitter-badge]: https://img.shields.io/twitter/follow/dottxtai?style=social
[discord]: https://discord.gg/R9DSu34mGd
[discord-badge]: https://img.shields.io/discord/1182316225284554793?color=ddb8ca&logo=discord&logoColor=white&style=flat-square
[downloads-badge]: https://img.shields.io/pypi/dm/outlines?color=A6B4A3&logo=python&logoColor=white&style=flat-square
[pypistats]: https://pypistats.org/packages/outlines
[pypi-version-badge]: https://img.shields.io/pypi/v/outlines?style=flat-square&logoColor=white&color=ddb8ca
[pypi]: https://pypi.org/project/outlines/
[stars]: https://github.com/dottxt-ai/outlines/stargazers
[stars-badge]: https://img.shields.io/github/stars/dottxt-ai/outlines?style=flat-square&logo=github&color=BD932F&logoColor=white
[twitter-badge]: https://img.shields.io/twitter/follow/dottxtai?style=flat-square&logo=x&logoColor=white&color=bd932f
[twitter]: https://x.com/dottxtai

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "outlines",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<3.13,>=3.9",
    "maintainer_email": null,
    "keywords": "machine learning, deep learning, language models, structured generation",
    "author": "Outlines Developers",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/30/35/bcc61dc6f958e1064c34049a70d38ec7bbac881ae6d71401de50720e8545/outlines-1.1.0.tar.gz",
    "platform": null,
    "description": "<div align=\"center\" style=\"margin-bottom: 1em;\">\n\n<img src=\"./docs/assets/images/logo-light-mode.svg#gh-light-mode-only\" alt=\"Outlines Logo\" width=300></img>\n<img src=\"./docs/assets/images/logo-dark-mode.svg#gh-dark-mode-only\" alt=\"Outlines Logo\" width=300></img>\n\n\n \ud83d\uddd2\ufe0f *Structured outputs for LLMs* \ud83d\uddd2\ufe0f\n\nMade with \u2764\ud83d\udc77\ufe0f by the team at [.txt](https://dottxt.co)\n<br>Trusted by NVIDIA, Cohere, HuggingFace, vLLM, etc.\n\n<!-- Project Badges -->\n[![PyPI Version][pypi-version-badge]][pypi]\n[![Downloads][downloads-badge]][pypistats]\n[![Stars][stars-badge]][stars]\n\n<!-- Community Badges -->\n[![Discord][discord-badge]][discord]\n[![Blog][dottxt-blog-badge]][dottxt-blog]\n[![Twitter][twitter-badge]][twitter]\n\n</div>\n\nNeed a high-performance commercial solution for structured outputs? Email us at [contact@dottxt.co](mailto:contact@dottxt.co), or [schedule a call](https://cal.com/team/dottxt/sales).\n\n## Table of Contents\n\n- [Why Outlines?](#why-outlines)\n- [Quickstart](#quickstart)\n- [Real-World Examples](#real-world-examples)\n  - [\ud83d\ude4b\u200d\u2642\ufe0f Customer Support Triage](#customer-support-triage)\n  - [\ud83d\udce6 E-commerce Product Categorization](#e-commerce-product-categorization)\n  - [\ud83d\udcca Parse Event Details with Incomplete Data](#parse-event-details-with-incomplete-data)\n  - [\ud83d\uddc2\ufe0f Categorize Documents into Predefined Types](#categorize-documents-into-predefined-types)\n  - [\ud83d\udcc5 Schedule a Meeting with Function Calling](#schedule-a-meeting-with-function-calling)\n  - [\ud83d\udcdd Dynamically Generate Prompts with Re-usable Templates](#dynamically-generate-prompts-with-re-usable-templates)\n- [They Use Outlines](#they-use-outlines)\n- [Model Integrations](#model-integrations)\n- [Core Features](#core-features)\n- [Other Features](#other-features)\n- [About .txt](#about-txt)\n- [Community](#community)\n\n<div align=\"center\"><img src=\"./docs/assets/images/install.png\" width=300></img></div>\n\n## Why Outlines?\n\nLLMs are powerful but their outputs are unpredictable. Most solutions attempt to fix bad outputs after generation using parsing, regex, or fragile code that breaks easily.\n\nOutlines guarantees structured outputs during generation \u2014 directly from any LLM.\n\n- **Works with any model** - Same code runs across OpenAI, Ollama, vLLM, and more\n- **Simple integration** - Just pass your desired output type: `model(prompt, output_type)`\n- **Guaranteed valid structure** - No more parsing headaches or broken JSON\n- **Provider independence** - Switch models without changing code\n\n\n### The Outlines Philosophy\n\n<div align=\"center\"><img src=\"./docs/assets/images/use_philosophy.png\" width=300></img></div>\n\nOutlines follows a simple pattern that mirrors Python's own type system. Simply specify the desired output type, and Outlines will ensure your data matches that structure exactly:\n\n- For a yes/no response, use `Literal[\"Yes\", \"No\"]`\n- For numerical values, use `int`\n- For complex objects, define a structure with a [Pydantic model](https://docs.pydantic.dev/latest/)\n\n## Quickstart\n\nGetting started with outlines is simple:\n\n### 1. Install outlines\n\n``` shell\npip install outlines\n```\n\n### 2. Connect to your preferred model\n\n``` python\nimport outlines\nfrom transformers import AutoTokenizer, AutoModelForCausalLM\n\n\nMODEL_NAME = \"microsoft/Phi-3-mini-4k-instruct\"\nmodel = outlines.from_transformers(\n    AutoModelForCausalLM.from_pretrained(MODEL_NAME, device_map=\"auto\"),\n    AutoTokenizer.from_pretrained(MODEL_NAME)\n)\n```\n\n### 3. Start with simple structured outputs\n\n``` python\nfrom typing import Literal\nfrom pydantic import BaseModel\n\n\n# Simple classification\nsentiment = model(\n    \"Analyze: 'This product completely changed my life!'\",\n    Literal[\"Positive\", \"Negative\", \"Neutral\"]\n)\nprint(sentiment)  # \"Positive\"\n\n# Extract specific types\ntemperature = model(\"What's the boiling point of water in Celsius?\", int)\nprint(temperature)  # 100\n```\n\n### 4. Create complex structures\n\n``` python\nfrom pydantic import BaseModel\nfrom enum import Enum\n\nclass Rating(Enum):\n    poor = 1\n    fair = 2\n    good = 3\n    excellent = 4\n\nclass ProductReview(BaseModel):\n    rating: Rating\n    pros: list[str]\n    cons: list[str]\n    summary: str\n\nreview = model(\n    \"Review: The XPS 13 has great battery life and a stunning display, but it runs hot and the webcam is poor quality.\",\n    ProductReview,\n    max_new_tokens=200,\n)\n\nreview = ProductReview.model_validate_json(review)\nprint(f\"Rating: {review.rating.name}\")  # \"Rating: good\"\nprint(f\"Pros: {review.pros}\")           # \"Pros: ['great battery life', 'stunning display']\"\nprint(f\"Summary: {review.summary}\")     # \"Summary: Good laptop with great display but thermal issues\"\n```\n\n## Real-world examples\n\nHere are production-ready examples showing how Outlines solves common problems:\n\n<details id=\"customer-support-triage\"><summary><b>\ud83d\ude4b\u200d\u2642\ufe0f Customer Support Triage</b>\n<br>This example shows how to convert a free-form customer email into a structured service ticket. By parsing attributes like priority, category, and escalation flags, the code enables automated routing and handling of support issues.\n</summary>\n\n``` python\nimport outlines\nfrom enum import Enum\nfrom pydantic import BaseModel\nfrom transformers import AutoTokenizer, AutoModelForCausalLM\nfrom typing import List\n\n\nMODEL_NAME = \"microsoft/Phi-3-mini-4k-instruct\"\nmodel = outlines.from_transformers(\n    AutoModelForCausalLM.from_pretrained(MODEL_NAME, device_map=\"auto\"),\n    AutoTokenizer.from_pretrained(MODEL_NAME)\n)\n\n\ndef alert_manager(ticket):\n    print(\"Alert!\", ticket)\n\n\nclass TicketPriority(str, Enum):\n    low = \"low\"\n    medium = \"medium\"\n    high = \"high\"\n    urgent = \"urgent\"\n\nclass ServiceTicket(BaseModel):\n    priority: TicketPriority\n    category: str\n    requires_manager: bool\n    summary: str\n    action_items: List[str]\n\n\ncustomer_email = \"\"\"\nSubject: URGENT - Cannot access my account after payment\n\nI paid for the premium plan 3 hours ago and still can't access any features.\nI've tried logging out and back in multiple times. This is unacceptable as I\nhave a client presentation in an hour and need the analytics dashboard.\nPlease fix this immediately or refund my payment.\n\"\"\"\n\nprompt = f\"\"\"\n<|im_start|>user\nAnalyze this customer email:\n\n{customer_email}\n<|im_end|>\n<|im_start|>assistant\n\"\"\"\n\nticket = model(\n    prompt,\n    ServiceTicket,\n    max_new_tokens=500\n)\n\n# Use structured data to route the ticket\nticket = ServiceTicket.model_validate_json(ticket)\nif ticket.priority == \"urgent\" or ticket.requires_manager:\n    alert_manager(ticket)\n```\n</details>\n\n<details id=\"e-commerce-product-categorization\"><summary><b>\ud83d\udce6 E-commerce product categorization</b>\n<br>This use case demonstrates how outlines can transform product descriptions into structured categorization data (e.g., main category, sub-category, and attributes) to streamline tasks such as inventory management. Each product description is processed automatically, reducing manual categorization overhead.\n</summary>\n\n```python\nimport outlines\nfrom pydantic import BaseModel\nfrom transformers import AutoTokenizer, AutoModelForCausalLM\nfrom typing import List, Optional\n\n\nMODEL_NAME = \"microsoft/Phi-3-mini-4k-instruct\"\nmodel = outlines.from_transformers(\n    AutoModelForCausalLM.from_pretrained(MODEL_NAME, device_map=\"auto\"),\n    AutoTokenizer.from_pretrained(MODEL_NAME)\n)\n\n\ndef update_inventory(product, category, sub_category):\n    print(f\"Updated {product.split(',')[0]} in category {category}/{sub_category}\")\n\n\nclass ProductCategory(BaseModel):\n    main_category: str\n    sub_category: str\n    attributes: List[str]\n    brand_match: Optional[str]\n\n# Process product descriptions in batches\nproduct_descriptions = [\n    \"Apple iPhone 15 Pro Max 256GB Titanium, 6.7-inch Super Retina XDR display with ProMotion\",\n    \"Organic Cotton T-Shirt, Men's Medium, Navy Blue, 100% Sustainable Materials\",\n    \"KitchenAid Stand Mixer, 5 Quart, Red, 10-Speed Settings with Dough Hook Attachment\"\n]\n\ntemplate = outlines.Template.from_string(\"\"\"\n<|im_start|>user\nCategorize this product:\n\n{{ description }}\n<|im_end|>\n<|im_start|>assistant\n\"\"\")\n\n# Get structured categorization for all products\ncategories = model(\n    [template(description=desc) for desc in product_descriptions],\n    ProductCategory,\n    max_new_tokens=200\n)\n\n# Use categorization for inventory management\ncategories = [\n    ProductCategory.model_validate_json(category) for category in categories\n]\nfor product, category in zip(product_descriptions, categories):\n    update_inventory(product, category.main_category, category.sub_category)\n```\n</details>\n\n<details id=\"parse-event-details-with-incomplete-data\"><summary><b>\ud83d\udcca Parse event details with incomplete data</b>\n<br>This example uses outlines to parse event descriptions into structured information (like event name, date, location, type, and topics), even handling cases where the data is incomplete. It leverages union types to return either structured event data or a fallback \u201cI don\u2019t know\u201d answer, ensuring robust extraction in varying scenarios.\n</summary>\n\n```python\nimport outlines\nfrom typing import Union, List, Literal\nfrom pydantic import BaseModel\nfrom enum import Enum\nfrom transformers import AutoTokenizer, AutoModelForCausalLM\n\n\nMODEL_NAME = \"microsoft/Phi-3-mini-4k-instruct\"\nmodel = outlines.from_transformers(\n    AutoModelForCausalLM.from_pretrained(MODEL_NAME, device_map=\"auto\"),\n    AutoTokenizer.from_pretrained(MODEL_NAME)\n)\n\nclass EventType(str, Enum):\n    conference = \"conference\"\n    webinar = \"webinar\"\n    workshop = \"workshop\"\n    meetup = \"meetup\"\n    other = \"other\"\n\n\nclass EventInfo(BaseModel):\n    \"\"\"Structured information about a tech event\"\"\"\n    name: str\n    date: str\n    location: str\n    event_type: EventType\n    topics: List[str]\n    registration_required: bool\n\n# Create a union type that can either be a structured EventInfo or \"I don't know\"\nEventResponse = Union[EventInfo, Literal[\"I don't know\"]]\n\n# Sample event descriptions\nevent_descriptions = [\n    # Complete information\n    \"\"\"\n    Join us for DevCon 2023, the premier developer conference happening on November 15-17, 2023\n    at the San Francisco Convention Center. Topics include AI/ML, cloud infrastructure, and web3.\n    Registration is required.\n    \"\"\",\n\n    # Insufficient information\n    \"\"\"\n    Tech event next week. More details coming soon!\n    \"\"\"\n]\n\n# Process events\nresults = []\nfor description in event_descriptions:\n    prompt = f\"\"\"\n<|im_start>system\nYou are a helpful assistant\n<|im_end|>\n<|im_start>user\nExtract structured information about this tech event:\n\n{description}\n\nIf there is enough information, return a JSON object with the following fields:\n\n- name: The name of the event\n- date: The date where the event is taking place\n- location: Where the event is taking place\n- event_type: either 'conference', 'webinar', 'workshop', 'meetup' or 'other'\n- topics: a list of topics of the conference\n- registration_required: a boolean that indicates whether registration is required\n\nIf the information available does not allow you to fill this JSON, and only then, answer 'I don't know'.\n<|im_end|>\n<|im_start|>assistant\n\"\"\"\n    # Union type allows the model to return structured data or \"I don't know\"\n    result = model(prompt, EventResponse, max_new_tokens=200)\n    results.append(result)\n\n# Display results\nfor i, result in enumerate(results):\n    print(f\"Event {i+1}:\")\n    if isinstance(result, str):\n        print(f\"  {result}\")\n    else:\n        # It's an EventInfo object\n        print(f\"  Name: {result.name}\")\n        print(f\"  Type: {result.event_type}\")\n        print(f\"  Date: {result.date}\")\n        print(f\"  Topics: {', '.join(result.topics)}\")\n    print()\n\n# Use structured data in downstream processing\nstructured_count = sum(1 for r in results if isinstance(r, EventInfo))\nprint(f\"Successfully extracted data for {structured_count} of {len(results)} events\")\n```\n</details>\n\n<details id=\"categorize-documents-into-predefined-types\"><summary><b>\ud83d\uddc2\ufe0f Categorize documents into predefined types</b>\n<br>In this case, outlines classifies documents into predefined categories (e.g., \u201cFinancial Report,\u201d \u201cLegal Contract\u201d) using a literal type specification. The resulting classifications are displayed in both a table format and through a category distribution summary, illustrating how structured outputs can simplify content management.\n</summary>\n\n```python\nimport outlines\nfrom typing import Literal, List\nimport pandas as pd\nfrom transformers import AutoTokenizer, AutoModelForCausalLM\n\n\nMODEL_NAME = \"microsoft/Phi-3-mini-4k-instruct\"\nmodel = outlines.from_transformers(\n    AutoModelForCausalLM.from_pretrained(MODEL_NAME, device_map=\"auto\"),\n    AutoTokenizer.from_pretrained(MODEL_NAME)\n)\n\n\n# Define classification categories using Literal\nDocumentCategory = Literal[\n    \"Financial Report\",\n    \"Legal Contract\",\n    \"Technical Documentation\",\n    \"Marketing Material\",\n    \"Personal Correspondence\"\n]\n\n# Sample documents to classify\ndocuments = [\n    \"Q3 Financial Summary: Revenue increased by 15% year-over-year to $12.4M. EBITDA margin improved to 23% compared to 19% in Q3 last year. Operating expenses...\",\n\n    \"This agreement is made between Party A and Party B, hereinafter referred to as 'the Parties', on this day of...\",\n\n    \"The API accepts POST requests with JSON payloads. Required parameters include 'user_id' and 'transaction_type'. The endpoint returns a 200 status code on success.\"\n]\n\ntemplate = outlines.Template.from_string(\"\"\"\n<|im_start|>user\nClassify the following document into exactly one category among the following categories:\n- Financial Report\n- Legal Contract\n- Technical Documentation\n- Marketing Material\n- Personal Correspondence\n\nDocument:\n{{ document }}\n<|im_end|>\n<|im_start|>assistant\n\"\"\")\n\n# Classify documents\ndef classify_documents(texts: List[str]) -> List[DocumentCategory]:\n    results = []\n\n    for text in texts:\n        prompt = template(document=text)\n        # The model must return one of the predefined categories\n        category = model(prompt, DocumentCategory, max_new_tokens=200)\n        results.append(category)\n\n    return results\n\n# Perform classification\nclassifications = classify_documents(documents)\n\n# Create a simple results table\nresults_df = pd.DataFrame({\n    \"Document\": [doc[:50] + \"...\" for doc in documents],\n    \"Classification\": classifications\n})\n\nprint(results_df)\n\n# Count documents by category\ncategory_counts = pd.Series(classifications).value_counts()\nprint(\"\\nCategory Distribution:\")\nprint(category_counts)\n```\n</details>\n\n<details>\n<summary id=\"schedule-a-meeting-with-function-calling\"><b>\ud83d\udcc5 Schedule a meeting from requests with Function Calling</b>\n<br>This example demonstrates how outlines can interpret a natural language meeting request and translate it into a structured format matching a predefined function\u2019s parameters. Once the meeting details are extracted (e.g., title, date, duration, attendees), they are used to automatically schedule the meeting.\n</summary>\n\n```python\nimport outlines\nimport json\nfrom typing import List, Optional\nfrom datetime import date\nfrom transformers import AutoTokenizer, AutoModelForCausalLM\n\n\nMODEL_NAME = \"microsoft/phi-4\"\nmodel = outlines.from_transformers(\n    AutoModelForCausalLM.from_pretrained(MODEL_NAME, device_map=\"auto\"),\n    AutoTokenizer.from_pretrained(MODEL_NAME)\n)\n\n\n# Define a function with typed parameters\ndef schedule_meeting(\n    title: str,\n    date: date,\n    duration_minutes: int,\n    attendees: List[str],\n    location: Optional[str] = None,\n    agenda_items: Optional[List[str]] = None\n):\n    \"\"\"Schedule a meeting with the specified details\"\"\"\n    # In a real app, this would create the meeting\n    meeting = {\n        \"title\": title,\n        \"date\": date,\n        \"duration_minutes\": duration_minutes,\n        \"attendees\": attendees,\n        \"location\": location,\n        \"agenda_items\": agenda_items\n    }\n    return f\"Meeting '{title}' scheduled for {date} with {len(attendees)} attendees\"\n\n# Natural language request\nuser_request = \"\"\"\nI need to set up a product roadmap review with the engineering team for next\nTuesday at 2pm. It should last 90 minutes. Please invite john@example.com,\nsarah@example.com, and the product team at product@example.com.\n\"\"\"\n\n# Outlines automatically infers the required structure from the function signature\nprompt = f\"\"\"\n<|im_start|>user\nExtract the meeting details from this request:\n\n{user_request}\n<|im_end|>\n<|im_start|>assistant\n\"\"\"\nmeeting_params = model(prompt, schedule_meeting, max_new_tokens=200)\n\n# The result is a dictionary matching the function parameters\nmeeting_params = json.loads(meeting_params)\nprint(meeting_params)\n\n# Call the function with the extracted parameters\nresult = schedule_meeting(**meeting_params)\nprint(result)\n# \"Meeting 'Product Roadmap Review' scheduled for 2023-10-17 with 3 attendees\"\n```\n</details>\n\n<details>\n<summary id=\"dynamically-generate-prompts-with-re-usable-templates\"><b>\ud83d\udcdd Dynamically generate prompts with re-usable templates</b>\n<br>Using Jinja-based templates, this example shows how to generate dynamic prompts for tasks like sentiment analysis. It illustrates how to easily re-use and customize prompts\u2014including few-shot learning strategies\u2014for different content types while ensuring the outputs remain structured.\n</summary>\n\n```python\nimport outlines\nfrom typing import List, Literal\nfrom transformers import AutoTokenizer, AutoModelForCausalLM\n\n\nMODEL_NAME = \"microsoft/phi-4\"\nmodel = outlines.from_transformers(\n    AutoModelForCausalLM.from_pretrained(MODEL_NAME, device_map=\"auto\"),\n    AutoTokenizer.from_pretrained(MODEL_NAME)\n)\n\n\n# 1. Create a reusable template with Jinja syntax\nsentiment_template = outlines.Template.from_string(\"\"\"\n<|im_start>user\nAnalyze the sentiment of the following {{ content_type }}:\n\n{{ text }}\n\nProvide your analysis as either \"Positive\", \"Negative\", or \"Neutral\".\n<|im_end>\n<|im_start>assistant\n\"\"\")\n\n# 2. Generate prompts with different parameters\nreview = \"This restaurant exceeded all my expectations. Fantastic service!\"\nprompt = sentiment_template(content_type=\"review\", text=review)\n\n# 3. Use the templated prompt with structured generation\nresult = model(prompt, Literal[\"Positive\", \"Negative\", \"Neutral\"])\nprint(result)  # \"Positive\"\n\n# Templates can also be loaded from files\nexample_template = outlines.Template.from_file(\"templates/few_shot.txt\")\n\n# Use with examples for few-shot learning\nexamples = [\n    (\"The food was cold\", \"Negative\"),\n    (\"The staff was friendly\", \"Positive\")\n]\nfew_shot_prompt = example_template(examples=examples, query=\"Service was slow\")\nprint(few_shot_prompt)\n```\n</details>\n\n## They use outlines\n\n<div align=\"center\">\n<img src=\"./docs/assets/images/readme-light.png#gh-light-mode-only\" alt=\"Users Logo\"></img>\n<img src=\"./docs/assets/images/readme-dark.png#gh-dark-mode-only\" alt=\"Users Logo\"></img>\n</div>\n\n## Model Integrations\n\n| Model type | Description | Documentation |\n|---------|-------------|:-------------:|\n| **Server Support** | vLLM and Ollama | [Server Integrations \u2192](https://dottxt-ai.github.io/outlines/latest/features/models/) |\n| **Local Model Support** | transformers and llama.cpp | [Model Integrations \u2192](https://dottxt-ai.github.io/outlines/latest/features/models/) |\n| **API Support** | OpenAI and Gemini | [API Integrations \u2192](https://dottxt-ai.github.io/outlines/latest/features/models/) |\n\n## Core Features\n\n| Feature | Description | Documentation |\n|---------|-------------|:-------------:|\n| **Multiple Choices** | Constrain outputs to predefined options | [Multiple Choices Guide \u2192](https://dottxt-ai.github.io/outlines/latest/features/core/output_types/#multiple-choices) |\n| **Function Calls** | Infer structure from function signatures | [Function Guide \u2192](https://dottxt-ai.github.io/outlines/latest/features/core/output_types/#json-schemas) |\n| **JSON/Pydantic** | Generate outputs matching JSON schemas | [JSON Guide \u2192](https://dottxt-ai.github.io/outlines/latest/features/core/output_types/#json-schemas) |\n| **Regular Expressions** | Generate text following a regex pattern | [Regex Guide \u2192](https://dottxt-ai.github.io/outlines/latest/features/core/output_types/#regex-patterns) |\n| **Grammars** | Enforce complex output structures | [Grammar Guide \u2192](https://dottxt-ai.github.io/outlines/latest/features/core/output_types/#context-free-grammars) |\n\n## Other Features\n\n| Feature | Description | Documentation |\n|---------|-------------|:-------------:|\n| **Prompt templates** | Separate complex prompts from code | [Template Guide \u2192](https://dottxt-ai.github.io/outlines/latest/features/utility/template/) |\n| **Custome types** | Intuitive interface to build complex types | [Python Types Guide \u2192](https://dottxt-ai.github.io/outlines/latest/features/core/output_types/#basic-python-types) |\n| **Applications** | Encapsulate templates and types into functions | [Application Guide \u2192](https://dottxt-ai.github.io/outlines/latest/features/utility/application/) |\n\n## About .txt\n\n<div align=\"center\">\n<img src=\"./docs/assets/images/dottxt-light.svg#gh-light-mode-only\" alt=\"dottxt logo\" width=100></img>\n<img src=\"./docs/assets/images/dottxt-dark.svg#gh-dark-mode-only\" alt=\"dottxt logo\" width=100></img>\n</div>\n\nOutlines is developed and maintained by [.txt](https://dottxt.co), a company dedicated to making LLMs more reliable for production applications.\n\nOur focus is on advancing structured generation technology through:\n\n- \ud83e\uddea **Cutting-edge Research**: We publish our findings on [structured generation](http://blog.dottxt.co/performance-gsm8k.html)\n- \ud83d\ude80 **Enterprise-grade solutions**: You can license [our enterprise-grade libraries](https://docs.dottxt.co).\n- \ud83e\udde9 **Open Source Collaboration**: We believe in building in public and contributing to the community\n\nFollow us on [Twitter](https://twitter.com/dottxtai) or check out our [blog](https://blog.dottxt.co/) to stay updated on our latest work in making LLMs more reliable.\n\n## Community\n\n<div align=\"center\" style=\"margin-bottom: 1em;\">\n\n[![Contributors][contributors-badge]][contributors]\n[![Stars][stars-badge]][stars]\n[![Downloads][downloads-badge]][pypistats]\n[![Discord badge][discord-badge]][discord]\n\n</div>\n\n- \ud83d\udca1 **Have an idea?** Come chat with us on [Discord][discord]\n- \ud83d\udc1e **Found a bug?** Open an [issue](https://github.com/dottxt-ai/outlines/issues)\n- \ud83e\udde9  **Want to contribute?** Consult our [contribution guide](https://dottxt-ai.github.io/outlines/latest/community/contribute/).\n\n\n## Cite Outlines\n\n```\n@article{willard2023efficient,\n  title={Efficient Guided Generation for Large Language Models},\n  author={Willard, Brandon T and Louf, R{\\'e}mi},\n  journal={arXiv preprint arXiv:2307.09702},\n  year={2023}\n}\n```\n\n[contributors]: https://github.com/dottxt-ai/outlines/graphs/contributors\n[contributors-badge]: https://img.shields.io/github/contributors/dottxt-ai/outlines?style=flat-square&logo=github&logoColor=white&color=ECEFF4\n[dottxt-blog]: https://blog.dottxt.co/\n[dottxt-blog-badge]: https://img.shields.io/badge/dottxt%20blog-a6b4a3\n[dottxt-twitter]: https://twitter.com/dottxtai\n[dottxt-twitter-badge]: https://img.shields.io/twitter/follow/dottxtai?style=social\n[discord]: https://discord.gg/R9DSu34mGd\n[discord-badge]: https://img.shields.io/discord/1182316225284554793?color=ddb8ca&logo=discord&logoColor=white&style=flat-square\n[downloads-badge]: https://img.shields.io/pypi/dm/outlines?color=A6B4A3&logo=python&logoColor=white&style=flat-square\n[pypistats]: https://pypistats.org/packages/outlines\n[pypi-version-badge]: https://img.shields.io/pypi/v/outlines?style=flat-square&logoColor=white&color=ddb8ca\n[pypi]: https://pypi.org/project/outlines/\n[stars]: https://github.com/dottxt-ai/outlines/stargazers\n[stars-badge]: https://img.shields.io/github/stars/dottxt-ai/outlines?style=flat-square&logo=github&color=BD932F&logoColor=white\n[twitter-badge]: https://img.shields.io/twitter/follow/dottxtai?style=flat-square&logo=x&logoColor=white&color=bd932f\n[twitter]: https://x.com/dottxtai\n",
    "bugtrack_url": null,
    "license": "Apache-2.0",
    "summary": "Probabilistic Generative Model Programming",
    "version": "1.1.0",
    "project_urls": {
        "documentation": "https://dottxt-ai.github.io/outlines/",
        "homepage": "https://github.com/dottxt-ai/outlines",
        "repository": "https://github.com/dottxt-ai/outlines"
    },
    "split_keywords": [
        "machine learning",
        " deep learning",
        " language models",
        " structured generation"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "9463a1c2d113a3e8b8825cd6957235f7f2e85994e190ddb7f63f1a084204f539",
                "md5": "f528ddfc5e8eaae94e4abb4253d56c40",
                "sha256": "df9252abef2e2ff511d200a78be0e1cc950b10a2896ef40a2cca4617e73b8220"
            },
            "downloads": -1,
            "filename": "outlines-1.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "f528ddfc5e8eaae94e4abb4253d56c40",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<3.13,>=3.9",
            "size": 100313,
            "upload_time": "2025-07-10T18:27:31",
            "upload_time_iso_8601": "2025-07-10T18:27:31.311020Z",
            "url": "https://files.pythonhosted.org/packages/94/63/a1c2d113a3e8b8825cd6957235f7f2e85994e190ddb7f63f1a084204f539/outlines-1.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "3035bcc61dc6f958e1064c34049a70d38ec7bbac881ae6d71401de50720e8545",
                "md5": "5d573d3d4cb1f8fb66ab7e9eaebc1a73",
                "sha256": "f5c0d4abd754e0b2b9b17871f8b33353e1590d3c047c240d8dce4d8d053d1baf"
            },
            "downloads": -1,
            "filename": "outlines-1.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "5d573d3d4cb1f8fb66ab7e9eaebc1a73",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<3.13,>=3.9",
            "size": 2822269,
            "upload_time": "2025-07-10T18:27:32",
            "upload_time_iso_8601": "2025-07-10T18:27:32.888706Z",
            "url": "https://files.pythonhosted.org/packages/30/35/bcc61dc6f958e1064c34049a70d38ec7bbac881ae6d71401de50720e8545/outlines-1.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-07-10 18:27:32",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "dottxt-ai",
    "github_project": "outlines",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "outlines"
}
        
Elapsed time: 0.79711s