freshcrate
Skin:/

outlines

Structured Outputs

Why this rank:Strong adoptionRecent releaseHealthy release cadence

Description

Structured Outputs

README

Outlines Logo Outlines Logo

๐Ÿ—’๏ธ Structured outputs for LLMs ๐Ÿ—’๏ธ

Made with โค๐Ÿ‘ท๏ธ by the team at .txt
Trusted by NVIDIA, Cohere, HuggingFace, vLLM, etc.

PyPI VersionDownloadsStarsDiscordBlog Twitter
The .txt API is currently in early access.
Request access here โ†’

๐Ÿš€ Building the future of structured generation

We're working with select partners to develop new interfaces to structured generation.

Need XML, FHIR, custom schemas or grammars? Let's talk.

Audit your schema: share one schema, we show you what breaks under generation, the constraints that fix it, and compliance rates before and after. Sign up here.

Table of Contents

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

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

Quickstart

Getting started with outlines is simple:

1. Install outlines

pip install outlines

2. Connect to your preferred model

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

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

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:

๐Ÿ™‹โ€โ™‚๏ธ Customer Support Triage
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.
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)
๐Ÿ“ฆ E-commerce product categorization
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.
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)
๐Ÿ“Š Parse event details with incomplete data
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.
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")
๐Ÿ—‚๏ธ Categorize documents into predefined types
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.
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)
๐Ÿ“… Schedule a meeting from requests with Function Calling
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.
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"
๐Ÿ“ Dynamically generate prompts with re-usable templates
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.
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)

They use outlines

Users Logo Users Logo

Model Integrations

Model type Description Documentation
Server Support vLLM and Ollama Server Integrations โ†’
Local Model Support transformers and llama.cpp Model Integrations โ†’
API Support OpenAI, Gemini, and Dottxt API Integrations โ†’

Core Features

Feature Description Documentation
Multiple Choices Constrain outputs to predefined options Multiple Choices Guide โ†’
Function Calls Infer structure from function signatures Function Guide โ†’
JSON/Pydantic Generate outputs matching JSON schemas JSON Guide โ†’
Regular Expressions Generate text following a regex pattern Regex Guide โ†’
Grammars Enforce complex output structures Grammar Guide โ†’

Other Features

Feature Description Documentation
Prompt templates Separate complex prompts from code Template Guide โ†’
Custome types Intuitive interface to build complex types Python Types Guide โ†’
Applications Encapsulate templates and types into functions Application Guide โ†’

About .txt

dottxt logo dottxt logo

Outlines is developed and maintained by .txt, 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
  • ๐Ÿš€ Enterprise-grade solutions: You can license our enterprise-grade libraries.
  • ๐Ÿงฉ Open Source Collaboration: We believe in building in public and contributing to the community

Follow us on Twitter or check out our blog to stay updated on our latest work in making LLMs more reliable.

Community

