# AI use cases for Outlines (dottxt-ai/outlines)

Repo: [dottxt-ai/outlines](https://github.com/dottxt-ai/outlines) | Use cases: 3 | Page: https://dedupedai.com/use-cases/dottxt-ai-outlines/

Outlines guarantees structured outputs during generation from any LLM. You pass the output type, such as a Literal, an int or a Pydantic model, and get back text that matches it, with the same code working across OpenAI, Ollama, vLLM, transformers and other backends.

This file holds every use case of this repo. Each one starts with a "## " heading and ends with its URL.

- Turn support emails into structured tickets: https://dedupedai.com/use-cases/dottxt-ai-outlines/turn-support-emails-into-tickets-with-outlines/
- Categorize product descriptions in batches: https://dedupedai.com/use-cases/dottxt-ai-outlines/categorize-products-in-batches-with-outlines/
- Extract event details, with a safe fallback: https://dedupedai.com/use-cases/dottxt-ai-outlines/extract-event-details-with-a-fallback-in-outlines/

## How to turn support emails into structured tickets with Outlines

Repo: [dottxt-ai/outlines](https://github.com/dottxt-ai/outlines) | Difficulty: Intermediate | Time: 1 hour | Basis: From the README

Define a ServiceTicket schema and have the model fill it from a free-form customer email, then route on the fields.

**Who it is for:** A support or ops engineer automating triage.

**The problem:** Free-form emails need a priority, category and escalation flag before routing.

**The outcome:** A validated ticket object you can send to a manager alert or a queue.

### Steps

1. Install the library with `pip install outlines`
2. Connect a model with Outlines.from_transformers as in the README, using microsoft/Phi-3-mini-4k-instruct
3. Define a ServiceTicket Pydantic model with priority, category, requires_manager, summary and action_items
4. Call the model with the prompt and ServiceTicket, parse with ServiceTicket.model_validate_json, and alert a manager when priority is urgent

### Prompt to paste into your agent

```text
Using dottxt-ai/outlines, install it with `pip install outlines` and build the ServiceTicket triage example for emails in <my inbox export>, printing the parsed tickets.
```

### Caveat

The README example runs a transformers model with device_map set to auto, so a GPU helps.

Risk, privacy: Customer emails go to whichever model backend you connect, so use a local model if the messages are sensitive.

Disclaimer: Third-party repos we don't own or vouch for. AI-generated use cases can be wrong: review everything and run at your own risk. Full text: https://dedupedai.com/disclaimer/

URL: https://dedupedai.com/use-cases/dottxt-ai-outlines/turn-support-emails-into-tickets-with-outlines/

## How to categorize product descriptions in batches with Outlines

Repo: [dottxt-ai/outlines](https://github.com/dottxt-ai/outlines) | Difficulty: Intermediate | Time: 1 hour | Basis: From the README

Pass a list of descriptions through a template and get a typed category, sub category and attributes for each.

**Who it is for:** An e-commerce or catalog engineer cleaning inventory data.

**The problem:** Manual categorization of product feeds does not scale.

**The outcome:** A list of ProductCategory objects ready to update your inventory system.

### Steps

1. Install the library with `pip install outlines`
2. Connect a model with Outlines.from_transformers as in the quickstart
3. Define ProductCategory with main_category, sub_category, attributes and an optional brand_match
4. Build an Outlines.Template and call the model on the whole list of prompts, then validate each result with model_validate_json

### Prompt to paste into your agent

```text
With dottxt-ai/outlines, categorize every row of <my product CSV> using a ProductCategory schema and outlines.Template, and write the results to a new CSV.
```

### Caveat

Structure is guaranteed, but the category values themselves can still be wrong, so spot check a sample.

Disclaimer: Third-party repos we don't own or vouch for. AI-generated use cases can be wrong: review everything and run at your own risk. Full text: https://dedupedai.com/disclaimer/

URL: https://dedupedai.com/use-cases/dottxt-ai-outlines/categorize-products-in-batches-with-outlines/

## How to extract event details, with a safe fallback with Outlines

Repo: [dottxt-ai/outlines](https://github.com/dottxt-ai/outlines) | Difficulty: Intermediate | Time: 1 hour | Basis: From the README

Use a union type so the model returns structured event info or the literal I don't know when data is missing.

**Who it is for:** A developer scraping announcements with incomplete information.

**The problem:** Models invent missing fields unless you give them a way to decline.

**The outcome:** Either a complete EventInfo object or an explicit I don't know.

### Steps

1. Install the library with `pip install outlines`
2. Connect a model with Outlines.from_transformers as in the quickstart
3. Define EventInfo with name, date, location, event_type, topics and registration_required, and an EventType enum
4. Declare EventResponse as a Union of EventInfo and Literal for I don't know and pass it as the output type

### Prompt to paste into your agent

```text
Using dottxt-ai/outlines, build an EventResponse union schema and run it over <my event descriptions>, reporting which ones returned I don't know.
```

### Caveat

The fallback only helps if your prompt makes clear that missing details should produce it.

Disclaimer: Third-party repos we don't own or vouch for. AI-generated use cases can be wrong: review everything and run at your own risk. Full text: https://dedupedai.com/disclaimer/

URL: https://dedupedai.com/use-cases/dottxt-ai-outlines/extract-event-details-with-a-fallback-in-outlines/
