Guidance: Structured LLM Control
Enforces structured outputs and grammatical constraints on Large Language Models to guarantee valid JSON, code, and regex-compliant text.
Guidance by Microsoft Research is a specialized framework designed to eliminate the unpredictability of LLM responses by applying strict regex and context-free grammar constraints during the generation process. It allows developers to build complex, multi-step workflows and ReAct agents that are guaranteed to follow specific formats, such as valid JSON, XML, or predefined selection lists. By utilizing 'token healing' to fix unnatural boundaries and providing Pythonic context managers for chat interactions, Guidance ensures higher reliability and lower latency for production-grade AI applications using models like Claude, GPT-4, and local LLMs.