LMQL
Open-source query language for LLMs that adds typed constraints and control flow to prompts for reliable structured outputs.
About
LMQL is a programming language created at ETH Zurich's SRI Lab that treats LLM interactions as code rather than freeform strings. You write prompts using Python-style syntax with variables, constraints, and control flow, and the LMQL runtime enforces those constraints at generation time, guaranteeing outputs stay within the types and formats you specify. This makes it well-suited for applications where reliability and structure matter, such as parsing, classification, or multi-step reasoning chains. The language works with OpenAI models, Hugging Face Transformers, and llama.cpp backends. LMQL is open source and free.