What problem does it solve?
Guidance eliminates unreliable free-form LLM outputs by enforcing syntactic and structural constraints so models produce valid JSON, XML, code, and other structured formats without expensive retry loops.
Core Features & Use Cases
- Regex and Grammar Constraints: Enforce token-level patterns and context-free grammars to guarantee format correctness (emails, dates, UUIDs, JSON fields).
- Token Healing & Selection: Avoid token-boundary artifacts and provide deterministic choice selections for classification or fixed-category fields.
- Multi-step Workflows & Agents: Build Pythonic, stateful or stateless generation functions and ReAct-style agents that call tools and validate inputs.
- Use Case: Generate validated API responses, extract structured entities from text, or create production-grade data pipelines that require strict output formats.
Quick Start
Use Guidance to generate a valid JSON user object with fields name, age, and email that each match specified regex constraints.