guidance

Generates structured, validated LLM output using regex, grammars, and custom logic.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires guidance, transformers, llama_cpp, and includes scripts (resource) and references (resource) and assets (resource) components.

What problem does it solve?

This Skill allows you to control Language Model (LLM) outputs, ensuring structured and valid JSON/XML/code generation, enforcing format constraints, and building multi-step workflows.

Core Features & Use Cases

  • Control LLM Output: Use regex and grammars to control LLM output syntax, format, and structure.
  • Structured Output: Generate valid JSON, XML, or code with guaranteed structured formats.
  • Multi-Step Workflows: Build multi-step workflows with Pythonic control flow and error handling.
  • Use Case: Create a multi-step workflow to generate a structured JSON output for a user's resume based on free-form input text.

Quick Start

Use the guidance skill to generate a JSON object with user's name and age.

Frequently Asked Questions about guidance

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

FAQPage Schema
How do I ensure LLM output strictly follows a structured JSON format?

You can enforce valid structured JSON output from LLMs by applying regex patterns and grammars to constrain generation, ensuring the syntax matches your exact format requirements.

What is the best way to build multi-step workflows for structured data generation?

Building multi-step workflows for structured data generation uses Pythonic control flow to guide LLMs, transforming free-form input text into constrained, valid structured outputs like a resume JSON.

Can I use custom regex and grammars to control LLM syntax generation?

Yes, you can use custom regex and grammars to control LLM syntax generation, enforcing specific format constraints and structured output rules directly during the language model generation phase.

Does the guidance package work with llama_cpp and transformers for constrained generation?

Yes, constrained generation using grammars and regex works with llama_cpp and transformers, requiring these dependencies to enforce structured formats and custom logic during LLM inference.

Why do I need grammars for automated code generation and data transformation tasks?

You need grammars for automated code generation and data transformation to guarantee syntax validity, preventing malformed structures and ensuring the LLM output adheres to strict structural constraints.