DEDUPED Hot AI repos. Real use cases. What people build. Get the Monday 5

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

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

Short answer: Install the library with pip install outlines; then connect a model with Outlines.from_transformers as in the quickstart; Define EventInfo with name, date, location, event_type, topics and registration_required, and an EventType enum. All steps.

Who it is forA developer scraping announcements with incomplete information.

The problemModels invent missing fields unless you give them a way to decline.

The outcomeEither a complete EventInfo object or an explicit I don't know.

What you need first

  • Python with pip; install with `pip install outlines`
  • A model backend, such as a Hugging Face transformers model, as in the README quickstart
  • Pydantic for typed schemas

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 for your agent

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.

Use this in your AI agent

Ask your agent

Using the Deduped MCP, get the setup steps for dottxt-ai/outlines and "Extract event details, with a safe fallback"

Add Deduped to Claude Code once

claude mcp add --transport http deduped https://dedupedai.com/mcp

Cursor, ChatGPT, others

Share: X LinkedIn Hacker News Email Copy link

Third-party repos we don't own. AI-written use cases can be wrong. Disclaimer