Skip to content

Commit 2845347

Browse files
authored
Merge branch 'main' into error-handling-in-repeat-1
2 parents 485286c + bcfabe8 commit 2845347

File tree

111 files changed

+10842
-2672
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

111 files changed

+10842
-2672
lines changed

.github/workflows/rust-interpreter.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,8 @@ jobs:
3131
(curl -fsSL https://ollama.com/install.sh | sudo -E sh && sleep 2)
3232
wait
3333
- name: Run interpreter tests
34-
run: npm run test:interpreter
34+
run: |
35+
python3.12 -mvenv venv
36+
source venv/bin/activate
37+
pip install nested-diff
38+
npm run test:interpreter

.github/workflows/tauri-cli.yml

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -31,27 +31,20 @@ jobs:
3131
sudo apt install -y libgtk-3-dev libwebkit2gtk-4.1-dev librsvg2-dev patchelf at-spi2-core && \
3232
(curl -fsSL https://ollama.com/install.sh | sudo -E sh && sleep 2)
3333
wait
34-
- name: Test production build
35-
run: npm run tauri build -- --bundles deb # Skip testing appimage, is this dangerous? It's slow...
34+
- name: Test production build # Skip testing appimage, is this dangerous? It's slow...
35+
run: |
36+
npm run tauri build -- --ci --bundles deb
37+
- name: Install production build
38+
run: |
39+
ls ./src-tauri/target/release/bundle/deb && sudo apt install -y ./src-tauri/target/release/bundle/deb/*.deb
3640
- name: Setup xvfb for screen 0
37-
run: Xvfb :1 -screen 0 1600x1200x24 &
38-
39-
- name: Test beeai compiler
40-
env:
41-
DISPLAY: :1
4241
run: |
43-
PATH=./src-tauri/target/release/:$PATH
44-
45-
for i in ./demos/beeai/*.py
46-
do pdl compile beeai $i -g -o /tmp/z.json && jq .description /tmp/z.json
47-
done
42+
Xvfb :1 -screen 0 1600x1200x24 &
4843
49-
- name: Test pdl run against production build
44+
- name: Test 'pdl run' against production build
5045
env:
5146
DISPLAY: :1
5247
run: |
53-
PATH=./src-tauri/target/release/:$PATH
54-
5548
# 1a. `run` subcommand errors due to missing required positional parameter
5649
pdl run && (echo "This should have failed" && exit 1) || (echo "Great, expected failure received" && exit 0)
5750
@@ -69,9 +62,9 @@ jobs:
6962
# demo5,demo6 each depend on an external file, and the interpreter does not currently capture this in the trace
7063
# demo8 currently requires building a model which the interpreter does not directly support
7164
# demo9 takes forever, so... for now skip it
72-
for i in ./src/demos/*.json
73-
do if [[ $(basename $i) != "demo4.json" ]] && [[ $(basename $i) != "demo5.json" ]] && [[ $(basename $i) != "demo6.json" ]] && [[ $(basename $i) != "demo8.json" ]] && [[ $(basename $i) != "demo9.json" ]]; then pdl run $i; fi
74-
done
65+
#for i in ./src/demos/*.json
66+
#do if [[ $(basename $i) != "demo4.json" ]] && [[ $(basename $i) != "demo5.json" ]] && [[ $(basename $i) != "demo6.json" ]] && [[ $(basename $i) != "demo8.json" ]] && [[ $(basename $i) != "demo9.json" ]]; then pdl run $i; fi
67+
#done
7568
7669
- name: Tear down xvfb
7770
run: killall Xvfb || true

.pre-commit-config.yaml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,18 @@ repos:
1616
- id: debug-statements
1717
# Clean up imports in Python using isort
1818
- repo: https://github.com/pycqa/isort
19-
rev: 5.13.2
19+
rev: 6.0.1
2020
hooks:
2121
- id: isort
2222
args: [--filter-files, --profile, black]
2323
# Format the python code with black
2424
- repo: https://github.com/psf/black
25-
rev: 24.8.0
25+
rev: 25.1.0
2626
hooks:
2727
- id: black
2828
# Lint the python code with flake
2929
- repo: https://github.com/PyCQA/flake8
30-
rev: 7.1.1
30+
rev: 7.2.0
3131
hooks:
3232
- id: flake8
3333
# Type check the Python code with pylint
@@ -47,15 +47,16 @@ repos:
4747
]
4848
# run the bandit security linter
4949
- repo: https://github.com/PyCQA/bandit
50-
rev: 1.7.10
50+
rev: 1.8.3
5151
hooks:
5252
- id: bandit
5353
args: [-c, bandit.yaml]
5454
# Type check the Python code with MyPy
5555
- repo: https://github.com/pre-commit/mirrors-mypy
56-
rev: 'v1.11.2'
56+
rev: 'v1.15.0'
5757
hooks:
5858
- id: mypy
59+
args: [--explicit-package-bases]
5960
verbose: true
6061
additional_dependencies: ['types-PyYAML']
6162
# type check the Python code using pyright

contrib/prompt_library/CoT.pdl

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
description: CoT pattern introduced by Wei et al. (2022)
2+
defs:
3+
# Chain of Thought
4+
cot_block:
5+
function:
6+
question: str
7+
reasoning: str
8+
answer: str
9+
return: |-
10+
Question: ${ question }
11+
Answer: Let's think step by step. ${ reasoning }
12+
The answer is ${ answer }
13+
14+
fewshot_cot:
15+
function:
16+
examples:
17+
{ list: { obj: { question: str, reasoning: str, answer: str } } }
18+
return:
19+
text:
20+
- for:
21+
example: ${ examples }
22+
repeat:
23+
call: ${ cot_block }
24+
args:
25+
question: ${ example.question }
26+
reasoning: ${ example.reasoning }
27+
answer: ${ example.answer }
28+
join:
29+
with: "\n\n"
30+
31+
chain_of_thought:
32+
function:
33+
question: str
34+
model: str
35+
examples:
36+
{ list: { obj: { question: str, reasoning: str, answer: str } } }
37+
return:
38+
lastOf:
39+
- call: ${ fewshot_cot }
40+
args:
41+
examples: ${ examples }
42+
- "Question: ${ question }\n"
43+
- "Answer: Let's think step by step. "
44+
- model: ${ model }
45+
def: answer
46+
parameters:
47+
max_tokens: 1024
48+
temperature: 0
49+
stop:
50+
- "<|endoftext|>"
51+
- "Question:"
52+
include_stop_sequence: false
53+
- data:
54+
answer: ${ answer|trim }

contrib/prompt_library/ReAct.pdl

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
description: ReAct pattern from Yao et al., [ICLR 2023](https://openreview.net/forum?id=WE_vluYUL-X)
2+
# See alternative implementation here: https://smith.langchain.com/hub/hwchase17/react-chat
3+
defs:
4+
react_block:
5+
function:
6+
trajectory: { list: obj }
7+
return:
8+
text:
9+
- for:
10+
trajectory: ${ trajectory }
11+
repeat:
12+
text:
13+
- defs:
14+
type:
15+
text: ${ trajectory.keys()|first }
16+
- match: ${ type }
17+
with:
18+
- case: question
19+
then: |
20+
Question: ${ trajectory[type]|trim }
21+
- case: task
22+
then: |
23+
Task: ${ trajectory[type]|trim }
24+
- case: thought
25+
then: |
26+
Tho: ${ trajectory[type]|trim }
27+
- case: action
28+
then: |
29+
Act: ${ trajectory[type]|trim }
30+
- case: observation
31+
then: |
32+
Obs: ${ trajectory[type]|trim }
33+
- if: ${ type not in ['question', 'task', 'thought', 'action', 'observation'] }
34+
then: "${ type }: ${ trajectory[type]|trim }"
35+
- "\n"
36+
37+
react:
38+
function:
39+
task: str
40+
model: str
41+
tool_schema: { list: obj }
42+
tools: obj
43+
trajectories: { list: list }
44+
return:
45+
lastOf:
46+
- role: system
47+
text:
48+
- "Today's Date: "
49+
- lang: python
50+
code: |
51+
from datetime import datetime
52+
result = datetime.today().strftime('%B %d, %Y.\n')
53+
- |
54+
You are a helpful assistant with access to the following function calls. Your task is to produce a sequence of function calls necessary to generate response to the user utterance. Use the following function calls as required.
55+
56+
Respond in the format {"name": function name, "arguments": dictionary of argument name and its value}. Do not use variables.
57+
58+
${ tool_schema }
59+
contribute: [context]
60+
- "\n"
61+
- for:
62+
traj: ${ trajectories }
63+
repeat:
64+
text:
65+
call: ${ react_block }
66+
args:
67+
trajectory: ${ traj }
68+
- ${ task }
69+
- def: prev_action
70+
contribute: []
71+
data: none
72+
- def: exit
73+
contribute: []
74+
data: False
75+
- def: tool_names
76+
contribute: []
77+
text: ${ tool_schema|map(attribute='name')|list }
78+
- repeat:
79+
text:
80+
- "\nTho: "
81+
- def: thought
82+
model: "${ model }"
83+
contribute: []
84+
parameters:
85+
stop:
86+
- "Act:"
87+
max_tokens: 256
88+
include_stop_sequence: false
89+
- "${ thought|trim }"
90+
- "\nAct: "
91+
- def: action
92+
model: "${ model }"
93+
parser: json
94+
parameters:
95+
temperature: 0
96+
stop: ["\n", "Obs:", "<|eom_id|>"]
97+
include_stop_sequence: false
98+
spec: { name: str, arguments: obj }
99+
- if: ${ action != prev_action }
100+
then:
101+
def: observation
102+
if: ${ action.name.lower() != "finish" }
103+
then:
104+
text:
105+
- "\nObs: "
106+
- if: ${ action.name.lower() in tools }
107+
then:
108+
call: ${ tools[action.name.lower()] }
109+
args:
110+
arguments: ${ action.arguments }
111+
else: "Invalid action. Valid actions are ${ tool_names[:-1]|join(', ') }, and ${ tool_names[-1] }."
112+
else:
113+
def: exit
114+
contribute: []
115+
data: True
116+
- def: prev_action
117+
contribute: []
118+
data: ${ action }
119+
until: ${ action.name.lower() == "finish" or exit }
120+
- data:
121+
answer: ${ (action.arguments.answer|default("No answer found."))|trim }

0 commit comments

Comments
 (0)