What problem does it solve?
Guidance solves the problem of unreliable LLM outputs by enforcing constrained generation so results always match a required syntax such as valid JSON, XML, or code-like formats.
Core Features & Use Cases
- Regex and Grammar-Constrained Generation: Force specific patterns (e.g., emails, dates, IDs) or full context-free grammars for nested structures.
- Guaranteed Valid Structured Output: Produce syntactically valid JSON/XML/code without ad-hoc “retry until it parses” loops.
- Multi-Step Workflows with Control Flow: Build reusable, stateful generation functions that implement multi-stage pipelines (including tool/agent-like loops) while keeping outputs well-formed.
Use Case: Generate an API payload where every field is syntactically valid (e.g., timestamps, numeric ranges, enumerated categories), then pass it directly into downstream systems without validation failures.
Quick Start
Ask an AI to generate a person object as valid JSON using Guidance while constraining the name with a regex and the email with an email-pattern grammar.