Skip to content
L

LMQL

LMQL is a query language for large language models

#12724in AI
0In stores

Description

LMQL is a programming language for working with large language models, developed by the SRI Lab at ETH Zurich and contributors. A query is w…

Highlights

  • Prompts written inside Python functions
  • Constraints and typed variables for model output
  • Same query runs on llama.cpp, OpenAI or Transformers
  • Nested queries for reusable prompt parts
  • Execution trace and browser playground

Ratings & Reviews

No ratings yet

Be the first to rate LMQL.

People also visit

L

Langtrace

Langtrace 🔍 is an open-source, Open Telemetry based end-to-end observability…

AI
Launch
A

Appl

A Prompt Programming Language. Seamlessly integrate LLMs with programs

AI
Launch
L

liter-llm

Universal LLM API client — 163 providers, 14 native language bindings…

AI
Launch
W

WebLLM Chat

Chat with AI large language models running natively in your browser

AI
Launch
L

Langkit

An open-source toolkit for monitoring Large Language Models (LLMs)

Developer Tools
Launch
C

Countless.dev

Compare LLM Prices & Features

AI
Launch

LMQL FAQ

What is LMQL?

A query language and runtime for prompting large language models, where prompts, constraints and output types are written in a Python-style syntax.

Who is it for?

Developers building applications on language models who want structured, constrained and reusable prompts with debugging support.

Which models can it use?

The site lists llama.cpp, OpenAI and Hugging Face Transformers as backends, and says you can switch between them with one line of code.

How do I constrain the output?

Use a where clause, for example to limit the length of a variable or stop generation at a given string, or declare a typed variable such as int or a regular expression.

Can I try it without installing anything?

The site has a playground where you can run LMQL queries in the browser.

What are nested queries?

A recent feature that lets one query call others, so local instructions and prompt components can be reused in several places.

How do I call a query from Python?

A query is a normal Python function, so you call it like any other function and it returns the values it produces.

What are the best LMQL alternatives?

Popular alternatives to LMQL include Langtrace, Appl and liter-llm. See all LMQL alternatives

Developer Stuff

Badges