What problem does it solve?
Guidance helps you stop LLM responses from producing malformed or unpredictable outputs by enforcing syntax, structure, and allowed tokens during generation.
Core Features & Use Cases
- Regex-based constrained generation: force fields like emails, IDs, dates, phone numbers, and numeric ranges to match required patterns.
- Grammar-constrained outputs: generate complex structured data (including nested JSON/XML-like formats) that obey a specified grammar.
- Multi-step workflows with deterministic structure: build repeatable pipelines that generate intermediate steps, actions, and final results without breaking formatting.
- Token healing for clean concatenation: reduce spacing and boundary issues when combining prompt text with constrained generations.
- Backend-flexible execution: run with OpenAI/Anthropic, Transformers, or llama.cpp backends as needed.
Quick Start
Use the guidance skill to generate a valid JSON object by specifying a grammar that constrains each field (e.g., name, age, email) and then read the parsed fields directly from the result.