LMQL is a programming language for LLMs. Robust and modular LLM prompting using types, templates, constraints and an optimizing runtime. @lmql.query def meaning_of_life(): '''lmql # top-level strings are prompts "Q: What is the answer to life, the \ universe and everything?" # generation via (constrained) variables "A: [ANSWER]" where \ len(ANSWER) < 120 and STOPS_AT(ANSWER, ".") # results are dir
![LMQL is a programming language for LLM interaction. | LMQL](https://cdn-ak-scissors.b.st-hatena.com/image/square/16f38c78b0167a604ebcbc0c682a11ed6412563a/height=288;version=1;width=512/https%3A%2F%2Flmql.ai%2Fstatic%2Fimages%2Flmql-social.png)