Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
55 changes: 31 additions & 24 deletions .github/workflows/prompt-optimization.lock.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

68 changes: 32 additions & 36 deletions .github/workflows/prompt-optimization.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
name: "Prompt Optimization"
description: Daily hill-climbing optimization of the scenario-assistant prompt using cached Hugging Face models served by Ollama
description: Daily hill-climbing optimization of the scenario-assistant prompt using an Ollama service
engine: copilot
on:
schedule: daily
Expand Down Expand Up @@ -40,7 +40,11 @@ sandbox:
agent:
id: awf
runtime: docker-sudo-iptables
allow-host-ports: [11434]
services:
ollama:
image: ollama/ollama:0.33.2@sha256:020e4134285e2ef4d8fd801234176de3b4faadc992a3eb06c8e66a2f9d4c4ba2
ports:
- 11434:11434
Comment on lines +43 to +47
strict: true
timeout-minutes: 180
steps:
Expand All @@ -53,58 +57,50 @@ steps:
- name: Install dependencies
run: npm ci

- name: Restore Hugging Face model weights
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9
with:
key: ollama-hugging-face-models-v1-${{ runner.os }}
path: ~/.ollama

- name: Set up Ollama
uses: ai-action/setup-ollama@0fdcbba8ac63bc9c0e7629cf85f46b77a4ad4072
with:
version: 0.33.2

- name: Start Ollama
run: |
ollama serve >"$RUNNER_TEMP/ollama.log" 2>&1 &
for attempt in {1..30}; do
if curl --fail --silent http://127.0.0.1:11434/api/version >/dev/null; then
exit 0
fi
if [ "$attempt" -eq 30 ]; then
cat "$RUNNER_TEMP/ollama.log" >&2
echo "Ollama did not become ready" >&2
exit 1
fi
sleep 2
done

- name: Load and verify evaluation models
run: |
set -e
for model in \
hf.co/bartowski/Qwen2.5-1.5B-Instruct-GGUF:Q4_K_M \
Comment on lines 60 to 64
hf.co/unsloth/SmolLM2-360M-Instruct-GGUF:Q4_K_M; do
ollama pull "$model"
ollama run --keepalive 4h "$model" "Reply with exactly: ready" >/dev/null
if ! pull_response=$(curl --fail --silent --show-error --retry 10 --retry-all-errors \
--retry-max-time 900 http://127.0.0.1:11434/api/pull \
--json "{\"name\":\"$model\",\"stream\":false}"); then
echo "Failed to pull $model" >&2
exit 1
fi
if ! jq --exit-status '.status == "success"' <<<"$pull_response" >/dev/null; then
echo "Ollama did not report a successful pull for $model" >&2
exit 1
fi
if ! generate_response=$(curl --fail --silent --show-error --retry 10 --retry-all-errors \
--retry-max-time 900 http://127.0.0.1:11434/api/generate \
--json "{\"model\":\"$model\",\"prompt\":\"Reply with exactly: ready\",\"stream\":false,\"keep_alive\":\"4h\"}"); then
echo "Ollama could not load $model" >&2
exit 1
fi
if ! jq --exit-status '.error == null' <<<"$generate_response" >/dev/null; then
echo "Ollama could not load $model" >&2
exit 1
fi
done
ollama ps
---

# Scenario Prompt Optimization

Improve the wizard's shipped scenario-assistant instructions with measured hill climbing. The
workflow has already restored the Ollama cache, downloaded GGUF proxies for both browser models
from Hugging Face, and started an OpenAI-compatible Ollama server on
`http://127.0.0.1:11434/v1`.
workflow has downloaded and loaded GGUF proxies for both browser models in an OpenAI-compatible
Ollama service reachable from the agent sandbox on
`http://host.docker.internal:11434/v1`.

Use the installed `optimize-scenario-prompt` skill and
`scripts/prompt-optimizer.mjs`. Use these options for every evaluation or score command:

```text
--all-models
--eval-url http://127.0.0.1:11434/v1
--eval-url http://host.docker.internal:11434/v1
--eval-model hf.co/bartowski/Qwen2.5-1.5B-Instruct-GGUF:Q4_K_M
--ios-eval-url http://127.0.0.1:11434/v1
--ios-eval-url http://host.docker.internal:11434/v1
--ios-eval-model hf.co/unsloth/SmolLM2-360M-Instruct-GGUF:Q4_K_M
```

Expand Down
Loading