guidance

Constrain LLM outputs with regex and grammar constraints for structured formats.

Updated Apr 10, 2026
One-click install
npx skills add https://github.com/overviewlabs/WHOX --skill guidance-overviewlabs
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: guidance
Source: https://github.com/overviewlabs/WHOX/tree/main/skills/mlops/inference/guidance
Command: npx skills add https://github.com/overviewlabs/WHOX --skill guidance-overviewlabs

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Guidance provides a framework to control LLM outputs with regex and grammars, guaranteeing valid JSON, XML, or code formats, and enabling multi-step workflows with deterministic behavior.

Core Features & Use Cases

  • Constrained generation with regex and grammar constraints to produce structured outputs.
  • Token healing and grammar-based generation to ensure clean, valid outputs and reduce errors.
  • Multi-step workflows and reusable patterns with Pythonic APIs for developers, including data extraction, JSON generation, and code generation.
  • Local model support and offline operation for privacy and cost control.

Quick Start

Install Guidance and run a constrained-generation example to produce a valid JSON structure.

Frequently Asked Questions about guidance

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I constrain LLM outputs to ensure valid JSON generation?

You constrain LLM outputs using regex and grammar constraints to enforce JSON validity. This approach guarantees structured formats and reduces formatting errors during generation by applying token healing and grammar-based generation.

What is grammar-based generation and how does it control structured outputs?

Grammar-based generation controls structured outputs by applying syntax rules to the LLM. It enforces JSON or XML validity, ensuring the model produces clean, deterministic formats that match your defined constraints.

Can I use regex constraints for data extraction with local models offline?

Yes, you can apply regex constraints for data extraction with local models offline. The framework supports local model operation, providing privacy and cost control while enforcing grammar-based generation for robust data extraction workflows.

What is the best way to enforce XML validity in multi-step LLM workflows?

The best way to enforce XML validity in multi-step workflows is to apply grammar constraints to the LLM. This ensures deterministic behavior across each step, producing clean and valid structured formats throughout the process.

Why does token healing matter for constrained generation?

Token healing matters for constrained generation because it ensures clean, valid outputs. It fixes boundary token issues during generation, reducing errors and maintaining strict adherence to your regex and grammar constraints.