4 ms·
What reason is there to learn a new query language when I can program a LLM with any existing language?
by tehsauce 3y ago
What reason is there to learn a new query language when I can program a LLM with any existing language?
- CGamesPlay 3y agoThink of this more like SQL rather than Python. This language doesn't replace your main language, and you could implement all of the logic in your main language, obviously. But this provides you with easy-to-access primitives for beam search, constrained responses, etc.
- lbeurerkellner 3y agoAuthor here. LMQL gives you a concise way to define multi-part prompts and enforce constraint on LLMs. For instance, you can make sure the model always adheres to a specific output format, where parsing of the output is automatically taken care of. Also abstracts a number of things like APIs and local models, tokenisation, optimisation and makes tool integration (e.g. tool function calls during LLM reasoning) much easier. In practice this saves you a lot of ugly text concatenation and output parsing code, letting you focus on the core logic of your project. Overall, however, you will still use your host language to call LMQL. E.g. we are fully integrated with Python, where LMQL query code simply lives in decorated functions (https://docs.lmql.ai/en/latest/python/python.html https://docs.lmql.ai/en/latest/python/python.html).