You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
## Summary
Adds CI support to `use-cases/f1_radio_rag` — the first example to go
through the new PR test workflow (from PR #16).
## What changed
- `run.sh` — runs `ingest` then `ask`, logging one RAG trace to Opik.
Lightweight alternative to the full eval suite for CI.
- `config.py` — reads `OPIK_EXAMPLES_MODEL` so CI routes to a cheap
model (`openai/gpt-4o-mini`). Removes `LLM_READY` guard — missing keys
now fail loudly via litellm rather than silently skipping.
- `cli.py` — removes the `LLM_READY` dry-run branch in `ask`.
## Tested locally
Ran `bash run.sh` with real credentials. Trace appeared in Opik
workspace under project `f1-radio-rag`.
**Depends on PR #16 merging first** for the PR test workflow to fire.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Copy file name to clipboardExpand all lines: templates/use-case-template/README.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -33,7 +33,7 @@ Or, with `uv` (recommended — this folder is a `uv` project): `uv sync`.
33
33
34
34
| Environment variable | Required | Description |
35
35
|---|---|---|
36
-
|`ANTHROPIC_API_KEY`| for `run`/`eval`/`optimize`/`promote`|Anthropic key; used via litellm for generation, judge metrics, and the optimizer |
36
+
|`ANTHROPIC_API_KEY`(or the key for your `OPIK_EXAMPLES_MODEL` provider) | for live `run`/`eval`/`optimize`/`promote`|Model-provider key used via litellm for generation, judge metrics, and the optimizer |
37
37
|`OPIK_API_KEY`| for `eval`/`optimize`/`promote`| Your Opik API key. Unset → those commands run in DRY_RUN |
38
38
|`OPIK_WORKSPACE`| for `eval`/`optimize`/`promote`| Your Opik workspace name |
39
39
|`OPIK_PROJECT_NAME`| No | Opik project for traces/experiments (default `example-use-case`) |
Copy file name to clipboardExpand all lines: use-cases/f1_radio_rag/README.md
+13-3Lines changed: 13 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -38,10 +38,11 @@ Or, with `uv` (recommended — this folder is a `uv` project): `uv sync`.
38
38
39
39
| Environment variable | Required | Description |
40
40
|---|---|---|
41
-
|`ANTHROPIC_API_KEY`| for `ask`/`eval`/`optimize`/`promote`|Anthropic key; used via litellm for generation, the LLM-judge metrics, and the optimizer |
41
+
|`ANTHROPIC_API_KEY`(or the key for your `OPIK_EXAMPLES_MODEL` provider) | for live `ask`/`eval`/`optimize`/`promote`|Model-provider key used via litellm for generation, the LLM-judge metrics, and the optimizer |
42
42
|`OPIK_API_KEY`| for `eval`/`optimize`/`promote`| Your Opik API key. Unset → those commands run in DRY_RUN |
43
43
|`OPIK_WORKSPACE`| for `eval`/`optimize`/`promote`| Your Opik workspace name |
44
44
|`OPIK_PROJECT_NAME`| No | Opik project for traces/experiments (default `f1-radio-rag`) |
45
+
|`OPIK_EXAMPLES_MODEL`| No | litellm model for generation/judging/optimising. Unset → `anthropic/claude-sonnet-4-6`; CI sets a cheap model (e.g. `openai/gpt-4o-mini`) |
45
46
|`OPIK_URL_OVERRIDE`| No | Base URL for self-hosted Opik (default: Opik Cloud) |
46
47
47
48
## Running it
@@ -66,13 +67,22 @@ uv run f1rag promote # optimised prompt saved to the Prompt Library (version
66
67
uv run f1rag run-all # the whole loop in one shot
67
68
```
68
69
70
+
`run.sh` is the entrypoint CI runs: it exports `OPIK_PROJECT_NAME`, then `uv sync` and runs
71
+
`ingest` + `ask`. With no credentials it stays in dry-run and exits 0 (the secrets-free CI check);
72
+
with credentials set it logs a live trace to Opik.
73
+
74
+
```bash
75
+
bash run.sh
76
+
```
77
+
69
78
## How it works
70
79
71
80
1.**Ingest** (`rag.py`) — `chromadb.PersistentClient` stores one document per radio message with
72
81
session/driver/lap metadata, using ChromaDB's default local embeddings (no embedding-API cost).
73
82
2.**Ask** (`rag.py`) — `answer()` retrieves the top-k messages, then calls
74
-
`litellm.completion(model="anthropic/claude-sonnet-4-6", ...)` with the summariser prompt from
75
-
`prompts.py`. It's decorated with `@opik.track`, so each call appears as a trace in Opik.
83
+
`litellm.completion(model=config.GEN_MODEL, ...)` with the summariser prompt from `prompts.py`
84
+
(`GEN_MODEL` defaults to `anthropic/claude-sonnet-4-6`, overridable via `OPIK_EXAMPLES_MODEL`).
85
+
It's decorated with `@opik.track`, so each call appears as a trace in Opik.
76
86
3.**Eval** (`evaluation.py`) — builds an Opik dataset and a test suite, then scores the live RAG
77
87
task. The test suite checks plain-English **assertions**; `evaluate` runs the `ContextRecall`
78
88
(retrieval quality) and `Hallucination` (faithfulness) metrics. The eval cases live in
0 commit comments