Skip to content

feat: add annotation queues with context guide - #28

Merged
LeoRoccoBreedt merged 5 commits into
mainfrom
lrb/annotation-queues-with-context
Jul 1, 2026
Merged

feat: add annotation queues with context guide#28
LeoRoccoBreedt merged 5 commits into
mainfrom
lrb/annotation-queues-with-context

Conversation

@LeoRoccoBreedt

Copy link
Copy Markdown
Collaborator

What this adds

A new guides/ notebook — annotation_queues_with_context — showing how to structure RAG traces so they're immediately useful in Opik annotation queues.

The lesson

A trace gives you four distinct places to put data — input, output, metadata, and child spans. Returning the whole pipeline dict as output buries the answer a reviewer needs to score. The guide shows how to distribute it instead:

  • output — the final answer only
  • metadata — retrieval context, via opik_context.update_current_trace()
  • child spans — every sub-step (@opik.track, type-tagged tool/llm for UI rendering)

It also covers creating an annotation queue programmatically (create_traces_annotation_queuesearch_tracesadd_traces) and the post-hoc enrichment pattern (update_trace + flush).

Notes

  • Notebook-only guide; pyproject.toml (uv) + README.md per repo convention. Mock retriever/LLM — no LLM API key required.
  • Grounded on the trace data model rather than exact SME-view UI claims (those aren't documented and are version-dependent).
  • Indexed in the root and guides/ README tables.
  • Origin: CUST-6444.

Follow-ups (not in this PR)

  • Decide whether to standardize committing implementation plans/specs in-repo (see discussion).
  • Optional: scope search_traces so the "added N traces" count reflects only the current run.

A guides-bucket notebook on structuring RAG traces for Opik annotation
queues: clean answer in output, retrieval context in metadata via
opik_context.update_current_trace(), and full detail preserved in child
spans (type-tagged for UI rendering). Also covers creating a queue
programmatically and the post-hoc enrichment pattern. Indexed in the
root and guides README tables.
LeoRoccoBreedt added a commit that referenced this pull request Jul 1, 2026
## What this adds

A dedicated CI path for **notebook examples**, so a `.ipynb` guide no
longer needs a `run.sh` wrapper.

### `test-notebooks.yml` (new)
- Detects example folders changed in the PR that contain a `.ipynb`.
- On same-repo PRs (Opik secrets available), executes each changed
notebook end-to-end with `uv run --with ipython --with nbformat ipython
<notebook>.ipynb` — every cell runs, non-zero exit on the first error —
wrapped in `nick-fields/retry@v3` (25-min timeout, 2 attempts).
- **No dry-run job.** Notebooks log live traces and need credentials, so
fork PRs (no secrets) skip execution; the compliance check still runs.

### `compliance.yml`
- A folder containing a `.ipynb` is exempt from the `run.sh` requirement
(it's executed by `test-notebooks.yml`).
- `OPIK_PROJECT_NAME` is accepted in a `.py` **or `.ipynb`**; the
litellm/`OPIK_EXAMPLES_MODEL` check is likewise extended.

### `CONTRIBUTING.md`
- New **Notebook examples** section documenting the lighter contract
(notebook + pyproject + README, no run.sh, outputs cleared,
credential-gated, no dry-run), with carve-outs in the existing
run.sh/dry-run rules and the PR checklist.

### Design notes
- **Discovery is change-detection** (mirrors `pr-test.yml`), so
notebooks are auto-discovered with zero maintenance. Known gap: a
notebook nobody edits isn't re-tested until it changes — a curated
**scheduled** run for stable notebooks is a deliberate follow-up (needs
idempotent notebooks first).
- `ipython <notebook>` execution follows neptune-ai/scale-examples'
working pattern; trivially swappable to `jupyter execute` later.

Unblocks the notebook guide in #28, which then needs no `run.sh`.
@LeoRoccoBreedt
LeoRoccoBreedt marked this pull request as ready for review July 1, 2026 09:50
@LeoRoccoBreedt LeoRoccoBreedt self-assigned this Jul 1, 2026
@LeoRoccoBreedt
LeoRoccoBreedt merged commit fdfd4cb into main Jul 1, 2026
7 checks passed
@LeoRoccoBreedt
LeoRoccoBreedt deleted the lrb/annotation-queues-with-context branch July 1, 2026 09:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant