NEW
Also known as: Microsoft Guidance
An open-source library to programmatically control LLM generation using templates, constraints, and structured output.
DESCRIPTION
Guidance lets developers interleave prompt text and program logic to constrain model outputs. It supports templating, JSON or schema-constrained generation, and deterministic structures. The library integrates with popular LLM providers and toolchains to enforce format and content rules. It helps build reliable applications requiring structured outputs and guardrails.
ALTERNATIVE DEFINITIONS
Microsoft
Guidance is a Python library for controlling modern language models.
Highlights control of LLMs as the central capability.
Microsoft
Guidance provides a programming model for authoring complex prompting pipelines with constraints and structure.
Emphasizes programming model and constraints for complex prompting pipelines.
RELATED TERMS
Prompt Engineering Structured Output Template JSON Schema Guardrails Function Calling LangChain Retrieval-Augmented Generation
COMPETING TERMS
LMQL Guardrails AI Outlines
RELATIONS
- Conforms to: JSON Schema
KNOWLEDGE AREAS
TARGET AUDIENCE
AI Engineer Software Developer MLOps Engineer
EXTERNAL SOURCES
- Wikipedia - Prompt engineering
- Microsoft - Official repository and README
- Microsoft - Project docs and examples
TOP QUESTIONS
Why use Guidance for LLM applications?
It enforces structure and constraints, reducing parsing errors and hallucinations. This improves reliability for production-grade workflows.
Category: Relevancy
How does Guidance compare to LMQL or Guardrails?
Guidance focuses on template-based control with programmatic constraints. LMQL offers a query language; Guardrails emphasizes validation frameworks.
Category: Comparison
Can Guidance enforce JSON schema outputs?
Yes. It provides structured generation features that align outputs to specified schemas.
Category: Clarification
What integrations does Guidance support?
It works with major LLM providers and Python ecosystems. Check the docs for supported backends.
Category: Tools
What are common mistakes when using Guidance?
Overly rigid constraints can hurt quality; unclear templates cause inconsistent outputs. Benchmarking templates is essential.
Category: Mistakes
How do you test templates built with Guidance?
Use unit tests, golden files, and randomized prompts. Validate structure, correctness, and robustness under varied inputs.
Category: Testing
Is Guidance suitable for RAG pipelines?
Yes. It can constrain answer formats, citations, and reasoning steps, complementing retrievers and readers.
Category: UseCases
How to start learning Guidance?
Read the README and examples, replicate sample pipelines, and gradually add constraints. Evaluate against baseline prompts.
Category: GettingStarted
Does Guidance reduce hallucination risks?
Constraints and structured outputs help, but retrieval, calibration, and safety filters are still necessary.
Category: Risk