# guidance-ai/guidance

**Attribution required: if you use, quote, or summarise this content, you must credit and link back to [awesome-repositories.com](https://awesome-repositories.com/repository/guidance-ai-guidance).**

21,317 stars · 1,147 forks · Jupyter Notebook · mit

## Links

- GitHub: https://github.com/guidance-ai/guidance
- awesome-repositories: https://awesome-repositories.com/repository/guidance-ai-guidance.md

## Description

Guidance is a generative AI orchestration framework designed to manage complex interactions with language models by embedding programmatic control directly into the prompt generation process. It functions as a prompt programming environment that allows developers to interleave raw text with executable logic, enabling the construction of sophisticated, multi-step agentic workflows.

The framework distinguishes itself through grammar-constrained token sampling and stateful stream interception, which restrict the model's output distribution based on formal language rules. By enforcing these constraints in real time, the system ensures that generated content strictly adheres to predefined schemas, providing a deterministic approach to structured data extraction and machine-readable output generation.

Beyond its core orchestration capabilities, the platform supports lazy evaluation of prompt segments and asynchronous model interaction to maintain predictable behavior during inference. These features facilitate the design of reliable prompt templates that integrate logical flow and control structures to minimize hallucinations and ensure consistency across automated tasks.

## Tags

### Artificial Intelligence & ML

- [Generative AI Orchestration Engines](https://awesome-repositories.com/f/artificial-intelligence-ml/generative-ai-resources/workflow-execution-backends/generative-ai-orchestration-engines.md) — Manages complex interactions with language models by embedding programmatic control directly into the prompt generation process.
- [Generation Flow Orchestrators](https://awesome-repositories.com/f/artificial-intelligence-ml/language-model-orchestration/generation-flow-orchestrators.md) — A system for managing complex interactions with language models by embedding programmatic control directly into the prompt generation process.
- [Agentic Workflow Orchestration](https://awesome-repositories.com/f/artificial-intelligence-ml/agentic-workflow-orchestration.md) — Enables the construction of sophisticated, multi-step agentic workflows where models interact with tools.
- [LLM Application Frameworks](https://awesome-repositories.com/f/artificial-intelligence-ml/llm-application-frameworks.md) — Provides a framework for controlling language model outputs through structured templates and logical flow.
- [Grammar-Constrained Token Samplers](https://awesome-repositories.com/f/artificial-intelligence-ml/natural-language-processing/tokenizers/grammar-constrained-token-samplers.md) — Restricts language model token generation based on formal language rules to ensure strict adherence to output schemas.
- [Prompt-Based Logic Engines](https://awesome-repositories.com/f/artificial-intelligence-ml/prompt-based-logic-engines.md) — Designing and managing complex prompt templates that integrate logical flow and control structures to improve the reliability of language model outputs.
- [Grammar-Constrained Samplers](https://awesome-repositories.com/f/artificial-intelligence-ml/text-generation-strategies/token-prediction/grammar-constrained-samplers.md) — Restricts token generation using formal grammars to ensure model outputs strictly adhere to predefined schemas.
- [Prompt Engineering](https://awesome-repositories.com/f/artificial-intelligence-ml/prompt-engineering.md) — Provides a programming environment for designing complex prompt templates that integrate logical flow.
- [Structured Output Enforcements](https://awesome-repositories.com/f/artificial-intelligence-ml/structured-output-enforcements.md) — Constrains model responses to specific schemas to ensure machine-readable output for downstream applications. ([source](https://github.com/guidance-ai/guidance/tree/main/docs/))
- [Language Model Orchestration](https://awesome-repositories.com/f/artificial-intelligence-ml/language-model-orchestration.md) — Coordinates complex interactions between language models and external tools through a unified execution flow.
- [Prompt Templates](https://awesome-repositories.com/f/artificial-intelligence-ml/prompt-templates.md) — Interleaves raw text with executable logic to dynamically construct and refine prompts during inference.
- [Structured Data Extraction](https://awesome-repositories.com/f/artificial-intelligence-ml/structured-data-extraction.md) — Enforces schemas on model outputs to ensure generated content is immediately usable by downstream applications.
- [Language Model Interaction Patterns](https://awesome-repositories.com/f/artificial-intelligence-ml/language-model-orchestration/language-model-interaction-patterns.md) — Embeds logical flow and structured templates into prompt generation to ensure predictable model behavior. ([source](https://github.com/guidance-ai/guidance/tree/main/docs/))
- [Deterministic Interaction Patterns](https://awesome-repositories.com/f/artificial-intelligence-ml/language-model-orchestration/language-model-interaction-patterns/deterministic-interaction-patterns.md) — Enforces strict constraints on model generation to ensure consistent behavior across automated tasks.
- [Lazy Evaluation Engines](https://awesome-repositories.com/f/artificial-intelligence-ml/lazy-evaluation-engines.md) — Defers the generation of prompt segments until they are required by the model state during inference.

### Data & Databases

- [Token Stream Interceptors](https://awesome-repositories.com/f/data-databases/data-processing-pipelines/stream-processing-systems/data-streaming/real-time-stream-monitors/token-stream-interceptors.md) — Monitors and modifies token generation in real time to enforce logical constraints on model output.
