LMQL is a programming language designed for LLMs, offering robust and modular prompting capabilities using types, templates, constraints, and an optimizing runtime. Developed by the SRI Lab at ETH Zurich and contributors, LMQL enables the creation of prompt-based query programs in a user-friendly manner. By utilizing typed variables and nested queries, users can easily construct complex prompts and access results with guaranteed output formats.
With LMQL, users can seamlessly switch between different backends, making their LLM code portable across various platforms with minimal effort. The language supports procedural programming through nested queries, allowing for modularized local instructions and prompt component re-use. The inclusion of features like multi-part prompts, types and regex, and tool augmentation further enhances the versatility and usability of LMQL.
Implementing prompt construction and generation through expressive Python control flow and string interpolation, LMQL simplifies the process of creating prompt-based applications. Whether you’re developing chatbots, creating packing lists, or measuring distributions, LMQL provides a flexible and efficient solution for interacting with large language models. Experience the convenience and effectiveness of LMQL for your prompting needs.