feat: add reproducible RAG evaluation - #8
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Local evaluation
The committed report was generated with Ollama 0.32.5,
llama3.2:latest, andmxbai-embed-large:latestagainst 123 bundled reviews.RAG observations: 14 answered, 13 model abstentions, and 3 citation-validation rejections. Answer success was 0.560, abstention recall 1.000, citation validity 0.560, and the reference-term support proxy 0.520.
Artifacts:
evaluation/results/v0.2.0-ollama-0.32.5/evaluation-report.jsonevaluation/results/v0.2.0-ollama-0.32.5/README.mddocs/assets/local-ai-agent-v0.2-demo.mp4Validation
evaluation.py: 84% overallCVE-2026-45829/PYSEC-2026-311embedded-Chroma exceptionEvidence boundaries
The benchmark is scoped to the checked-in dataset, case manifest, runtime, model digests, retrieval limit, and machine recorded in the report. Known-positive relevance judgments are not exhaustive, so the semantic/BM25 comparison does not establish general retrieval superiority. Citation validity checks citation resolution against retrieved evidence; the reference-term metric is a lexical support proxy rather than claim-level factual-faithfulness evaluation.
Greptile Summary
This PR expands the bundled RAG evaluation from 4 to 30 cases (including 5 abstention cases), introduces a deterministic BM25 retrieval baseline, adds versioned JSON and Markdown report generation, and refactors evaluation metrics into well-named, backward-compatible fields. It also extracts a new
ollama_health.pymodule, adds credential-stripping for report metadata, strengthens schema validation in the loader, and wires all changes into an extended CI pipeline.evaluation.pygainsBM25Retriever,RetrievalMetrics,build_evaluation_report,write_evaluation_report, and richerEvaluationMetricsfields, replacing the four previous metrics with six differentiated scores plus backward-compatible property aliases.main.pyadds theevaluate --report-dirflow with a dedicated_ollama_report_metadatahelper that wrapsHTTPError/OSError/ResponseErrorintoValueError, fixing the previously flagged unhandled-exception path.ollama_health.pyis extracted withollama_versionandmodel_metadatahelpers;tests/test_benchmark.pyandtests/test_cli.pyare new test modules covering BM25, report generation, and the CLI evaluate path.Confidence Score: 5/5
Safe to merge; the evaluation expansion, BM25 baseline, and report-writing flow are all well-tested and the previously flagged exception-handling gap is resolved in this PR.
All six core modules have mypy coverage, 61 tests pass, and the two previously flagged issues (unhandled Ollama exceptions in main and abstain-case source_labels validation) are both fixed in this PR. The only remaining note is that the CI audit ignore list names only the CVE identifier for the known Chroma advisory, not the alternate PYSEC identifier — a low-impact robustness gap that would only surface if pip-audit changes which ID it uses to report that advisory.
Files Needing Attention: .github/workflows/ci.yml — audit ignore list covers CVE-2026-45829 but not PYSEC-2026-311.
Important Files Changed
Flowchart
%%{init: {'theme': 'neutral'}}%% flowchart TD A[evaluate command] --> B[load_reviews] B --> C[load_evaluation_cases] C --> D[_create_runtime\nvector_store + model] D --> E[run_rag_evaluation\nper-case answer_question + latency] E --> F[score_evaluation\nEvaluationMetrics] E --> G[retrieval_metrics_from_observations\nSemantic RetrievalMetrics] D --> H[run_bm25_baseline\nBM25Retriever.search per case] H --> I[retrieval_metrics_from_observations\nBM25 RetrievalMetrics] F & G & I --> J{--report-dir set?} J -- yes --> K[_ollama_report_metadata\nollama_version + model_metadata] K --> L[build_evaluation_report\nJSON dict] L --> M[write_evaluation_report\nevaluation-report.json + README.md] J -- no --> N[print metrics to stdout]Reviews (2): Last reviewed commit: "fix: harden evaluation report validation" | Re-trigger Greptile