Guidance
Guidance language for controlling LLM generation with constraints, grammars, and JSON schemas.
About
Guidance approaches LLM control as a programming problem rather than prompt writing. The Python framework constrains generation with regex patterns, context-free grammars, and JSON schemas, including Pydantic models, and lets developers interleave conditionals, loops, tool calls, and generation inside composable decorated functions. Its gen() and select() primitives capture output into named variables or force a choice among fixed options, so responses always parse. A notable optimization is token fast-forwarding: any tokens the grammar makes inevitable are filled in without model forward passes, cutting latency and GPU cost during structured generation. Backends include Hugging Face Transformers, llama.cpp, and OpenAI-compatible APIs, and a Mock model allows offline grammar debugging. Installable from PyPI and released under the MIT license, Guidance is used by engineers who need guaranteed structured output from both local and hosted models.
Reviews (0)
Leave a Review
No reviews yet. Be the first to review!
Details
- Category
- AI Frameworks & Libraries
- Price
- Free
- Platform
- Local/Desktop
- Difficulty
- Intermediate (3/5)
- License
- MIT
- Added
- May 7, 2026
Related Tools
Unified system for large-scale distributed training and inference.
Library for easily accessing and processing ML datasets.
JAX neural network library with PyTorch-like module system.
High-level deep learning API supporting JAX, TensorFlow, and PyTorch backends.
Neural network library for JAX by Google providing Linen module system.
Gradient boosting library by Yandex with native categorical feature handling.
Mentioned in
SGLang and the Structured-Output Renaissance
Constrained generation used to be a library you bolted on. It is becoming a feature of the inference engine....
Max P
DSPy and the Rise of Programmatic Prompting
DSPy reframes prompts as code that can be compiled and optimized. Here is what that actually means, why it...
Max P