Unleash the Power of Language Models with LMQL

Last Updated:

LMQL is a language model interaction programming language that enhances natural language prompting, making it more expressive by combining text prompting and scripting. It allows high-level control and enforceable constraints while efficiently minimizing the number of expensive calls to the underlying language model.

LMQL is a query language for large language models that bridges the gap between natural language and programming languages, enabling users to prompt language models with language instructions or examples for various downstream tasks. It provides a high-level, declarative syntax and abstracts over model-specific implementation details to interact with language models easily, making it model-agnostic and portable. LMQL can capture a wide range of state-of-the-art prompting methods and allow constraints to be specified over the language model output, leading to high-level control, increased accuracy, and cost savings. LMQL is available in a web-based Playground IDE or through Python package manager installation for local use. This project is developed by SRI Lab at ETH Zürich, and it welcomes feedback and contributions through its Community Discord, GitHub Issues, or Twitter. LMQL is a promising tool that unlocks the full potential of language models for advanced natural language processing tasks.