Skip to content

fix(examples): correct APSearch scope and validate few-shot queries - #45

Merged
liampond merged 1 commit into
mainfrom
fix/audit-few-shot-examples
Sep 16, 2026
Merged

liampond merged 1 commit into
mainfrom
fix/audit-few-shot-examples

Conversation

@liampond

@liampond liampond commented Sep 16, 2026 •

Copy link
Copy Markdown
Collaborator

Problem

Twelve few-shot queries omit explicit prefixes. The APSearch/BBAW question promises Arabic field recordings and recording dates, but its SPARQL selects generic works between 1900 and 2024. Executing successfully does not establish those claims; the original query's 100 returned records are all typed only as generic creative works.

Change

  • Add the missing wdt declaration and eleven xsd declarations; preserve the verified MusicBrainz queries unchanged.
  • Replace APSearch example #138 with a question and query for up to 100 explicitly classified audio records published by BBAW, showing catalogued creation years. Require P31/Q3302947, retain the verified publisher link, and remove the unrequested date cutoff. Explain in the schema that source creation ranges were reduced to their start year.
  • Reword seven related APSearch questions (#147, #148, #164–168) to match their existing catalogue counts, types, licenses and year bounds. Rename misleading result columns; their matching/counting logic stays unchanged.
  • Remove review_required and the separate authored/runtime lists: all 178 corrected pairs remain available to few-shot and RAG consumers.
  • Keep syntax/prefix/schema regression checks directly in backend tests. This PR adds no eval files, standalone audit script, generated snapshots, or importer changes.

Live findings for manual verification

The publisher path P123 → NFDI4Culture E2431 → P2888 → Q219989 is correct. APSearch has 3,005 explicitly typed audio records, 2,409 with creation years. The revised query returns 100 rows, beginning in 1970. Its explicit audio filter excludes generic records, so the revised question states that restriction. The original language/field-recording distinctions remain unsupported by structured fields; this correction changes the question accordingly.

A separate data anomaly is “Sudan Situation”, whose stored year is 9009. The intended year was not established and no source data was changed. #48 records the findings and the query for manual review; raw responses stay local.

Validation

150 backend tests pass on this branch. A new in-memory RDF test verifies media, publisher, graph and date requirements, including years outside the old cutoff. All 178 examples pass offline syntax/prefix/schema checks. Black and diff checks pass. The combined PR series passes 153 backend tests.

Eight bounded, read-only queries used the free Virtuoso endpoint. No paid model calls were made. These checks do not certify all pairs' semantic correctness or measure model accuracy. The MusicBrainz schema fix (#50) is already merged; this PR targets main.

@coderabbitai

coderabbitai Bot commented Sep 16, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 11 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Advanced

Run ID: 2fa1f936-abdc-440f-ade5-9c39743109cc

📥 Commits

Reviewing files that changed from the base of the PR and between c5942e2 and 022abf9.

📒 Files selected for processing (3)
  • llm-service/app/graph/examples.py
  • llm-service/app/graph/schema_corpus.py
  • llm-service/tests/test_examples.py

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@liampond
liampond force-pushed the fix/preserve-ontology-context branch from 63a365f to 7fad37f Compare September 16, 2026 11:37
@liampond
liampond force-pushed the fix/audit-few-shot-examples branch from 0c6f1c4 to 75bbf99 Compare September 16, 2026 11:37
Base automatically changed from fix/preserve-ontology-context to main September 16, 2026 13:00
@liampond
liampond force-pushed the fix/audit-few-shot-examples branch 2 times, most recently from dc46f34 to ce33408 Compare September 16, 2026 13:31
@liampond liampond changed the title fix(examples): audit SPARQL pairs and quarantine unsupported queries fix(examples): audit prefixes and preserve verified MusicBrainz queries Sep 16, 2026
@liampond
liampond changed the base branch from main to fix/musicbrainz-live-schema September 16, 2026 13:31
Base automatically changed from fix/musicbrainz-live-schema to main September 16, 2026 15:23
@liampond
liampond force-pushed the fix/audit-few-shot-examples branch from ce33408 to 815aa63 Compare September 16, 2026 15:43
@liampond
liampond force-pushed the fix/audit-few-shot-examples branch from 815aa63 to 022abf9 Compare September 16, 2026 16:31
@liampond liampond changed the title fix(examples): audit prefixes and preserve verified MusicBrainz queries fix(examples): correct APSearch scope and validate few-shot queries Sep 16, 2026
@liampond
liampond marked this pull request as ready for review September 16, 2026 17:04
Copilot AI lite review requested due to automatic review settings September 16, 2026 17:04
@liampond
liampond merged commit 539c382 into main Sep 16, 2026
15 checks passed
@liampond
liampond deleted the fix/audit-few-shot-examples branch September 16, 2026 17:05

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

The shared few-shot query semantics warrant final human verification.

Pull request overview

Corrects APSearch few-shot SPARQL examples, clarifies schema guidance, and adds offline validation while preserving verified MusicBrainz queries.

Changes:

  • Adds missing prefixes and updates APSearch wording and result columns.
  • Documents catalogued creation-year limitations.
  • Adds corpus, syntax, prefix, and schema regression tests.
File summaries
File Summary
llm-service/tests/test_examples.py Adds offline corpus and APSearch query validation.
llm-service/app/graph/schema_corpus.py Clarifies catalogued creation-year semantics.
llm-service/app/graph/examples.py Corrects prefixes, APSearch queries, wording, and columns.
Review details
  • Files reviewed: 3/3 changed files
  • Comments generated: 0
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

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.

2 participants