Skip to content
Open

Pr #7

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
81 commits
Select commit Hold shift + click to select a range
2ffa89a
Pr pipeline 2 (#5)
jgchn Apr 12, 2025
54b6ab2
Update contrib readme
jgchn Apr 12, 2025
ec0a031
Get test results for nightly run
jgchn Apr 12, 2025
a745413
Update results on all files
jgchn Apr 12, 2025
b7cda95
Small fix
jgchn Apr 13, 2025
3966a67
refactor: refactor rust ast to place metadata in common struct
starpit Apr 13, 2025
a5400eb
fix: improve deserialization of python-generated model block traces
starpit Apr 13, 2025
316a31b
fix: in rust ast, allow ModelBlock model to be an expr
starpit Apr 13, 2025
8e6d9de
Rm dependency on yaml actions
jgchn Apr 13, 2025
dc216c9
Add repo to checkout
jgchn Apr 13, 2025
c76a2a1
Update checkout ref
jgchn Apr 13, 2025
f4bd8fa
Dont check out again
jgchn Apr 13, 2025
7a6a69e
Rm another checkout
jgchn Apr 13, 2025
1bce474
Rm checkout refs
jgchn Apr 13, 2025
63830c4
Fix yq
jgchn Apr 13, 2025
20445b5
Configure git and try again
jgchn Apr 13, 2025
cfcae08
Fix source repo name
jgchn Apr 13, 2025
10d0f54
feat: initial pdl__id and --trace support for rust interpreter
starpit Apr 13, 2025
dc314fc
Checkout fix
jgchn Apr 13, 2025
559b926
Fix ref
jgchn Apr 13, 2025
79da481
github-actions[bot]: Run examples: reverting update_result to false o…
github-actions[bot] Apr 14, 2025
2457314
Try push again
jgchn Apr 14, 2025
a2538e1
Merge branch 'pr' of https://github.com/jgchn/prompt-declaration-lang…
jgchn Apr 14, 2025
7cd24ca
Fix update results bool
jgchn Apr 14, 2025
e21bbd1
Try another push
jgchn Apr 14, 2025
f5232cc
Try using secrets
jgchn Apr 14, 2025
d601797
github-actions[bot]: Run examples: reverting update_result to false o…
github-actions[bot] Apr 14, 2025
1bf9482
fix: update rust interpreter to create Data blocks for expr eval, and…
starpit Apr 14, 2025
e9b02f6
fix: populate trace context field in rust interpreter
starpit Apr 14, 2025
6a5b1de
Update stop sequences in parameters (#861)
jgchn Apr 14, 2025
3e313a6
refactor: extract platform-generic logic from run_ollama_model() handler
starpit Apr 14, 2025
af5e740
Don't use composite action in pr
jgchn Apr 14, 2025
7cc677f
Merge branch 'pr' of https://github.com/jgchn/prompt-declaration-lang…
jgchn Apr 14, 2025
3905db1
Refine bool comparison
jgchn Apr 14, 2025
fec39b1
Don't cache ollama
jgchn Apr 15, 2025
85618bd
Add patch yaml step
jgchn Apr 15, 2025
424e33f
fix: rust interpreter was not handling pdl__context for re-runs of tr…
starpit Apr 15, 2025
10f0c3d
feat: improve support for importing stdlib in python code blocks
starpit Apr 15, 2025
b96056b
skeleton-of-thought example (#919)
vazirim Apr 15, 2025
5e516bf
Bump litellm and openai versions (#920)
vazirim Apr 16, 2025
4381488
fix: improve support for rust interpreter python imports from venv
starpit Apr 16, 2025
3429834
chore: bump tauri and npm dependencies
starpit Apr 16, 2025
6db7ba3
Test if PAT works
jgchn Apr 18, 2025
74410bc
Merge remote-tracking branch 'upstream/main' into pr
jgchn Apr 18, 2025
7c90638
Add checkout step
jgchn Apr 18, 2025
42133d6
Checkout modification
jgchn Apr 18, 2025
7f2246b
chore: bump ui to 0.6.1 (#921)
starpit Apr 18, 2025
46401a8
fix: rust ast support for gsm8k, including jsonl parser
starpit Apr 18, 2025
6716dd9
chore: bump rust dependencies
starpit Apr 18, 2025
816a438
feat: improve support for tool calling in ollama-rs
starpit Apr 18, 2025
5cd83b2
Fully qualify import (#930)
esnible Apr 22, 2025
2492b39
feat: some regex parser support for rust interpreter
starpit Apr 22, 2025
9839214
Change to sys.path for python code block (#931)
vazirim Apr 22, 2025
5ddd784
granite-io hallucination demo example and notebook (#932)
vazirim Apr 22, 2025
d62cad5
Add contrib. prompt library (#927)
claudiosv Apr 23, 2025
19349ab
Fixed the bug where pdl.__version__ was not set (#882)
vite-falcon Apr 30, 2025
fc327d1
chore: update pre-commit tools (#937)
mandel May 2, 2025
3270285
Use granite-io async interface (#936)
mandel May 2, 2025
ab88b4b
chore: bump ui dependences
starpit May 3, 2025
07c4ac9
fix: skip failing execution tests (#938)
mandel May 6, 2025
86d8f5d
independent implementation (#934)
vazirim May 6, 2025
2d72b3b
feat: add a `parse_dict` function to `pdl_parser` (#943)
mandel May 7, 2025
01be02e
feat: specify PDL types in the AST (#942)
mandel May 14, 2025
bcfabe8
PDL Optimizer (#941)
claudiosv May 19, 2025
47f4adc
Add a new retry feature to `block` (#824)
hirokuni-kitahara May 23, 2025
497aa1b
feat: extend PDL types with json schema types (#947)
mandel May 23, 2025
12ff796
feat: add a `signature` field to closures containing the function sig…
mandel May 23, 2025
3dddc10
chore(deps): Update granite-io requirement from <0.4,>=0.2 to >=0.2,<…
dependabot[bot] May 27, 2025
3724dfa
chore(deps): Update faiss-cpu requirement from ~=1.10.0 to >=1.10,<1.…
dependabot[bot] May 27, 2025
4b15d82
fix: run tests (#949)
mandel May 29, 2025
7455aa4
feat: add `index` field to `repeat` blocks to name loop index (#950)
mandel Jun 2, 2025
1204d12
Fix for extra fields in messages sent to LLMs (#952)
vazirim Jun 2, 2025
17310f4
Merge branch 'main' into pr
jgchn Jun 3, 2025
3dc0ca1
Update with feedback
jgchn Jun 3, 2025
161901e
Fix checkout
jgchn Jun 3, 2025
67f5497
Checkout fix
jgchn Jun 3, 2025
a2b25bd
Checkout fix 2
jgchn Jun 3, 2025
a2949e3
Checkout fix 3
jgchn Jun 3, 2025
c17a186
Update code
jgchn Jun 3, 2025
d692758
Update results
jgchn Jun 3, 2025
87c74fb
Enable parallel runs
jgchn Jun 3, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions .github/actions/ollama/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: 'Ollama Setup'
description: 'Composte action for Ollama set up in GH environment'
runs:
using: 'composite'
steps:
- name: Remove unnecessary files
shell: bash
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf "$AGENT_TOOLSDIRECTORY"

# Set up Ollama
- name: Install Ollama and start server
shell: bash
run: |
curl -fsSL https://ollama.com/install.sh | sudo -E sh

- name: Pull models in examples/
shell: bash
run: |
ollama pull granite3.2:2b
ollama pull granite3.2:8b
ollama pull mxbai-embed-large
ollama list

- name: Check that all required models are available
shell: bash
run: |
models=("mxbai-embed-large" "granite3.2:2b" "granite3.2:8b")
missing=0
for model in "${models[@]}"; do
if ! ollama list | awk 'NR>1 {print $1}' | grep -q "$model"; then
echo "❌ Model $model is missing!"
missing=1
fi
done

if [ "$missing" -eq 1 ]; then
exit 1
else
echo "✅ All expected models are available."
fi

- name: Wait for Ollama server
shell: bash
run: |
sleep 5
time curl -i http://localhost:11434
109 changes: 109 additions & 0 deletions .github/actions/run-examples/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
name: 'Ollama Setup'
description: 'Composte action to set up Run Examples'
inputs:
python-version:
description: 'Python version'
required: true
default: '3.11'
runner-os:
description: 'Runner OS'
required: true
repository:
description: 'Repository name this pull request is initiated from'
required: false
head-ref:
description: 'Head ref of the repo'
required: false
default: 'main'
token:
description: 'Github token'
required: false
update-results:
description: 'Whether to update the results for this run. Must be false for nightly runs'
required: true
check:
description: 'Files to patch tests/test_examples_run.yaml with. These are the PDL files that the test will run against. Defaults to all PDL files.'
required: false
default: '[]'
runs:
using: 'composite'
steps:
# # Set up Ollama
- uses: ./.github/actions/ollama

# Configure Run Examples environment
- uses: actions/checkout@v4
with:
token: ${{ inputs.token }}
ref: ${{ inputs.head-ref }}
repository: ${{ inputs.repository }}
fetch-depth: 0

- name: Patch tests/test_examples_run.yaml check with modified files
shell: bash
run: |
yq -i '.check = (${{ inputs.check }})' tests/test_examples_run.yaml

- name: Print test Run Examples config
shell: bash
run: cat tests/test_examples_run.yaml

# Run tests
- name: Set up Python ${{ inputs.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ inputs.python-version }}
- name: Cache pip
uses: actions/cache@v4
with:
# This path is specific to Ubuntu
path: ${{ env.pythonLocation }}
# Look to see if there is a cache hit for the setup file
key: ${{ inputs.runner-os }}-pip-new3-${{ env.pythonLocation }}-${{ hashFiles('setup.py') }}
restore-keys: |
${{ inputs.runner-os }}-pip-new3
${{ inputs.runner-os }}-new3
- name: Install dependencies
shell: bash
run: pip install --upgrade --upgrade-strategy eager .[all]
- name: Pip list packages
shell: bash
run: pip list
- name: Run Pytest
shell: bash
run: |
cat tests/test_examples_run.yaml
(
set +e
py.test -v --capture=tee-sys -rfE -s tests/test_examples_run.py --disable-pytest-warnings
EXIT_CODE=$?

if [ $EXIT_CODE -eq 0 ]; then
echo "TEST_RESULT=PASSED" >> $GITHUB_ENV
else
echo "TEST_RESULT=FAILED" >> $GITHUB_ENV
fi
)

# Commit the results if update results
- name: Push new results to branch
shell: bash
if: ${{ inputs.update-results == 'true' }}
run: |
git config --local user.name github-actions[bot]
git config --local user.email 41898282+github-actions[bot]@users.noreply.github.com
git status
git pull origin ${{ inputs.head-ref }}
git add tests/results/
git diff --cached --quiet || git commit -s -m "github-actions[bot]: Run examples: updated result files on your behalf"
# git push origin ${{ inputs.head-ref }}
git push https://x-access-token:${{ inputs.token }}@github.com/${{ inputs.repository }} HEAD:${{ inputs.head-ref }}

- name: Check if pytest passed
shell: bash
run: |
if [ "$TEST_RESULT" == "PASSED" ]; then
exit 0
else
exit 1
fi
47 changes: 47 additions & 0 deletions .github/workflows/run-examples-prep.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
---
name: Run examples on modified PDL files
on: [pull_request]
jobs:
tests:
name: Execution tests
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ['3.11', '3.12', '3.13']

steps:
# Detect modified PDL files, includes Add, Modified, but not Deleted
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Detect all PDL files that were changed or added
id: changed-pdl-files
uses: tj-actions/changed-files@6cb76d07bee4c9772c6882c06c37837bf82a04d3 # v46
with:
files: |
**.pdl
json: "true"
escape_json: "false"
- name: List PDL files that were modified or added and append to test_examples_run.yaml
run: |
echo ${{ steps.changed-pdl-files.outputs.all_changed_files }}
if [ ${{ steps.changed-pdl-files.outputs.all_changed_files_count }} -gt 0 ]; then
echo "early-stop=false" >> $GITHUB_ENV
else
echo "No file need to be checked, skipping all subsequent tests."
echo "early-stop=true" >> $GITHUB_ENV
fi

- name: Run examples
uses: ./.github/actions/run-examples
# Only run if there are modified PDL files
if: env.early-stop == 'false'
with:
python-version: ${{ matrix.python-version }}
runner-os: ${{ runner.os }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
head-ref: ${{ github.event.pull_request.head.ref }}
token: ${{ github.token }}
update-results: 'false'
check: ${{ steps.changed-pdl-files.outputs.all_changed_files }}
103 changes: 13 additions & 90 deletions .github/workflows/run-examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ on:
- cron: '0 1 * * *'
workflow_dispatch:


jobs:
tests:
name: Execution tests
Expand All @@ -15,93 +14,17 @@ jobs:
fail-fast: false
matrix:
python-version: ['3.11', '3.12', '3.13']

steps:

# Free up some disk space
- name: Remove unnecessary files
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf "$AGENT_TOOLSDIRECTORY"

# Set up Ollama
- name: Install Ollama and start server
shell: bash
run: |
curl -fsSL https://ollama.com/install.sh | sudo -E sh

- name: Pull models in examples/
shell: bash
run: |
ollama pull granite3.2:2b
ollama pull granite3.2:8b
ollama pull mxbai-embed-large
ollama list

- name: Check that all required models are available
shell: bash
run: |
models=("mxbai-embed-large" "granite3.2:2b" "granite3.2:8b")
missing=0
for model in "${models[@]}"; do
if ! ollama list | awk 'NR>1 {print $1}' | grep -q "$model"; then
echo "❌ Model $model (or substring) is missing!"
missing=1
fi
done

if [ "$missing" -eq 1 ]; then
exit 1
else
echo "✅ All expected models are available."
fi

- name: Wait for Ollama server
shell: bash
run: |
sleep 10
time curl -i http://localhost:11434

# Run tests
- uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Cache pip
uses: actions/cache@v4
with:
# This path is specific to Ubuntu
path: ${{ env.pythonLocation }}
# Look to see if there is a cache hit for the setup file
key: ${{ runner.os }}-pip-new3-${{ env.pythonLocation }}-${{ hashFiles('setup.py') }}
restore-keys: |
${{ runner.os }}-pip-new3
${{ runner.os }}-new3
- name: Install dependencies
run: pip install --upgrade --upgrade-strategy eager .[all]
- name: pip list packages
run: pip list
- name: show pip dependencies
run: |
pip install pipdeptree
pipdeptree -fl
- name: run tests
env:
WATSONX_PROJECT_ID: ${{ secrets.WATSONX_PROJECT_ID }}
WATSONX_APIKEY: ${{ secrets.WATSONX_APIKEY }}
WATSONX_URL: ${{ secrets.WATSONX_URL }}
REPLICATE_API_TOKEN: ${{ secrets.REPLICATE_API_TOKEN }}
OLLAMA_GHACTIONS_RESULTS: true
run: py.test -v --capture=tee-sys -rfE -s tests/test_examples_run.py
- name: Update example result files (if any) generated from Ollama running on GH Actions
if: matrix.python-version == '3.11'
run: |
git config --local user.name github-actions[bot]
git config --local user.email "${{ github.actor_id }}+${{ github.actor }}@users.noreply.github.com"
git status
git add tests/results/
git diff --cached --quiet || git commit -S -s -m "github-actions[bot]: Updated results file when running examples on $(date)"
git push
- uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
- uses: ./.github/actions/run-examples
with:
python-version: ${{ matrix.python-version }}
runner-os: ${{ runner.os }}
repository: ${{ github.repository }}
head-ref: ${{ github.head_ref }}
token: ${{ github.token }}
update-results: 'false'
check: '[]' # Empty list means run against all PDL programs

6 changes: 5 additions & 1 deletion .github/workflows/rust-interpreter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,8 @@ jobs:
(curl -fsSL https://ollama.com/install.sh | sudo -E sh && sleep 2)
wait
- name: Run interpreter tests
run: npm run test:interpreter
run: |
python3.12 -mvenv venv
source venv/bin/activate
pip install nested-diff
npm run test:interpreter
11 changes: 6 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,18 @@ repos:
- id: debug-statements
# Clean up imports in Python using isort
- repo: https://github.com/pycqa/isort
rev: 5.13.2
rev: 6.0.1
hooks:
- id: isort
args: [--filter-files, --profile, black]
# Format the python code with black
- repo: https://github.com/psf/black
rev: 24.8.0
rev: 25.1.0
hooks:
- id: black
# Lint the python code with flake
- repo: https://github.com/PyCQA/flake8
rev: 7.1.1
rev: 7.2.0
hooks:
- id: flake8
# Type check the Python code with pylint
Expand All @@ -47,15 +47,16 @@ repos:
]
# run the bandit security linter
- repo: https://github.com/PyCQA/bandit
rev: 1.7.10
rev: 1.8.3
hooks:
- id: bandit
args: [-c, bandit.yaml]
# Type check the Python code with MyPy
- repo: https://github.com/pre-commit/mirrors-mypy
rev: 'v1.11.2'
rev: 'v1.15.0'
hooks:
- id: mypy
args: [--explicit-package-bases]
verbose: true
additional_dependencies: ['types-PyYAML']
# type check the Python code using pyright
Expand Down
Loading
Loading