Skip to content

Commit

Permalink
add documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
lbeurerkellner committed May 9, 2024
1 parent d64ade8 commit 3db7201
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/lmql/api/query_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,20 @@ def run_sync(self, *args, **kwargs):


class QueryBuilder:
"""
Simple query builder to construct LMQL queries programatically.
# Example usage:
query = (lmql.QueryBuilder()
.set_decoder('argmax')
.set_prompt('What is the capital of France? [ANSWER]')
.set_model('local:gpt2')
.set_where('len(TOKENS(ANSWER)) < 10')
.set_where('len(TOKENS(ANSWER)) > 2')
.build())
result = query.run_sync()
"""
def __init__(self):
self.decoder = None
self.prompt = None
Expand Down

0 comments on commit 3db7201

Please sign in to comment.