Skip to content

Commit

Permalink
Merge branch 'main' of github.com:eth-sri/lmql
Browse files Browse the repository at this point in the history
  • Loading branch information
lbeurerkellner committed Jan 9, 2024
2 parents a055952 + 2c54489 commit c319446
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 13 deletions.
6 changes: 3 additions & 3 deletions docs/docs/language/constraints.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ LMQL currently only supports integer constraints. However, support for floating
:::

### Choice From Set
LMQL allows to specify that a variable should be a choice from a set of possible values. This can be rephrased as the variable being within a set of possible values, i.e. `THING in set(["Volleyball", "Sunscreen", "Bathing Suite"])` in the following example
LMQL allows to specify that a variable should be a choice from a set of possible values. This can be rephrased as the variable being within a set of possible values, i.e. `THING in set(["Volleyball", "Sunscreen", "Bathing Suit"])` in the following example

```{lmql}
name::set
Expand All @@ -68,7 +68,7 @@ sample(temperature=0.8)
from
'openai/text-ada-001'
where
THING in set(["Volleyball", "Sunscreen", "Bathing Suite"])
THING in set(["Volleyball", "Sunscreen", "Bathing Suit"])
```
```promptdown
Expand Down Expand Up @@ -166,4 +166,4 @@ Here, we enforce a stopping condition on the `.` character, but only once the ge

### Custom Constraints and Theoretical Background

To learn more about the internals of LMQL and how to implement your own LMQL constraint, see the chapter on [Implementing Custom LMQL Constraints](./constraints/custom-constraints.md).
To learn more about the internals of LMQL and how to implement your own LMQL constraint, see the chapter on [Implementing Custom LMQL Constraints](./constraints/custom-constraints.md).
7 changes: 4 additions & 3 deletions docs/docs/language/tools.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ How much profit did he make?"
# insert few shot demonstrations
"{gsm8k_samples()}"
# prompt tempalte
# prompt template
"Q: {QUESTION}\n"
"Let's think step by step.\n"
Expand Down Expand Up @@ -83,7 +83,7 @@ Further, we use a function `gsm8k_samples` that returns a few-shot samples for t

## Beyond Calculators

**Wikipedia Search** Function use is not limited to calculators. In the example bellow we show how text retrieval, using Pythons [`async`/`await` syntax](https://docs.python.org/3/library/asyncio.html), can be used to augment the reasoning capabilities of the large language model.
**Wikipedia Search** Function use is not limited to calculators. In the example below we show how text retrieval, using Python's [`async`/`await` syntax](https://docs.python.org/3/library/asyncio.html), can be used to augment the reasoning capabilities of the large language model.

```lmql
async def wikipedia(q):
Expand Down Expand Up @@ -138,7 +138,8 @@ To remember things, you can use 'assign'/'get':
`assign("Alice", "banana") # result: "banana"`
- To retrieve a stored value:
`get("Alice") # result: "banana"`
Always tail calls with " # result". Using these actions, let's solve the following question.\n"""
Always tail calls with " # result". Using these actions, let's solve
the following question.\n"""
# actual problem statement
"""
Expand Down
6 changes: 3 additions & 3 deletions docs/features/examples/1-packing-list.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ Prompt construction and generation is implemented via expressive *Python control
for i in range(4):
# 'where' denotes hard constraints enforced by the runtime
"- [THING] \n" where THING in \
["Volleyball", "Sunscreen", "Bathing Suite"]
["Volleyball", "Sunscreen", "Bathing Suit"]
```
%SPLIT%
```promptdown
My packing list for the trip:
- [THING| Volleyball]
- [THING| Bathing Suite]
- [THING| Bathing Suit]
- [THING| Sunscreen]
- [THING| Volleyball]
```
```
2 changes: 1 addition & 1 deletion src/lmql/runtime/tracing/tracer.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ def __init__(self, tracer):
self.tracer = tracer

def __enter__(self):
_ensure_tracer
_ensure_tracer()
current = _tracer.get()[-1] if len(_tracer.get()) > 0 else None
if current is not None:
if self.tracer.parent is not None:
Expand Down
2 changes: 1 addition & 1 deletion src/lmql/ui/playground/public/precomputed/list.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions src/lmql/ui/playground/src/queries.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ sample(temperature=0.8)
# use a loop to generate a list
for i in range(4):
"- [THING] \\n" where \\
THING in set(["Volleyball", "Sunscreen", "Bathing Suite"])`,
THING in set(["Volleyball", "Sunscreen", "Bathing Suit"])`,
state: 'precomputed/list.json'
},
{
Expand Down Expand Up @@ -415,4 +415,4 @@ from
},
]
},
]};
]};

0 comments on commit c319446

Please sign in to comment.