LMQL

lmql.ai Programming Languages Open-source project

LMQL provides a programming language for interactions with large language models.

lmql.ai
LMQL homepage screenshot

About LMQL

LMQL is a programming language for interacting with large language models. It allows prompts to be written inside Python functions, using types, templates and where-clause constraints to control generated text, with results available as variables.

It supports nested queries for reuse of prompt components and Python control flow such as loops for building prompts. Code can be moved between backends including llama.cpp, OpenAI and Transformers with a single line change.

Key features

  • Constrained variables with where clauses to limit output
  • Typed variables for structured output, such as integers
  • Nested queries for reusable prompt components
  • Switch LLM backends with a single line change
  • Python loops and control flow for prompt construction
  • String interpolation to build multi-part prompts
Best for: Developers using Python to build structured, constraint-based prompts for large language models.
Good for
  • Works with llama.cpp, OpenAI, and Transformers backends
  • Enforces output limits with types and where-clause constraints
  • Query programs run as Python functions with accessible variables

LMQL at a glance

Website
lmql.ai
Type
Open-source project
Pricing
Not confirmed. Check the site
Platforms
Web
Open source
Not stated
Language
English
Last checked
Oct 5, 2026 · Online when checked
Listed
Oct 5, 2026

LMQL alternatives

Tools and sites you could use instead, ranked by how closely they match.

All 24 alternatives

Popular in Programming Languages

Well-known listings from the same topic.

All 66

LMQL FAQ

Which backends can LMQL use?
llama.cpp, OpenAI, and Transformers, with switching by changing a single line of code.
How does LMQL work with Python?
Prompts are written inside Python functions using control flow and string interpolation, and generated values are accessible as variables.
What do nested queries do?
They allow modular local instructions and reuse of prompt components.
Is something wrong or out of date?

Tell us and an editor will check it.

Own this website?

Claim the listing and suggest updates yourself. An editor checks every claim first.

Claim this listing