guidance
Constrains LLM output during generation with Guidance (Microsoft Research), using regex, select() choices, context-free grammars, token healing, and @guidance functions, with Anthropic, OpenAI, Transformers, and llama.cpp backends. Use when you need generated text to match a regex or fixed format such as dates, emails, or IDs. Use when you need guaranteed valid JSON, XML, or code from a model. Use when building multi-step generation workflows or ReAct-style agents with Python control flow. Use when classifying text into fixed categories with select(). Use when running local models and wanting grammar constraints. Not for Pydantic validation with automatic retries; use Instructor for that.
- Version
- 1.0.0
- License
- MIT
Pinned to revision df088027ff23, so it is the text this page describes rather than whatever the author pushed since.
Files
- skills/guidance/SKILL.md
- skills/guidance/references/backends.md
- skills/guidance/references/common-patterns.md
- skills/guidance/references/constraints.md
- skills/guidance/references/examples.md
- skills/guidance/scripts/safe_arithmetic.py
Every link opens the file at its source, pinned to the revision this page describes.