Integrations
Supported model backends documented on the site are llama.cpp for local inference, OpenAI hosted models and Hugging Face Transformers. Queries are written in Python, so they fit into existing Python projects.
Learn moreA query language that turns LLM prompting into typed, constrained code

LMQL is an open source query language from ETH Zurich that combines Python control flow, typed variables and hard constraints to make LLM prompting modular and reliable across llama.cpp, OpenAI and Hugging Face backends.
LMQL is a programming language for interacting with large language models, developed by the SRI Lab at ETH Zurich with outside contributors. Instead of assembling prompt strings by hand and hoping the model complies, you write query programs that mix prompt text, Python control flow and formal constraints. The runtime then enforces those constraints during generation, so output shape becomes something the system guarantees rather than something you check afterwards. The syntax will look familiar to anyone who has written Python. Top level strings act as prompts, square brackets mark positions where the model generates text, and a where clause attaches conditions. Those conditions can be simple membership checks in a list, length limits, regex patterns or typed variables such as an integer slot. Prompt construction can sit inside loops, conditionals and function calls, and results come back as ordinary Python values. Nested queries extend this by letting one query call another, which makes prompt components reusable across a project. Portability is a core design goal. The same query can run against llama.cpp, OpenAI models or Hugging Face Transformers, and switching backends is described as a one line change. That matters for teams that prototype on a hosted API and later move to local weights, or that want to benchmark several models against identical logic. The site also demonstrates multi part prompts, distribution measurement, tool augmentation and chatbot patterns as worked examples. Who it suits: developers building LLM features that need reliable structure, researchers who want to measure model behavior under constraints, and teams tired of brittle prompt templates held together with string concatenation. It is not a no code product. Comfort with Python is effectively a prerequisite, and the mental shift to constraint driven prompting takes some adjustment. Compared with prompt management dashboards, LMQL operates at a lower level: it gives you a language and a runtime rather than a library of saved prompts, which is more power but also more setup.




Supported model backends documented on the site are llama.cpp for local inference, OpenAI hosted models and Hugging Face Transformers. Queries are written in Python, so they fit into existing Python projects.
Learn moreCore features include prompt strings with bracketed generation slots, a where clause for hard constraints, typed variables and regex conditions, Python control flow and string interpolation around prompts, nested queries for reusable prompt components, and backend portability across llama.cpp, OpenAI and Hugging Face Transformers. Example programs cover packing lists, constrained generation, multi part prompts, distribution measurement, tool augmentation and chatbots.
Learn moreThe best AI for coding in 2027, from coding agents and AI editors to app builders, with free plans, prices and limits compared as of December 2026.
The best AI grammar checkers compared on accuracy features, languages, free limits and where they work, from LanguageTool to academic and fiction editors.
The best AI writing tools for drafting, editing, fiction, research papers and marketing, compared on what each does best, free plans and limits.