Home / Tools / Guidance

Guidance

Open-source library that steers LLM output with code-like control

Guidance preview
github.com Open Source

Upvotes

0

Pricing

Open Source

Category

Prompt Generators

In the database since

Oct 2026

Overview

About Guidance

Guidance is an open-source Python library for steering language models with code. It comes from the guidance-ai team and uses the MIT license. Instead of plain prompting, you write programs that mix text generation with logic like loops and conditions. You can force output into exact shapes using regex or grammars, so JSON always parses. Guidance also cuts latency and cost compared to normal prompting or fine-tuning. You install it from PyPI in seconds. It works with many model backends, from local models to hosted APIs.

Key Features

1. Constrained Generation

Force model output to match a regex or grammar, so JSON and other formats always parse correctly.

2. Code Meets Generation

Mix conditionals, loops, and tool calls with text generation inside one clean, readable program block.

3. Lower Latency

Guidance skips wasted tokens during constrained generation, which makes structured output noticeably faster than plain prompting.

4. Lower Cost

Fewer wasted tokens means smaller bills from model providers on every structured request you run.

5. Easy Install

The MIT-licensed library installs from PyPI in seconds and works with your existing Python code.

6. Active Community

The guidance-ai team maintains the project with docs, examples, and a Discord server for questions.

Frequently Asked Questions (FAQ)

What does Guidance do?

It lets you control language model output with programs instead of hoping a prompt works.

How is it different from prompt engineering?

Constraints are enforced while the model generates, not checked after the fact.

What output shapes can I enforce?

Anything you can describe: JSON schemas, regular expressions, and full context-free grammars.

Does Guidance work with local models?

Yes. It supports many backends, including local models and hosted APIs.

Who maintains Guidance?

The guidance-ai organization develops it in the open on GitHub.

Conclusion

Guidance is for developers who need model output they can trust. When your app must produce valid JSON or follow strict rules, constraints beat clever prompts. The library is free, fast to install, and well documented. Write one small program with a grammar constraint, and hand-checking JSON output will become a thing of the past.

Newsletter

Tools like this change fast

New Prompt Generators tools launch every week — the newsletter keeps you ahead of what's worth trying.

Keep exploring

Similar AI tools

Ranked by the job they do, their capabilities, and how closely they fit this workflow.