eth-sri / lmql

A language for constraint-guided and efficient LLM programming.
https://lmql.ai
Apache License 2.0
3.64k stars 197 forks source link

Query Request Builder #286

Open Christof23 opened 10 months ago

Christof23 commented 10 months ago

Hi, this looks like a great utility for creating structured responses from LLMs! I do have one suggestion however in terms of using the builder pattern for constructing queries programmatically instead of via free-text style docstrings. This would help improve the overall API of the interface and user experience.

lbeurerkellner commented 9 months ago

Thanks for suggesting this, it it is definitely a good idea. I will keep this issue to track progress/work on this.

lbeurerkellner commented 7 months ago

Marking this as a good first issue.

A query request builder would just construct an LMQL string, that is then passed to the LMQL compiler to produce a callable LMQL query function (the compiler lives here https://github.com/eth-sri/lmql/blob/main/src/lmql/language/compiler.py#L428).

As an implementation exercise, this requires some understanding of the full LMQL syntax (see https://lmql.ai/docs/language/reference.html).