ContributorsStarsDownloadsDiscord badge

  • ๐Ÿ’ก Have an idea? Come chat with us on Discord
  • ๐Ÿž Found a bug? Open an issue
  • ๐Ÿงฉ Want to contribute? Consult our contribution guide.
  • 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}
    }
    

    Release History

    VersionChangesUrgencyDate
    1.3.0## What's Changed * Fix error message for model type determination by @Reslan-Tinawi in https://github.com/dottxt-ai/outlines/pull/1862 * Implement uniform exceptions classes across model providers by @plpxsk in https://github.com/dottxt-ai/outlines/pull/1823 ## New Contributors * @Reslan-Tinawi made their first contribution in https://github.com/dottxt-ai/outlines/pull/1862 * @plpxsk made their first contribution in https://github.com/dottxt-ai/outlines/pull/1823 **Full Changelog**: hHigh5/13/2026
    1.2.13## What's Changed * Fix XDG_CACHE_HOME double .cache in path construction by @jnMetaCode in https://github.com/dottxt-ai/outlines/pull/1828 * fix(llamacpp): correct EOS attention mask and vocab truncation bugs by @giulio-leone in https://github.com/dottxt-ai/outlines/pull/1820 * fix(dsl): add JSON double-quotes to string literals inside container types by @giulio-leone in https://github.com/dottxt-ai/outlines/pull/1821 * fix: accumulate duplicate token IDs in vocabulary construction by @RoloHigh5/4/2026
    1.2.12## What's Changed * Add a link to the audit form in the README and the doc website by @RobinPicard in https://github.com/dottxt-ai/outlines/pull/1822 **Full Changelog**: https://github.com/dottxt-ai/outlines/compare/1.2.11...1.2.12Low3/3/2026
    1.2.11## What's Changed * Add documentation preview when opening a PR by @RobinPicard in https://github.com/dottxt-ai/outlines/pull/1818 **Full Changelog**: https://github.com/dottxt-ai/outlines/compare/1.2.10...1.2.11Low2/13/2026
    1.2.10## What's Changed * Correct mlx-lm example unpacking operator by @Anri-Lombard in https://github.com/dottxt-ai/outlines/pull/1786 * Remove todos by @Anri-Lombard in https://github.com/dottxt-ai/outlines/pull/1788 * fix: correct chat format usage by @Ki-Seki in https://github.com/dottxt-ai/outlines/pull/1790 * Add AsyncOllama to __all__ exports by @Anri-Lombard in https://github.com/dottxt-ai/outlines/pull/1791 * fix: Best-effort use of chat completion by @Ki-Seki in https://github.com/dottxLow2/6/2026
    1.2.9## What's Changed * fix: Refactor sampling parameters in VLLMOffline to use StructuredOutputsParams by @Ki-Seki in https://github.com/dottxt-ai/outlines/pull/1779 * docs: clarify use of `SamplingParams` in model response examples by @Ki-Seki in https://github.com/dottxt-ai/outlines/pull/1777 * Update the uv.lock by @RobinPicard in https://github.com/dottxt-ai/outlines/pull/1783 ## New Contributors * @Ki-Seki made their first contribution in https://github.com/dottxt-ai/outlines/pull/1779 Low11/24/2025
    1.2.8## What's Changed * Use uv sync in the CI instead of pip install by @RobinPicard in https://github.com/dottxt-ai/outlines/pull/1767 * Fix error in the batch method of the MLXLM model by @RobinPicard in https://github.com/dottxt-ai/outlines/pull/1772 **Full Changelog**: https://github.com/dottxt-ai/outlines/compare/1.2.7...1.2.8Low10/27/2025
    1.2.7## What's Changed * Add the device_dtype init parameter to the transformers model by @RobinPicard in https://github.com/dottxt-ai/outlines/pull/1762 **Full Changelog**: https://github.com/dottxt-ai/outlines/compare/1.2.6...1.2.7Low10/14/2025
    1.2.6## What's Changed * Fix correct handling of chat multimodal inputs in TransformersMM class by @laitifranz in https://github.com/dottxt-ai/outlines/pull/1728 * Add batch generation to the MLXLM model by @RobinPicard in https://github.com/dottxt-ai/outlines/pull/1759 * Feature/mistral ai integration by @yasteven in https://github.com/dottxt-ai/outlines/pull/1755 * Add json type conversion by @RobinPicard in https://github.com/dottxt-ai/outlines/pull/1761 * Fix installation instructions by @RoLow10/14/2025
    1.2.5## What's Changed * Update the output_type formatting of the llamacpp model by @RobinPicard in https://github.com/dottxt-ai/outlines/pull/1753 **Full Changelog**: https://github.com/dottxt-ai/outlines/compare/1.2.4...1.2.5Low9/15/2025
    1.2.4## What's Changed * Fix a bug in OutlinesCore backend about advancing when in final state by @RobinPicard in https://github.com/dottxt-ai/outlines/pull/1727 * Jax/tensorflow deprecation by @RobinPicard in https://github.com/dottxt-ai/outlines/pull/1726 * Update workflow to test API models, use manual trigger by @RobinPicard in https://github.com/dottxt-ai/outlines/pull/1734 * fix typings by resolving exports by @the-vampiire in https://github.com/dottxt-ai/outlines/pull/1731 * Remove redundLow9/2/2025
    1.2.3## What's Changed * Create AsyncOpenAI model by @RobinPicard in https://github.com/dottxt-ai/outlines/pull/1721 **Full Changelog**: https://github.com/dottxt-ai/outlines/compare/1.2.2...1.2.3Low8/11/2025
    1.2.2## What's Changed * Fix a bug in the `outlines_core` backend for the `Transformers` model about the token to string conversion by @RobinPicard in https://github.com/dottxt-ai/outlines/pull/1716 * Fix a bug regarding the `eos_token` in the `LlamaCpp` tokenizer by @RobinPicard in https://github.com/dottxt-ai/outlines/pull/1712 * Fix a bug related to the device of the bitmasks for torch tensors by @RobinPicard in https://github.com/dottxt-ai/outlines/pull/1714 **Full Changelog**: https://githLow8/8/2025
    1.2.1## What's Changed * Create our own logits processor for Xgrammar, add support for mlx by @RobinPicard in https://github.com/dottxt-ai/outlines/pull/1706 * Turn tokens into strings before building the Outlines-Core Vocabulary by @RobinPicard in https://github.com/dottxt-ai/outlines/pull/1707 **Full Changelog**: https://github.com/dottxt-ai/outlines/compare/1.2.0...1.2.1Low8/4/2025
    1.2.0## What's Changed * Remove dead link to VLM example from examples index by @laitifranz in https://github.com/dottxt-ai/outlines/pull/1685 * Fix: JSON schema union types (type arrays) fail with 'type must be a string' error by @brightlikethelight in https://github.com/dottxt-ai/outlines/pull/1675 * Update docs with OpenRouter guide by @Oni-giri in https://github.com/dottxt-ai/outlines/pull/1691 * Fix broken wheel builds caused by ambiguous packaging instructions by @neilmehta24 in https://gitLow7/31/2025
    1.1.1## What's Changed * Set add_generation_template to True in chat formatting for Transformers by @RobinPicard in https://github.com/dottxt-ai/outlines/pull/1684 **Full Changelog**: https://github.com/dottxt-ai/outlines/compare/1.1.0...1.1.1Low7/11/2025
    1.1.0## What's Changed * Create the inputs module and modify the treatment of multimodal inputs by @RobinPicard in https://github.com/dottxt-ai/outlines/pull/1677 * Create the Chat input and add it to the models by @RobinPicard in https://github.com/dottxt-ai/outlines/pull/1680 * Misc doc fixes by @RobinPicard in https://github.com/dottxt-ai/outlines/pull/1683 * Remove deprecated features from v0 by @RobinPicard in https://github.com/dottxt-ai/outlines/pull/1682 **Full Changelog**: https://gLow7/10/2025
    1.0.4## What's Changed * Create Choice output type by @RobinPicard in https://github.com/dottxt-ai/outlines/pull/1671 * Add the ensure_ascii parameter to JsonSchema by @RobinPicard in https://github.com/dottxt-ai/outlines/pull/1672 * Add a batch method to models by @RobinPicard in https://github.com/dottxt-ai/outlines/pull/1674 * Fix error tokenizer arg for transformers models' generate method by @RobinPicard in https://github.com/dottxt-ai/outlines/pull/1679 **Full Changelog**: https://githLow7/4/2025
    1.0.3## What's Changed * Add llm.txt file by @rlouf in https://github.com/dottxt-ai/outlines/pull/1661 * Fix nightly tests (remove Slack alert causing troubles) by @RobinPicard in https://github.com/dottxt-ai/outlines/pull/1660 * Fix error with additionalProperties for the OpenAI model by @RobinPicard in https://github.com/dottxt-ai/outlines/pull/1668 * Add the AsyncOllama model by @RobinPicard in https://github.com/dottxt-ai/outlines/pull/1669 **Full Changelog**: https://github.com/dottxt-Low7/1/2025
    1.0.2## What's Changed * Fix typos in getting started guide by @ganglike248 in https://github.com/dottxt-ai/outlines/pull/1644 * Move VLM guide and remove Docker CI Action by @rlouf in https://github.com/dottxt-ai/outlines/pull/1643 * Fix example typo in README by @rlouf in https://github.com/dottxt-ai/outlines/pull/1650 * Add testing and documentation for vision input for VLLM model by @RobinPicard in https://github.com/dottxt-ai/outlines/pull/1648 * Add support for vision input for the Ollama Low6/26/2025
    1.0.1## What's Changed * Fix broken links in the README by @RobinPicard in https://github.com/dottxt-ai/outlines/pull/1625 * Fix the broken links in the home page of the documentation by @RobinPicard in https://github.com/dottxt-ai/outlines/pull/1628 * Fix typos across the codebase by @sukrucildirr in https://github.com/dottxt-ai/outlines/pull/1631 * Update the documentation content and styling by @rlouf in https://github.com/dottxt-ai/outlines/pull/1636 ## New Contributors * @sukrucildirr maLow6/20/2025
    1.0.0## Why a new major version? The v1 intends on making Outlines more closely focused on constrained generation. To do so, we delegate a wider range of tasks to the users and inference libraries. On top of making Outlines leaner, this design provides more flexibility to the users and let them use interfaces they are already familiar with. Our approach is inspired by the unix best practices โ€” each element does one thing well, and we compose those functional elements. As this new version depLow6/18/2025
    0.2.3## What's Changed * JSON schema error when using OpenAI with Pydantic model by @derfred in https://github.com/dottxt-ai/outlines/pull/1472 * Tweak version commands in bug_report.yml by @nchammas in https://github.com/dottxt-ai/outlines/pull/1476 * Fix capitalization in installation.md by @cpfiffer in https://github.com/dottxt-ai/outlines/pull/1488 * Remove all issue templates except bug reports by @rlouf in https://github.com/dottxt-ai/outlines/pull/1496 * Update the logo by @rlouf in httpsLow4/3/2025
    0.2.2## What's Changed * Update prompt templating documentation by @rlouf in https://github.com/dottxt-ai/outlines/pull/1448 * Format files and fix numerous `mypy` warnings, thanks to `ruff` by @yvan-sraka in https://github.com/dottxt-ai/outlines/pull/1470 * Remove `pre-commit` runtime dependency by @yvan-sraka in https://github.com/dottxt-ai/outlines/pull/1468 * Improve the regex DSL (replace `|` by `either` and introduce new quantifiers) by @rlouf in https://github.com/dottxt-ai/outlines/pull/1Low3/4/2025
    0.2.1## What's Changed * Various docs fixes by @EdAbati in https://github.com/dottxt-ai/outlines/pull/1429 * Add Bluesky social media profile link to docs by @deepybee in https://github.com/dottxt-ai/outlines/pull/1435 * Rename `Prompt` to `Template` and add deprecation warning to the `prompt` decorator by @rlouf in https://github.com/dottxt-ai/outlines/pull/1440 ## New Contributors * @deepybee made their first contribution in https://github.com/dottxt-ai/outlines/pull/1435 **Full ChangelogLow2/24/2025
    0.2.0## What's Changed * Add a few dotfiles to improve newcomers' experience by @yvan-sraka in https://github.com/dottxt-ai/outlines/pull/1368 * Update Dockerfile to Multi-Stage by @multi-stager in https://github.com/dottxt-ai/outlines/pull/1401 * Add DevContainer configuration file by @yvan-sraka in https://github.com/dottxt-ai/outlines/pull/1389 * Replaced `pycountry` with `iso3166` for Better Licensing Compliance by @aman-17 in https://github.com/dottxt-ai/outlines/pull/1410 * Update "ContribLow2/19/2025
    0.1.14## What's Changed * Fix typo in examples docs by @petros in https://github.com/dottxt-ai/outlines/pull/1379 * Fix readme to reflect routing through enum by @farnasirim in https://github.com/dottxt-ai/outlines/pull/1382 * Sort, clean and update `.gitignore` by @yvan-sraka in https://github.com/dottxt-ai/outlines/pull/1388 * Update README to include chat templating by @cpfiffer in https://github.com/dottxt-ai/outlines/pull/1372 * Add `genson` integration for json generation by @g-prz in httpsLow1/27/2025
    0.1.13## What's Changed * Update react_agent.md with current import structure by @pervrosen in https://github.com/dottxt-ai/outlines/pull/1375 * [docs] Fix `transformers_vision` multiple Images example by @gante in https://github.com/dottxt-ai/outlines/pull/1370 * Fix `vllm`-related pytest warning (that was spaming user) by @yvan-sraka in https://github.com/dottxt-ai/outlines/pull/1362 * add filters to prompt function by @derfred in https://github.com/dottxt-ai/outlines/pull/1371 * Remove incorreLow1/15/2025
    0.1.12## What's Changed * Fix image link in receipt-digitization example by @rootAvish in https://github.com/dottxt-ai/outlines/pull/1341 * Move generation of sampling params by @sky-2002 in https://github.com/dottxt-ai/outlines/pull/1340 * Fix unresolved imports in transformers doc by @TimZaman in https://github.com/dottxt-ai/outlines/pull/1348 * Set docs `docstring_style` by @EdAbati in https://github.com/dottxt-ai/outlines/pull/1343 * Fix JSON structured import by @denadai2 in https://github.cLow1/10/2025
    0.1.11## What's Changed * Bump outlines-core version to 0.1.26 by @sidharthrajaram in https://github.com/dottxt-ai/outlines/pull/1336 ## New Contributors * @sidharthrajaram made their first contribution in https://github.com/dottxt-ai/outlines/pull/1336 **Full Changelog**: https://github.com/dottxt-ai/outlines/compare/0.1.10...0.1.11Low12/13/2024
    0.1.10## What's Changed * Bump `outlines-core` version to 0.1.25 by @rlouf in https://github.com/dottxt-ai/outlines/pull/1333 **Full Changelog**: https://github.com/dottxt-ai/outlines/compare/0.1.9...0.1.10Low12/11/2024
    0.1.9## What's Changed * Fix typo in vllm extra requirements by @chicham in https://github.com/dottxt-ai/outlines/pull/1315 * Handle enum in choice by @g-prz in https://github.com/dottxt-ai/outlines/pull/1279 * Use `outlines-core` to translate JSON Schemas into regexes by @rlouf in https://github.com/dottxt-ai/outlines/pull/1311 * Bump outlines-core to 0.1.24 by @rlouf in https://github.com/dottxt-ai/outlines/pull/1330 ## New Contributors * @chicham made their first contribution in https://giLow12/10/2024
    0.1.8## What's Changed * Bump the outlines core version to 0.1.20 by @rlouf in https://github.com/dottxt-ai/outlines/pull/1323 **Full Changelog**: https://github.com/dottxt-ai/outlines/compare/0.1.7...0.1.8Low12/6/2024
    0.1.7## What's Changed * Fix library top-level imports by @rlouf in https://github.com/dottxt-ai/outlines/pull/1296 **Full Changelog**: https://github.com/dottxt-ai/outlines/compare/0.1.6...0.1.7Low11/29/2024
    0.1.6## What's Changed * Update generation.md by @djinnome in https://github.com/dottxt-ai/outlines/pull/1248 * Add link to YT channel and .txt blog by @rlouf in https://github.com/dottxt-ai/outlines/pull/1289 * Update home page spacing by @gtsiolis in https://github.com/dottxt-ai/outlines/pull/1288 * Add compatibility for numpy 2 while preserving numpy 1 compatibility by @neilmehta24 in https://github.com/dottxt-ai/outlines/pull/1265 * Updated mlx-lm kvcache creation by @cmcmaster1 in https://gLow11/27/2024
    0.1.5## What's Changed * Turn off guide caching by @torymur in https://github.com/dottxt-ai/outlines/pull/1278 ## New Contributors * @torymur made their first contribution in https://github.com/dottxt-ai/outlines/pull/1278 **Full Changelog**: https://github.com/dottxt-ai/outlines/compare/0.1.4...0.1.5Low11/22/2024
    0.1.4## What's Changed * Bump to outlines-core=0.1.17 for python 3.12-3.13 support by @mgoin in https://github.com/dottxt-ai/outlines/pull/1273 ## New Contributors * @mgoin made their first contribution in https://github.com/dottxt-ai/outlines/pull/1273 **Full Changelog**: https://github.com/dottxt-ai/outlines/compare/0.1.3...0.1.4Low11/18/2024
    0.1.3## What's Changed * Add PDF cookbook by @cpfiffer in https://github.com/dottxt-ai/outlines/pull/1256 * Add earnings reports to cookbook index by @cpfiffer in https://github.com/dottxt-ai/outlines/pull/1255 * Add a receipt processing cookbook by @cpfiffer in https://github.com/dottxt-ai/outlines/pull/1249 * Update README.md by @scampion in https://github.com/dottxt-ai/outlines/pull/1258 ## New Contributors * @scampion made their first contribution in https://github.com/dottxt-ai/outlines/Low11/10/2024
    0.1.2## What's Changed * Doc corrections by @cpfiffer in https://github.com/dottxt-ai/outlines/pull/1213 * Add transformers vision cookbook with atomic caption flow by @fearnworks in https://github.com/dottxt-ai/outlines/pull/1216 * docs: update llamacpp.md by @eltociear in https://github.com/dottxt-ai/outlines/pull/1231 * Earnings report cookbook by @cpfiffer in https://github.com/dottxt-ai/outlines/pull/1235 ## New Contributors * @fearnworks made their first contribution in https://github.cLow11/8/2024
    0.1.1The `0.1.0` included a version of `outlines-core` for which wheels where not available, causing many errors for users who don't have a Rust compiler installed. We fixed this in `outlines-core`, but changes to the interface where pushed in the meantime so we have to account for these before cutting this new release. ## What's Changed * Logits processors: Update inplace, with batch operation by @lapp0 in https://github.com/dottxt-ai/outlines/pull/1192 * Fix Broken Docs Links by @lapp0 in httpLow10/15/2024
    0.1.0# โšก Performance Improvements - **Outlines Core:** Enjoy faster FSM index construction with a new implementation (#1175). - **98% Reduction in Runtime Overhead:** Reduced overhead by storing FSM-token-mask as tensors. (#1013) # ๐Ÿš€ New Features - **[Transformers Vision Models](https://dottxt-ai.github.io/outlines/reference/models/transformers_vision/):** Apply structured generation with vision + text inputs (#1052) - **[OpenAI-Compatible API Support](https://dottxt-ai.github.io/outlines/refLow10/7/2024
    0.0.46## What's Changed * Adding `MLXLM`, `VLLM` classes to `LogitsGenerator` type by @parkervg in https://github.com/outlines-dev/outlines/pull/970 * Fix samplers documentation by @jrinder42 in https://github.com/outlines-dev/outlines/pull/980 * Ensure regex matches valid JSON for "const" and "enum" with booleans, nulls, and strings by @mwootten in https://github.com/outlines-dev/outlines/pull/972 * Add link to docs of Multimodal Structured Generation for CVPR 2nd MMFM Challenge by @leloykun in hLow6/22/2024
    0.0.45## What's Changed * Fix some dependency issues and remove obsolete try-except block by @fpgmaas in https://github.com/outlines-dev/outlines/pull/967 * Update Modal refs from stub to app by @kstathou in https://github.com/outlines-dev/outlines/pull/974 * Mask cache Performance Optimization for vllm by @paul-grundmann in https://github.com/outlines-dev/outlines/pull/939 * update README.md by @silviachen46 in https://github.com/outlines-dev/outlines/pull/968 * Pin Numpy: `numpy<2.0.0`, PreventLow6/17/2024
    0.0.44## What's Changed * Fix null byte `\x00` issue in byte level fsm resulting in `KeyError` in `BetterFSM::FSMInfo` by @lapp0 in https://github.com/outlines-dev/outlines/pull/930 * Correct link for llamacpp library by @alonsosilvaallende in https://github.com/outlines-dev/outlines/pull/949 * Add statement regarding OS vs closed models by @rlouf in https://github.com/outlines-dev/outlines/pull/950 * Support min/max number of digits for numbers in JSON Schema by @smagnan in https://github.com/ouLow6/14/2024
    0.0.43## What's Changed * fix typo in docs by @eitanturok in https://github.com/outlines-dev/outlines/pull/860 * fix code rendering by @eitanturok in https://github.com/outlines-dev/outlines/pull/864 * Ignore errors caused by import warnings from `huggingface_hub` & `pyairports` by @leloykun in https://github.com/outlines-dev/outlines/pull/866 * Fix format in the BentoML doc by @Sherlock113 in https://github.com/outlines-dev/outlines/pull/867 * Hotfix for CFG Generation by @leloykun in https://giLow6/4/2024
    0.0.42## What's Changed * Add cookbook to run Outlines on the cloud with BentoML by @larme in https://github.com/outlines-dev/outlines/pull/848 * Add Gigax project to community by @rlouf in https://github.com/outlines-dev/outlines/pull/850 * Add HF evaluation article by @rlouf in https://github.com/outlines-dev/outlines/pull/851 * Remove the need to copy all tokens during basic generation by @brandonwillard in https://github.com/outlines-dev/outlines/pull/852 * Add article with HF in README and dLow5/2/2024
    0.0.41## What's Changed * Fix typo in llama.cpp documentation by @rlouf in https://github.com/outlines-dev/outlines/pull/835 * Add azure_openai to models __init__.py by @lassiraa in https://github.com/outlines-dev/outlines/pull/840 * Add phone number and zip code custom types by @rlouf in https://github.com/outlines-dev/outlines/pull/849 ## New Contributors * @lassiraa made their first contribution in https://github.com/outlines-dev/outlines/pull/840 **Full Changelog**: https://github.com/ouLow4/30/2024
    0.0.40## What's Changed * Exclude escape character in JSON string fields by @rlouf in https://github.com/outlines-dev/outlines/pull/829 * Add tweets about Outlines by @rlouf in https://github.com/outlines-dev/outlines/pull/830 * Add `model_name` as an optional parameter for `azure_openai` by @HerrIvan in https://github.com/outlines-dev/outlines/pull/825 * Force dates, uuid, datetimes, times to be between quotes by @rlouf in https://github.com/outlines-dev/outlines/pull/831 **Full Changelog**:Low4/21/2024
    0.0.39## What's Changed * Add page with projects from the community by @rlouf in https://github.com/outlines-dev/outlines/pull/816 * Add documentation vLLM for multiple GPUs by @rlouf in https://github.com/outlines-dev/outlines/pull/817 * Add `torch` dependency in installation instructions by @rlouf in https://github.com/outlines-dev/outlines/pull/818 * Add DirectMerge article by @rlouf in https://github.com/outlines-dev/outlines/pull/819 * Add cookbook to run Outlines on the cloud with Modal by Low4/17/2024
    0.0.38## What's Changed * Improve documentation of generation methods by @rlouf in https://github.com/outlines-dev/outlines/pull/769 * Small typo fix in cookbook example by @mkretsch327 in https://github.com/outlines-dev/outlines/pull/775 * allow json ints to be negative by @posionus in https://github.com/outlines-dev/outlines/pull/777 * Add vLLM integration by @rlouf in https://github.com/outlines-dev/outlines/pull/772 * Add nvidia to list of companies using Outlines by @rlouf in https://github.Low4/15/2024
    0.0.37## What's Changed * Refactored exl2 method to add LoRA, 8bit cache, and other features supported by exllama by @psych0v0yager in https://github.com/outlines-dev/outlines/pull/729 * Update the docstring of `exl2` by @rlouf in https://github.com/outlines-dev/outlines/pull/742 * Added model_kwargs by @isamu-isozaki in https://github.com/outlines-dev/outlines/pull/744 * Fix generation of multi-token unicode characters by @ai-and-i in https://github.com/outlines-dev/outlines/pull/738 * Make `modLow3/25/2024
    0.0.36## What's Changed * Restore FSM interface for backward compatibility by @rlouf in https://github.com/outlines-dev/outlines/pull/741 **Full Changelog**: https://github.com/outlines-dev/outlines/compare/0.0.35...0.0.36Low3/12/2024

    Dependencies & License Audit

    Loading dependencies...

    Similar Packages

    agentmarkMarkdown for the AI era@agentmark-ai/ui-components@0.6.4
    prompt-layer-library๐Ÿฐ PromptLayer - Maintain a log of your prompts and OpenAI API requests. Track, debug, and replay old completions.master@2026-06-04
    monocleMonocle is a framework for tracing GenAI app code. This repo contains implementation of Monocle for GenAI apps written in Python. v0.8.3
    Awesome-GPT-Image-2-API-PromptsCurated GPT-Image-2 prompts for the OpenAI API โ€” portraits, posters, UI mockups, game screenshots, character sheets, and more. Ready-to-use prompts for gpt-image-2.main@2026-06-03
    seedance-2-ai๐ŸŽฅ Generate AI-driven videos with Seedance 2.0, offering precise physics, lip-sync, and prompt accuracy for seamless content creation.main@2026-06-02

    More in Prompt Engineering

    agentmarkMarkdown for the AI era
    awesome-seedream-4.5๐ŸŒ 100+ hand-picked Seedream 4.5 prompts with images, multilingual support, and instant gallery preview. The best Nano Banana Pro alternative โ€” only 1/3 the cost. Open-source prompt engineering librar
    prompts.chatf.k.a. Awesome ChatGPT Prompts. Share, discover, and collect prompts from the community. Free and open source โ€” self-host for your organization with complete privacy.
    awesome-promptsCurated list of chatgpt prompts from the top-rated GPTs in the GPTs Store. Prompt Engineering, prompt attack & prompt protect. Advanced Prompt Engineering papers.