LMQL is a programming language
Scripted Questions
Natural language prompting is made more expressive while still being usable by LMQL, which generalises it. In order to do this, LMQL builds on top of Python and enables users to express commands in both natural language and code. Direct execution of the generated queries on language models, such as the GPT models from OpenAI, is possible. The user may control how the LLM arrives at conclusions thanks to fixed answer templates and intermediary instructions.
Output Restrictions
Users of the language model output can define high-level, logical constraints in LMQL. Following that, these restrictions are automatically transformed into token-level prediction masks that may be immediately applied during text production. This makes it feasible to firmly enforce a number of constraints, making it impossible for the model to produce material that does not meet the criteria. As a result, multi-part prompting and integration are made simpler and improved output format assurances are made.