compass-kb-validation 4.0.0__tar.gz → 4.0.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {compass_kb_validation-4.0.0/compass_kb_validation.egg-info → compass_kb_validation-4.0.2}/PKG-INFO +106 -3
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/README.md +103 -2
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/compass/__init__.py +1 -1
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/compass/alias.py +8 -0
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/compass/benchmark.py +10 -3
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/compass/check_catalog.py +101 -0
- compass_kb_validation-4.0.2/compass/chunk_coherence.py +238 -0
- compass_kb_validation-4.0.2/compass/chunk_integrity.py +320 -0
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/compass/citation.py +37 -5
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/compass/cli.py +92 -30
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/compass/config/__init__.py +167 -4
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/compass/config_lint.py +45 -0
- compass_kb_validation-4.0.2/compass/content_fidelity.py +823 -0
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/compass/corpus_health.py +47 -19
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/compass/drift.py +80 -11
- compass_kb_validation-4.0.2/compass/embedding_drift.py +233 -0
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/compass/grounding.py +8 -2
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/compass/incremental.py +85 -12
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/compass/provenance.py +6 -2
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/compass/providers/__init__.py +2 -0
- compass_kb_validation-4.0.2/compass/providers/extractor.py +123 -0
- compass_kb_validation-4.0.2/compass/providers/snapshot.py +161 -0
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/compass/providers/vectorstore.py +44 -0
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/compass/readiness.py +205 -6
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/compass/remediation.py +10 -0
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/compass/report/__init__.py +27 -3
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/compass/report/grounding_report.py +5 -1
- compass_kb_validation-4.0.2/compass/text_match.py +98 -0
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/compass/validators/redis_chunks.py +200 -6
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/compass/validators/retrieval_quality.py +6 -2
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2/compass_kb_validation.egg-info}/PKG-INFO +106 -3
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/compass_kb_validation.egg-info/SOURCES.txt +10 -0
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/compass_kb_validation.egg-info/requires.txt +3 -0
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/discover_and_validate.py +91 -10
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/pyproject.toml +1 -0
- compass_kb_validation-4.0.2/tests/test_chunk_integrity.py +288 -0
- compass_kb_validation-4.0.2/tests/test_chunk_structure_checks.py +385 -0
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/tests/test_content_fidelity.py +3 -3
- compass_kb_validation-4.0.2/tests/test_coverage_and_drift_config.py +360 -0
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/tests/test_discover_cli.py +12 -6
- compass_kb_validation-4.0.2/tests/test_embedding_contract.py +224 -0
- compass_kb_validation-4.0.2/tests/test_fidelity_precision.py +476 -0
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/tests/test_grounding_rollup.py +2 -1
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/tests/test_measurement_fixes.py +4 -3
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/tests/test_readiness.py +3 -4
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/tests/test_redis_chunks.py +1 -1
- compass_kb_validation-4.0.2/tests/test_requirements_config.py +158 -0
- compass_kb_validation-4.0.2/tests/test_v402_fixes.py +282 -0
- compass_kb_validation-4.0.0/compass/chunk_coherence.py +0 -62
- compass_kb_validation-4.0.0/compass/content_fidelity.py +0 -353
- compass_kb_validation-4.0.0/compass/embedding_drift.py +0 -135
- compass_kb_validation-4.0.0/compass/text_match.py +0 -48
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/LICENSE +0 -0
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/compass/__main__.py +0 -0
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/compass/ask.py +0 -0
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/compass/baseline.py +0 -0
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/compass/chunk_eval.py +0 -0
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/compass/content_inspect.py +0 -0
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/compass/corpus.py +0 -0
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/compass/diagnostics.py +0 -0
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/compass/diff.py +0 -0
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/compass/eval_enrich.py +0 -0
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/compass/eval_interop.py +0 -0
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/compass/evidence.py +0 -0
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/compass/grounding_diff.py +0 -0
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/compass/grounding_rollup.py +0 -0
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/compass/gt_lint.py +0 -0
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/compass/health.py +0 -0
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/compass/init_wizard.py +0 -0
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/compass/lineage.py +0 -0
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/compass/live_dashboard.py +0 -0
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/compass/mcp_server.py +0 -0
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/compass/models/__init__.py +0 -0
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/compass/notifications.py +0 -0
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/compass/pipeline/__init__.py +0 -0
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/compass/profiler.py +0 -0
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/compass/providers/embedding.py +0 -0
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/compass/providers/graph.py +0 -0
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/compass/providers/source.py +0 -0
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/compass/providers/storage.py +0 -0
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/compass/quality_gate.py +0 -0
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/compass/report/_report_css.py +0 -0
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/compass/report/_report_js.py +0 -0
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/compass/report/analysis.py +0 -0
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/compass/report/audit.py +0 -0
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/compass/report/export.py +0 -0
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/compass/report/shell.py +0 -0
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/compass/retrieval_analysis.py +0 -0
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/compass/simulate.py +0 -0
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/compass/text_probes.py +0 -0
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/compass/trend_tracker.py +0 -0
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/compass/utils/__init__.py +0 -0
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/compass/validators/__init__.py +0 -0
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/compass/validators/api_upload.py +0 -0
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/compass/validators/base.py +0 -0
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/compass/validators/base_sparql.py +0 -0
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/compass/validators/cross_stage.py +0 -0
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/compass/validators/graphdb_metadata.py +0 -0
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/compass/validators/neptune_metadata.py +0 -0
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/compass/validators/registry.py +0 -0
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/compass/validators/s3_storage.py +0 -0
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/compass_kb_validation.egg-info/dependency_links.txt +0 -0
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/compass_kb_validation.egg-info/entry_points.txt +0 -0
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/compass_kb_validation.egg-info/top_level.txt +0 -0
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/ingestion_validation/__init__.py +0 -0
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/profile_kb.py +0 -0
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/run_validation.py +0 -0
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/setup.cfg +0 -0
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/tests/test_alias.py +0 -0
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/tests/test_alias_disambiguation.py +0 -0
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/tests/test_alias_temporal.py +0 -0
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/tests/test_alt_adapters.py +0 -0
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/tests/test_analysis_report.py +0 -0
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/tests/test_api_upload.py +0 -0
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/tests/test_ask.py +0 -0
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/tests/test_baseline.py +0 -0
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/tests/test_benchmark.py +0 -0
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/tests/test_calibrate_truth.py +0 -0
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/tests/test_check_catalog.py +0 -0
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/tests/test_chunk_eval.py +0 -0
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/tests/test_citation.py +0 -0
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/tests/test_citation_levels.py +0 -0
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/tests/test_cli.py +0 -0
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/tests/test_cli_commands.py +0 -0
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/tests/test_compat_shim.py +0 -0
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/tests/test_config.py +0 -0
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/tests/test_config_lint.py +0 -0
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/tests/test_content_inspect.py +0 -0
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/tests/test_corpus.py +0 -0
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/tests/test_corpus_health.py +0 -0
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/tests/test_coverage.py +0 -0
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/tests/test_cross_stage.py +0 -0
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/tests/test_diagnostics.py +0 -0
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/tests/test_diff.py +0 -0
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/tests/test_discovery_parallel.py +0 -0
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/tests/test_drift.py +0 -0
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/tests/test_embedding_drift.py +0 -0
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/tests/test_eval_enrich.py +0 -0
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/tests/test_eval_interop.py +0 -0
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/tests/test_evidence.py +0 -0
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/tests/test_gate.py +0 -0
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/tests/test_graph_transport.py +0 -0
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/tests/test_graph_validators.py +0 -0
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/tests/test_grounding.py +0 -0
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/tests/test_grounding_report.py +0 -0
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/tests/test_health.py +0 -0
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/tests/test_incremental.py +0 -0
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/tests/test_init_wizard.py +0 -0
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/tests/test_lineage.py +0 -0
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/tests/test_manifest.py +0 -0
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/tests/test_mcp.py +0 -0
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/tests/test_migration.py +0 -0
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/tests/test_models.py +0 -0
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/tests/test_multi_index.py +0 -0
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/tests/test_neptune_bugfixes.py +0 -0
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/tests/test_neptune_bugfixes2.py +0 -0
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/tests/test_notifications.py +0 -0
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/tests/test_pipeline.py +0 -0
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/tests/test_profiler.py +0 -0
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/tests/test_providers.py +0 -0
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/tests/test_quality_gate.py +0 -0
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/tests/test_registry.py +0 -0
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/tests/test_remediation.py +0 -0
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/tests/test_report_store_section.py +0 -0
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/tests/test_reporting.py +0 -0
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/tests/test_retrieval_assertions.py +0 -0
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/tests/test_retrieval_fields.py +0 -0
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/tests/test_retrieval_quality.py +0 -0
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/tests/test_review_hardening.py +0 -0
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/tests/test_run_cli.py +0 -0
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/tests/test_simulate.py +0 -0
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/tests/test_source_exclusions.py +0 -0
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/tests/test_source_verification.py +0 -0
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/tests/test_sources.py +0 -0
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/tests/test_storage_validator.py +0 -0
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/tests/test_trends.py +0 -0
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/tests/test_universal_concerns.py +0 -0
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/tests/test_utils.py +0 -0
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/tests/test_v4_defect_fixes.py +0 -0
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/tests/test_vector_fastpath.py +0 -0
- {compass_kb_validation-4.0.0 → compass_kb_validation-4.0.2}/tests/test_vectorstore_filters.py +0 -0
{compass_kb_validation-4.0.0/compass_kb_validation.egg-info → compass_kb_validation-4.0.2}/PKG-INFO
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: compass-kb-validation
|
|
3
|
-
Version: 4.0.
|
|
3
|
+
Version: 4.0.2
|
|
4
4
|
Summary: Knowledge-base readiness validation for RAG & AI agents — config-driven, deterministic pipeline integrity checks.
|
|
5
5
|
Author: COMPASS
|
|
6
6
|
License: MIT
|
|
@@ -27,6 +27,8 @@ Requires-Dist: fastapi>=0.104.0; extra == "dashboard"
|
|
|
27
27
|
Requires-Dist: uvicorn>=0.24.0; extra == "dashboard"
|
|
28
28
|
Provides-Extra: pdf
|
|
29
29
|
Requires-Dist: PyPDF2>=3.0.0; extra == "pdf"
|
|
30
|
+
Provides-Extra: pdf-layout
|
|
31
|
+
Requires-Dist: pymupdf>=1.24; extra == "pdf-layout"
|
|
30
32
|
Provides-Extra: content
|
|
31
33
|
Requires-Dist: beautifulsoup4>=4.9.0; extra == "content"
|
|
32
34
|
Provides-Extra: perf
|
|
@@ -279,6 +281,11 @@ compass grounding-audit --project my-kb --eval-results eval.json --check-aliases
|
|
|
279
281
|
# hit rate. No LLM: a chunk is relevant because the ground truth says so.
|
|
280
282
|
compass benchmark --project my-kb --input eval.json
|
|
281
283
|
|
|
284
|
+
# Did the source content reach the store? Compares each document with its chunks: body text
|
|
285
|
+
# coverage, per-page coverage and numbers, with the passages behind every finding. See
|
|
286
|
+
# "Source fidelity" below. Report-only unless --fail-on-findings.
|
|
287
|
+
compass fidelity --project my-kb --sample 25 --format html --output reports/fidelity.html
|
|
288
|
+
|
|
282
289
|
# Is the re-ingested index better? Scores one eval against two ALREADY-BUILT indices and says
|
|
283
290
|
# which won on NDCG and on recall. Nothing is re-embedded. Warns when the indices were chunked
|
|
284
291
|
# differently, because document + page matching is then invalid (use --match content).
|
|
@@ -292,7 +299,7 @@ compass chunk-eval --project my-kb --sample 50 --strategy fixed:3000/200 --strat
|
|
|
292
299
|
|
|
293
300
|
# One verdict for the whole KB, composed from artifacts the commands above already wrote. See
|
|
294
301
|
# "KB readiness" below. No live connections. Exit 0 READY, 1 otherwise, 2 bad input.
|
|
295
|
-
compass readiness --
|
|
302
|
+
compass readiness --project my-kb # finds reports/my-kb-<stage>.json; or name each with a flag
|
|
296
303
|
# Do two environments hold the same KB? Documents missing either way, schema, e_tags that
|
|
297
304
|
# differ, pollution patterns, stale versions. Exits 0 no drift, 1 drift, 2 config error or could
|
|
298
305
|
# not compare: an environment that cannot be read is never reported as "no drift".
|
|
@@ -312,15 +319,86 @@ compass diff --project my-kb # or: --baseline run-a.json --current ru
|
|
|
312
319
|
compass discover --project my-kb --since last-run
|
|
313
320
|
```
|
|
314
321
|
|
|
322
|
+
## Source fidelity
|
|
323
|
+
|
|
324
|
+
`compass fidelity` compares two extractions of a document, so it has to tell extraction noise from
|
|
325
|
+
loss. Both sides are normalised (Unicode, ligatures, hyphenation, markup, and spacing, including
|
|
326
|
+
gaps inside words), tables are judged by their numbers, and every exclusion is counted. Install a
|
|
327
|
+
better text layer with `pip install "compass-kb-validation[pdf-layout]"`, or `[pdf]` for the
|
|
328
|
+
lower-bound default.
|
|
329
|
+
|
|
330
|
+
Start report-only, and list what your pipeline drops on purpose until only real findings remain:
|
|
331
|
+
|
|
332
|
+
```yaml
|
|
333
|
+
eval:
|
|
334
|
+
citation_source_key_fields: ["s3_key"] # chunk field holding the source object key
|
|
335
|
+
source_extractor: auto # auto | pymupdf | pdfplumber | pypdf | pdf_text
|
|
336
|
+
fidelity:
|
|
337
|
+
text_field: text # index field holding chunk text (not the eval file's)
|
|
338
|
+
normalization: aggressive # minimal | standard | aggressive
|
|
339
|
+
match: shingle # shingle | exact
|
|
340
|
+
coverage_min: {default: 0.90, quarterly: 0.97} # keyed by document_type
|
|
341
|
+
prefer_snapshot: true
|
|
342
|
+
source_exclusions: # nothing is excluded that is not listed here
|
|
343
|
+
repeated_on_pages: 5 # headers and footers
|
|
344
|
+
min_chars: 75 # small fragments
|
|
345
|
+
patterns: ["(?i)^past performance"] # by-design notices
|
|
346
|
+
page_roles: {disclaimer: "(?i)^important disclosures"}
|
|
347
|
+
roles: [marginalia, logo, attestation] # read from a snapshot, so they need one
|
|
348
|
+
must_retain: ["material change"] # overrides every exclusion; missing is a loss
|
|
349
|
+
```
|
|
350
|
+
|
|
351
|
+
`fidelity` also runs the other way, chunk by chunk, and each chunk that does not trace is reported
|
|
352
|
+
by id: `WRONG_PAGE`, `ALTERED`, `TRUNCATED`, `OUT_OF_ORDER`, `UNTRACEABLE`, or `UNVERIFIABLE` where
|
|
353
|
+
the source has pages with no text layer. A consistent page shift is reported once. Tune it with
|
|
354
|
+
`eval.fidelity.page_tolerance` (default 1), `page_field`, `page_end_field` and `position_field`, or
|
|
355
|
+
turn it off with `chunk_integrity: false`.
|
|
356
|
+
|
|
357
|
+
Two outcomes are setup faults, never losses. A document whose chunks have no text in
|
|
358
|
+
`eval.fidelity.text_field` is not comparable, and the reason names the fields that do hold text.
|
|
359
|
+
A document where not one chunk traces to its source is `SOURCE_MISMATCH`: either the field or the
|
|
360
|
+
source key is wrong, or the store holds another document's text under that id. Neither is averaged
|
|
361
|
+
into coverage as a 0%. A snapshot that cannot be found is reported with the key it was looked for at.
|
|
362
|
+
|
|
363
|
+
Findings say what is missing, not who lost it, until you declare the extractor's own output. Any
|
|
364
|
+
extractor that writes JSON works: map its fields once, and each finding becomes `PIPELINE_DROP`,
|
|
365
|
+
`PIPELINE_ALTER` or `EXTRACTOR_MISS`.
|
|
366
|
+
|
|
367
|
+
```yaml
|
|
368
|
+
eval:
|
|
369
|
+
snapshot:
|
|
370
|
+
provider: storage_json
|
|
371
|
+
location: "snapshots/{project}/{id}/{e_tag}/document.json" # also {source_key}
|
|
372
|
+
format: my_extractor
|
|
373
|
+
formats:
|
|
374
|
+
my_extractor: # dotted paths into the extractor's JSON
|
|
375
|
+
elements: "sections"
|
|
376
|
+
type: "kind"
|
|
377
|
+
text: "text"
|
|
378
|
+
page: "page"
|
|
379
|
+
bbox: "box"
|
|
380
|
+
cells: "table.cells"
|
|
381
|
+
order: "reading_order"
|
|
382
|
+
```
|
|
383
|
+
|
|
315
384
|
### KB readiness
|
|
316
385
|
|
|
317
386
|
`compass readiness --discover D.json [--grounding G.json] [--benchmark B.json] [--drift X.json]
|
|
318
387
|
[--project P] [--format console|json|html] [--output F]` reads JSON the other commands wrote and
|
|
319
388
|
returns READY, AT RISK or NOT READY, with a stage and an owner (ingestion, retrieval config,
|
|
320
389
|
generator) for every finding. A stage whose artifact is absent, or which measured nothing, is
|
|
321
|
-
**not examined** and caps the verdict at AT RISK: never READY by omission.
|
|
390
|
+
**not examined** and caps the verdict at AT RISK: never READY by omission. With `--project`, a stage
|
|
391
|
+
no flag names is read from `readiness.artifacts` (`{stage: path}`), then from
|
|
392
|
+
`reports/<project>-discovery-report.json` and `reports/<project>-<stage>.json` for `benchmark`,
|
|
393
|
+
`grounding`, `drift` and `fidelity`. A stage still missing names the command that writes it. `gate` means NOT READY,
|
|
322
394
|
`risk` means AT RISK, `advisory` is reported and changes nothing.
|
|
323
395
|
|
|
396
|
+
Every verdict carries `verified` / `unverifiable` / `not-checked` counts, and `discover` prints and
|
|
397
|
+
exports the same block (`coverage` in the JSON). `unverifiable` means it was attempted and could not
|
|
398
|
+
be compared, with the reason; `not-checked` means nobody tried. A fidelity comparison that never ran
|
|
399
|
+
reads `content-fidelity: not-checked`, under a READY too when the stage is waived. This is reporting:
|
|
400
|
+
it changes no verdict.
|
|
401
|
+
|
|
324
402
|
| Finding | Default | Owner |
|
|
325
403
|
|---------|---------|-------|
|
|
326
404
|
| `corpus_not_ready` | gate | ingestion |
|
|
@@ -342,6 +420,9 @@ generator) for every finding. A stage whose artifact is absent, or which measure
|
|
|
342
420
|
| `drift_detected` | risk | ingestion |
|
|
343
421
|
| `fidelity_content_loss` | advisory | ingestion |
|
|
344
422
|
| `fidelity_numbers_missing` | advisory | ingestion |
|
|
423
|
+
| `fidelity_value_drift` | advisory | ingestion |
|
|
424
|
+
| `fidelity_source_mismatch` | risk | ingestion |
|
|
425
|
+
| `chunk_integrity_findings` | advisory | ingestion |
|
|
345
426
|
| `stale_versions`, `stale_versions_unchecked` | advisory | ingestion |
|
|
346
427
|
| `documents_within_threshold` | advisory | ingestion |
|
|
347
428
|
| `grounding_direction_mismatch` (word-adjacency heuristic) | advisory | generator |
|
|
@@ -516,6 +597,28 @@ environments:
|
|
|
516
597
|
expected_distance_metric: COSINE
|
|
517
598
|
```
|
|
518
599
|
|
|
600
|
+
`redis.chunking_strategy` selects the chunk checks. Under anything but `fixed`, size-derived checks
|
|
601
|
+
stop applying and advisory checks take over: fragmentation, summary presence, `element_integrity`
|
|
602
|
+
(a chunk holding part of a table, list or code block), `boundary_on_structure` (a boundary inside
|
|
603
|
+
one, which needs a positional field) and `cap_truncation` (a chunk at `max_chunk_size` that ends
|
|
604
|
+
inside one). A structure continuing onto the next page, a mid-sentence end and a heading left at a
|
|
605
|
+
chunk's tail are how layout chunkers work, and are not counted. The strategy comes from the chunks
|
|
606
|
+
when `redis.chunker_field` and `chunker_strategy_map` are set, else from `chunking_strategy`. A
|
|
607
|
+
project that declares neither is scored exactly as before: where the chunks are clearly not
|
|
608
|
+
fixed-size and carry a summary or markdown structure, the structural rows appear marked `inferred`,
|
|
609
|
+
with their evidence, and are never scored.
|
|
610
|
+
|
|
611
|
+
`embedding.input_fields`, `input_joiner` and `input_truncation` declare what the pipeline embeds, so
|
|
612
|
+
the embedding probes re-embed that and nothing else. `embedding.sync_check` (off by default) has
|
|
613
|
+
`discover` re-embed a sample and name chunks whose vector does not match; a chunk missing a declared
|
|
614
|
+
field is unverifiable, not out of sync, and `tokens:N` truncation is reported, never estimated.
|
|
615
|
+
|
|
616
|
+
`discover --since` re-validates a document when its ETag, its chunk count, or (where the store can
|
|
617
|
+
list them in one aggregation: Redis today) its chunk ids or `redis.chunker_version_field` value
|
|
618
|
+
changed. The id hash is over sorted ids, so it sees a changed set rather than a reordering, and ids
|
|
619
|
+
built from document + position do not change under a same-count re-chunk: point
|
|
620
|
+
`redis.chunk_id_field` at a content hash if the pipeline stores one.
|
|
621
|
+
|
|
519
622
|
## Advanced Usage
|
|
520
623
|
|
|
521
624
|
### Add a custom pipeline step
|
|
@@ -208,6 +208,11 @@ compass grounding-audit --project my-kb --eval-results eval.json --check-aliases
|
|
|
208
208
|
# hit rate. No LLM: a chunk is relevant because the ground truth says so.
|
|
209
209
|
compass benchmark --project my-kb --input eval.json
|
|
210
210
|
|
|
211
|
+
# Did the source content reach the store? Compares each document with its chunks: body text
|
|
212
|
+
# coverage, per-page coverage and numbers, with the passages behind every finding. See
|
|
213
|
+
# "Source fidelity" below. Report-only unless --fail-on-findings.
|
|
214
|
+
compass fidelity --project my-kb --sample 25 --format html --output reports/fidelity.html
|
|
215
|
+
|
|
211
216
|
# Is the re-ingested index better? Scores one eval against two ALREADY-BUILT indices and says
|
|
212
217
|
# which won on NDCG and on recall. Nothing is re-embedded. Warns when the indices were chunked
|
|
213
218
|
# differently, because document + page matching is then invalid (use --match content).
|
|
@@ -221,7 +226,7 @@ compass chunk-eval --project my-kb --sample 50 --strategy fixed:3000/200 --strat
|
|
|
221
226
|
|
|
222
227
|
# One verdict for the whole KB, composed from artifacts the commands above already wrote. See
|
|
223
228
|
# "KB readiness" below. No live connections. Exit 0 READY, 1 otherwise, 2 bad input.
|
|
224
|
-
compass readiness --
|
|
229
|
+
compass readiness --project my-kb # finds reports/my-kb-<stage>.json; or name each with a flag
|
|
225
230
|
# Do two environments hold the same KB? Documents missing either way, schema, e_tags that
|
|
226
231
|
# differ, pollution patterns, stale versions. Exits 0 no drift, 1 drift, 2 config error or could
|
|
227
232
|
# not compare: an environment that cannot be read is never reported as "no drift".
|
|
@@ -241,15 +246,86 @@ compass diff --project my-kb # or: --baseline run-a.json --current ru
|
|
|
241
246
|
compass discover --project my-kb --since last-run
|
|
242
247
|
```
|
|
243
248
|
|
|
249
|
+
## Source fidelity
|
|
250
|
+
|
|
251
|
+
`compass fidelity` compares two extractions of a document, so it has to tell extraction noise from
|
|
252
|
+
loss. Both sides are normalised (Unicode, ligatures, hyphenation, markup, and spacing, including
|
|
253
|
+
gaps inside words), tables are judged by their numbers, and every exclusion is counted. Install a
|
|
254
|
+
better text layer with `pip install "compass-kb-validation[pdf-layout]"`, or `[pdf]` for the
|
|
255
|
+
lower-bound default.
|
|
256
|
+
|
|
257
|
+
Start report-only, and list what your pipeline drops on purpose until only real findings remain:
|
|
258
|
+
|
|
259
|
+
```yaml
|
|
260
|
+
eval:
|
|
261
|
+
citation_source_key_fields: ["s3_key"] # chunk field holding the source object key
|
|
262
|
+
source_extractor: auto # auto | pymupdf | pdfplumber | pypdf | pdf_text
|
|
263
|
+
fidelity:
|
|
264
|
+
text_field: text # index field holding chunk text (not the eval file's)
|
|
265
|
+
normalization: aggressive # minimal | standard | aggressive
|
|
266
|
+
match: shingle # shingle | exact
|
|
267
|
+
coverage_min: {default: 0.90, quarterly: 0.97} # keyed by document_type
|
|
268
|
+
prefer_snapshot: true
|
|
269
|
+
source_exclusions: # nothing is excluded that is not listed here
|
|
270
|
+
repeated_on_pages: 5 # headers and footers
|
|
271
|
+
min_chars: 75 # small fragments
|
|
272
|
+
patterns: ["(?i)^past performance"] # by-design notices
|
|
273
|
+
page_roles: {disclaimer: "(?i)^important disclosures"}
|
|
274
|
+
roles: [marginalia, logo, attestation] # read from a snapshot, so they need one
|
|
275
|
+
must_retain: ["material change"] # overrides every exclusion; missing is a loss
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
`fidelity` also runs the other way, chunk by chunk, and each chunk that does not trace is reported
|
|
279
|
+
by id: `WRONG_PAGE`, `ALTERED`, `TRUNCATED`, `OUT_OF_ORDER`, `UNTRACEABLE`, or `UNVERIFIABLE` where
|
|
280
|
+
the source has pages with no text layer. A consistent page shift is reported once. Tune it with
|
|
281
|
+
`eval.fidelity.page_tolerance` (default 1), `page_field`, `page_end_field` and `position_field`, or
|
|
282
|
+
turn it off with `chunk_integrity: false`.
|
|
283
|
+
|
|
284
|
+
Two outcomes are setup faults, never losses. A document whose chunks have no text in
|
|
285
|
+
`eval.fidelity.text_field` is not comparable, and the reason names the fields that do hold text.
|
|
286
|
+
A document where not one chunk traces to its source is `SOURCE_MISMATCH`: either the field or the
|
|
287
|
+
source key is wrong, or the store holds another document's text under that id. Neither is averaged
|
|
288
|
+
into coverage as a 0%. A snapshot that cannot be found is reported with the key it was looked for at.
|
|
289
|
+
|
|
290
|
+
Findings say what is missing, not who lost it, until you declare the extractor's own output. Any
|
|
291
|
+
extractor that writes JSON works: map its fields once, and each finding becomes `PIPELINE_DROP`,
|
|
292
|
+
`PIPELINE_ALTER` or `EXTRACTOR_MISS`.
|
|
293
|
+
|
|
294
|
+
```yaml
|
|
295
|
+
eval:
|
|
296
|
+
snapshot:
|
|
297
|
+
provider: storage_json
|
|
298
|
+
location: "snapshots/{project}/{id}/{e_tag}/document.json" # also {source_key}
|
|
299
|
+
format: my_extractor
|
|
300
|
+
formats:
|
|
301
|
+
my_extractor: # dotted paths into the extractor's JSON
|
|
302
|
+
elements: "sections"
|
|
303
|
+
type: "kind"
|
|
304
|
+
text: "text"
|
|
305
|
+
page: "page"
|
|
306
|
+
bbox: "box"
|
|
307
|
+
cells: "table.cells"
|
|
308
|
+
order: "reading_order"
|
|
309
|
+
```
|
|
310
|
+
|
|
244
311
|
### KB readiness
|
|
245
312
|
|
|
246
313
|
`compass readiness --discover D.json [--grounding G.json] [--benchmark B.json] [--drift X.json]
|
|
247
314
|
[--project P] [--format console|json|html] [--output F]` reads JSON the other commands wrote and
|
|
248
315
|
returns READY, AT RISK or NOT READY, with a stage and an owner (ingestion, retrieval config,
|
|
249
316
|
generator) for every finding. A stage whose artifact is absent, or which measured nothing, is
|
|
250
|
-
**not examined** and caps the verdict at AT RISK: never READY by omission.
|
|
317
|
+
**not examined** and caps the verdict at AT RISK: never READY by omission. With `--project`, a stage
|
|
318
|
+
no flag names is read from `readiness.artifacts` (`{stage: path}`), then from
|
|
319
|
+
`reports/<project>-discovery-report.json` and `reports/<project>-<stage>.json` for `benchmark`,
|
|
320
|
+
`grounding`, `drift` and `fidelity`. A stage still missing names the command that writes it. `gate` means NOT READY,
|
|
251
321
|
`risk` means AT RISK, `advisory` is reported and changes nothing.
|
|
252
322
|
|
|
323
|
+
Every verdict carries `verified` / `unverifiable` / `not-checked` counts, and `discover` prints and
|
|
324
|
+
exports the same block (`coverage` in the JSON). `unverifiable` means it was attempted and could not
|
|
325
|
+
be compared, with the reason; `not-checked` means nobody tried. A fidelity comparison that never ran
|
|
326
|
+
reads `content-fidelity: not-checked`, under a READY too when the stage is waived. This is reporting:
|
|
327
|
+
it changes no verdict.
|
|
328
|
+
|
|
253
329
|
| Finding | Default | Owner |
|
|
254
330
|
|---------|---------|-------|
|
|
255
331
|
| `corpus_not_ready` | gate | ingestion |
|
|
@@ -271,6 +347,9 @@ generator) for every finding. A stage whose artifact is absent, or which measure
|
|
|
271
347
|
| `drift_detected` | risk | ingestion |
|
|
272
348
|
| `fidelity_content_loss` | advisory | ingestion |
|
|
273
349
|
| `fidelity_numbers_missing` | advisory | ingestion |
|
|
350
|
+
| `fidelity_value_drift` | advisory | ingestion |
|
|
351
|
+
| `fidelity_source_mismatch` | risk | ingestion |
|
|
352
|
+
| `chunk_integrity_findings` | advisory | ingestion |
|
|
274
353
|
| `stale_versions`, `stale_versions_unchecked` | advisory | ingestion |
|
|
275
354
|
| `documents_within_threshold` | advisory | ingestion |
|
|
276
355
|
| `grounding_direction_mismatch` (word-adjacency heuristic) | advisory | generator |
|
|
@@ -445,6 +524,28 @@ environments:
|
|
|
445
524
|
expected_distance_metric: COSINE
|
|
446
525
|
```
|
|
447
526
|
|
|
527
|
+
`redis.chunking_strategy` selects the chunk checks. Under anything but `fixed`, size-derived checks
|
|
528
|
+
stop applying and advisory checks take over: fragmentation, summary presence, `element_integrity`
|
|
529
|
+
(a chunk holding part of a table, list or code block), `boundary_on_structure` (a boundary inside
|
|
530
|
+
one, which needs a positional field) and `cap_truncation` (a chunk at `max_chunk_size` that ends
|
|
531
|
+
inside one). A structure continuing onto the next page, a mid-sentence end and a heading left at a
|
|
532
|
+
chunk's tail are how layout chunkers work, and are not counted. The strategy comes from the chunks
|
|
533
|
+
when `redis.chunker_field` and `chunker_strategy_map` are set, else from `chunking_strategy`. A
|
|
534
|
+
project that declares neither is scored exactly as before: where the chunks are clearly not
|
|
535
|
+
fixed-size and carry a summary or markdown structure, the structural rows appear marked `inferred`,
|
|
536
|
+
with their evidence, and are never scored.
|
|
537
|
+
|
|
538
|
+
`embedding.input_fields`, `input_joiner` and `input_truncation` declare what the pipeline embeds, so
|
|
539
|
+
the embedding probes re-embed that and nothing else. `embedding.sync_check` (off by default) has
|
|
540
|
+
`discover` re-embed a sample and name chunks whose vector does not match; a chunk missing a declared
|
|
541
|
+
field is unverifiable, not out of sync, and `tokens:N` truncation is reported, never estimated.
|
|
542
|
+
|
|
543
|
+
`discover --since` re-validates a document when its ETag, its chunk count, or (where the store can
|
|
544
|
+
list them in one aggregation: Redis today) its chunk ids or `redis.chunker_version_field` value
|
|
545
|
+
changed. The id hash is over sorted ids, so it sees a changed set rather than a reordering, and ids
|
|
546
|
+
built from document + position do not change under a same-count re-chunk: point
|
|
547
|
+
`redis.chunk_id_field` at a content hash if the pipeline stores one.
|
|
548
|
+
|
|
448
549
|
## Advanced Usage
|
|
449
550
|
|
|
450
551
|
### Add a custom pipeline step
|
|
@@ -252,6 +252,7 @@ class AliasMap:
|
|
|
252
252
|
#: single document counts as two owners of a key and reads as ambiguous against itself.
|
|
253
253
|
same_doc: dict[str, str] = field(default_factory=dict)
|
|
254
254
|
configured: dict[str, str] = field(default_factory=dict)
|
|
255
|
+
dangling: list[str] = field(default_factory=list) # configured keys whose target is absent
|
|
255
256
|
source: str = "auto"
|
|
256
257
|
note: str = ""
|
|
257
258
|
|
|
@@ -423,6 +424,13 @@ def build_alias_map(adapter: Any, fields: list[str], configured: Optional[dict]
|
|
|
423
424
|
+ (f"; {len(amap.series)} name(s) are shared by several documents and treated "
|
|
424
425
|
"as a series" if amap.series else "")
|
|
425
426
|
+ (f"; {ambiguous} key(s) are ambiguous and will not resolve" if ambiguous else ""))
|
|
427
|
+
# A configured alias wins outright, so one pointing at a name the KB does not have cannot be
|
|
428
|
+
# recovered by anything after it: every citation using it looks up nothing.
|
|
429
|
+
dangling = sorted(k for k, v in amap.configured.items() if str(v).strip().lower() not in seen)
|
|
430
|
+
if dangling:
|
|
431
|
+
amap.dangling = dangling
|
|
432
|
+
amap.note += (f"; {len(dangling)} configured alias(es) name no KB document exactly: "
|
|
433
|
+
+ ", ".join(dangling[:5]))
|
|
426
434
|
return amap
|
|
427
435
|
|
|
428
436
|
|
|
@@ -371,8 +371,8 @@ def benchmark(settings: Any, cases: list[dict], strategies: list[Strategy], *,
|
|
|
371
371
|
result = score_one(retrieved, relevant, strategy.effective_k)
|
|
372
372
|
for metric, value in result.items():
|
|
373
373
|
scores[metric].append(value)
|
|
374
|
-
per_query.setdefault(cid, {"question": question,
|
|
375
|
-
"
|
|
374
|
+
per_query.setdefault(cid, {"question": question, "ground_truth": len(relevant),
|
|
375
|
+
"filtered": bool(filters)})[strategy.name] = {
|
|
376
376
|
"found": len([r for r in retrieved[:strategy.effective_k] if r in relevant]),
|
|
377
377
|
"recall": result["recall"], "mrr": result["mrr"]}
|
|
378
378
|
if errors and len(errors) == len(usable):
|
|
@@ -388,6 +388,10 @@ def benchmark(settings: Any, cases: list[dict], strategies: list[Strategy], *,
|
|
|
388
388
|
})
|
|
389
389
|
|
|
390
390
|
filtered = sum(1 for row in usable if row[3])
|
|
391
|
+
# Named, not just counted: an unfiltered case scores against the whole corpus, so one of
|
|
392
|
+
# them can move the mean on its own and the reader needs to know which.
|
|
393
|
+
unfiltered = [str(row[0].get("case_id") or row[0].get("test_id") or row[1][:40])
|
|
394
|
+
for row in usable if not row[3]]
|
|
391
395
|
scored = [s for s in per_strategy if not s.get("skipped")]
|
|
392
396
|
def rank(row: dict) -> tuple:
|
|
393
397
|
return (row.get("ndcg") or 0, row.get("recall") or 0)
|
|
@@ -407,6 +411,7 @@ def benchmark(settings: Any, cases: list[dict], strategies: list[Strategy], *,
|
|
|
407
411
|
"none-recorded" if not filtered else
|
|
408
412
|
"per-case" if filtered == len(usable) else "partial"),
|
|
409
413
|
"filtered_cases": filtered,
|
|
414
|
+
"unfiltered_cases": unfiltered if use_case_filters and filtered else [],
|
|
410
415
|
"match_mode": f"content ({MATCH_VERSION}, containment>={min_containment:g})"
|
|
411
416
|
if by_content else "page",
|
|
412
417
|
"method": ("binary-relevance IR metrics against the eval's own ground-truth chunks, "
|
|
@@ -508,8 +513,10 @@ def _filter_line(report: dict) -> str:
|
|
|
508
513
|
if mode == "per-case":
|
|
509
514
|
return f"Filters: each case's recorded filters applied ({n}/{total} cases)."
|
|
510
515
|
if mode == "partial":
|
|
516
|
+
names = report.get("unfiltered_cases") or []
|
|
517
|
+
shown = ", ".join(names[:5]) + (" ..." if len(names) > 5 else "")
|
|
511
518
|
return (f"Filters: recorded filters applied to {n}/{total} cases; the other "
|
|
512
|
-
f"{total - n} ran UNFILTERED.")
|
|
519
|
+
f"{total - n} ran UNFILTERED" + (f" ({shown})" if shown else "") + ".")
|
|
513
520
|
if mode == "disabled":
|
|
514
521
|
return ("Filters: UNFILTERED by request. If production filters, this understates what "
|
|
515
522
|
"production retrieves.")
|
|
@@ -257,6 +257,23 @@ _TEXT: dict[str, dict[str, tuple[str, str, str]]] = {
|
|
|
257
257
|
"The configured summary field is populated and is not a copy of the chunk text.",
|
|
258
258
|
"Layout chunks rely on the summary for standalone context, so a blank one loses it.",
|
|
259
259
|
"Check the step that writes summaries, or clear the setting if this index has none."),
|
|
260
|
+
"element_integrity": (
|
|
261
|
+
"Under non-fixed chunking, whether a chunk holds only part of a table, list or code "
|
|
262
|
+
"block. A chunk that is merely short is not counted.",
|
|
263
|
+
"A broken element retrieves badly and reads as damaged. A structure continuing onto "
|
|
264
|
+
"the next page is by design for layout chunkers and is not counted.",
|
|
265
|
+
"Keep elements whole in the chunker, or raise the size cap for them."),
|
|
266
|
+
"boundary_on_structure": (
|
|
267
|
+
"Under non-fixed chunking, whether interior chunk boundaries fall on a seam between "
|
|
268
|
+
"elements rather than inside one. Needs a positional field.",
|
|
269
|
+
"The boundary divides a table, list item or code block, so neither side reads whole. "
|
|
270
|
+
"A mid-sentence end, or a heading left at a chunk's tail, is not counted.",
|
|
271
|
+
"Check how the chunker splits long elements; repeating a table's header helps."),
|
|
272
|
+
"cap_truncation": (
|
|
273
|
+
"Whether a chunk at the declared size cap also ends inside a table, list or code block.",
|
|
274
|
+
"The size cap, not the document's structure, ended this chunk, so the element was "
|
|
275
|
+
"cut off there.",
|
|
276
|
+
"Raise the cap, or make the chunker split long elements at row or item boundaries."),
|
|
260
277
|
"custom_field_rule": (
|
|
261
278
|
"A project-declared rule over one chunk field.",
|
|
262
279
|
"Chunks violate a rule this project wrote for its own data.",
|
|
@@ -381,6 +398,14 @@ _TEXT: dict[str, dict[str, tuple[str, str, str]]] = {
|
|
|
381
398
|
"Stored vectors match the declared embedding model.",
|
|
382
399
|
"Queries and stored vectors come from different models, so retrieval is silently wrong.",
|
|
383
400
|
"Re-embed with the declared model, or correct the declared model."),
|
|
401
|
+
"embedding_sync": (
|
|
402
|
+
"A sample of stored vectors re-embedded from exactly embedding.input_fields, one "
|
|
403
|
+
"chunk at a time.",
|
|
404
|
+
"A vector was computed from different text than the chunk stores, so it retrieves "
|
|
405
|
+
"on content the chunk no longer holds. A chunk missing a declared field is "
|
|
406
|
+
"unverifiable, not out of sync.",
|
|
407
|
+
"Re-embed the listed chunks. If every chunk is listed, check the declared input "
|
|
408
|
+
"fields, joiner and truncation first."),
|
|
384
409
|
"provenance": (
|
|
385
410
|
"Chunk text appears in the source object it cites.",
|
|
386
411
|
"The chunk may be attributed to the wrong source.",
|
|
@@ -447,6 +472,56 @@ _TEXT: dict[str, dict[str, tuple[str, str, str]]] = {
|
|
|
447
472
|
"Not a fault. The value was left out of the KB by a stated design decision.",
|
|
448
473
|
"Review the per-rule counts periodically; a rule that is too broad can hide real loss."),
|
|
449
474
|
},
|
|
475
|
+
"fidelity": {
|
|
476
|
+
"content_loss": (
|
|
477
|
+
"How much of a document's body text is found in its stored chunks.",
|
|
478
|
+
"Source content is not in the store. Retrieval tuning cannot surface it.",
|
|
479
|
+
"Read the missing passages. Declare anything dropped by design in "
|
|
480
|
+
"eval.source_exclusions; re-ingest the rest."),
|
|
481
|
+
"numbers_missing": (
|
|
482
|
+
"Whether every figure in the source appears, unchanged, in the store.",
|
|
483
|
+
"A figure did not arrive. Check whether it was dropped or rewritten.",
|
|
484
|
+
"Compare the source line with the document's chunks, then the table conversion."),
|
|
485
|
+
"value_drift": (
|
|
486
|
+
"Whether a figure the extractor produced survived, with its row's words intact.",
|
|
487
|
+
"The row reached the store with a different value, so a step rewrote it.",
|
|
488
|
+
"Inspect the transform after extraction, usually table conversion."),
|
|
489
|
+
"source_mismatch": (
|
|
490
|
+
"Whether a document's stored text and its source are the same text at all.",
|
|
491
|
+
"Not one chunk traces to the source. The comparison reads the wrong field or file, "
|
|
492
|
+
"or the store holds another document's text under this id.",
|
|
493
|
+
"Check eval.fidelity.text_field and eval.citation_source_key_fields, then the "
|
|
494
|
+
"document's chunks."),
|
|
495
|
+
"unverifiable": (
|
|
496
|
+
"Whether a document or page has text that can be compared at all.",
|
|
497
|
+
"Nothing was concluded: an image-only page, a garbled text layer or an unreadable "
|
|
498
|
+
"source. This is not a pass and not a failure.",
|
|
499
|
+
"Try a stronger eval.source_extractor, or declare eval.snapshot."),
|
|
500
|
+
"wrong_page": (
|
|
501
|
+
"Whether a chunk's text sits on the pages the chunk states.",
|
|
502
|
+
"The text is right, but a citation built from this chunk points at the wrong page.",
|
|
503
|
+
"Check how page numbers are assigned when blocks are merged."),
|
|
504
|
+
"altered": (
|
|
505
|
+
"Whether a chunk's figures and wording match its pages in the source.",
|
|
506
|
+
"The chunk resembles the source but differs from it. A layout extractor's generated "
|
|
507
|
+
"text can also cause this.",
|
|
508
|
+
"Compare the chunk with its source page."),
|
|
509
|
+
"truncated": (
|
|
510
|
+
"Whether a chunk stopping mid-sentence continues in another chunk.",
|
|
511
|
+
"The chunk ends early and the text after it is in no chunk. Conservative by design, "
|
|
512
|
+
"so most truncation appears as content loss instead.",
|
|
513
|
+
"Check how the chunker treats its size cap."),
|
|
514
|
+
"out_of_order": (
|
|
515
|
+
"Whether chunk positions follow the source's pages.",
|
|
516
|
+
"Neighbouring chunks are not neighbouring text, which misleads anything that "
|
|
517
|
+
"reads a hit's surroundings.",
|
|
518
|
+
"Check how chunk positions are assigned."),
|
|
519
|
+
"untraceable": (
|
|
520
|
+
"Whether a chunk's wording exists in the source at all.",
|
|
521
|
+
"The chunk is not from this document: generated text, or a mix-up at ingestion.",
|
|
522
|
+
"Find where the text came from. A figure description written by an extractor is "
|
|
523
|
+
"expected here."),
|
|
524
|
+
},
|
|
450
525
|
}
|
|
451
526
|
|
|
452
527
|
#: Reported titles for grounding findings, which have no validator catalogue of their own.
|
|
@@ -461,6 +536,21 @@ _GROUNDING_TITLES = {
|
|
|
461
536
|
"excluded": ("Excluded by rule", "info"),
|
|
462
537
|
}
|
|
463
538
|
|
|
539
|
+
#: Findings of `compass fidelity`, which has no validator catalogue of its own. Advisory unless a
|
|
540
|
+
#: project asks otherwise, because thresholds belong to the team that knows its documents.
|
|
541
|
+
_FIDELITY_TITLES = {
|
|
542
|
+
"content_loss": ("Content loss", "warn"),
|
|
543
|
+
"numbers_missing": ("Numbers missing", "warn"),
|
|
544
|
+
"value_drift": ("Value drift", "warn"),
|
|
545
|
+
"source_mismatch": ("Source mismatch", "warn"),
|
|
546
|
+
"unverifiable": ("Unverifiable document or page", "info"),
|
|
547
|
+
"wrong_page": ("Chunk on the wrong page", "warn"),
|
|
548
|
+
"altered": ("Chunk altered", "warn"),
|
|
549
|
+
"truncated": ("Chunk truncated", "warn"),
|
|
550
|
+
"out_of_order": ("Chunk out of order", "warn"),
|
|
551
|
+
"untraceable": ("Chunk untraceable", "warn"),
|
|
552
|
+
}
|
|
553
|
+
|
|
464
554
|
#: Labels a check reports at run time that differ from its catalogue title. An entry ending in
|
|
465
555
|
#: "[" or a label prefix also matches the dynamic forms ("Recall@5", "Source content [pdf]: x").
|
|
466
556
|
_LABEL_ALIASES = {
|
|
@@ -517,6 +607,11 @@ def _grounding_catalog() -> list[dict]:
|
|
|
517
607
|
for i, (name, (title, sev)) in enumerate(_GROUNDING_TITLES.items(), 1)]
|
|
518
608
|
|
|
519
609
|
|
|
610
|
+
def _fidelity_catalog() -> list[dict]:
|
|
611
|
+
return [{"num": i, "name": name, "label": title, "severity": sev}
|
|
612
|
+
for i, (name, (title, sev)) in enumerate(_FIDELITY_TITLES.items(), 1)]
|
|
613
|
+
|
|
614
|
+
|
|
520
615
|
_STAGES: list[CheckStage] = [
|
|
521
616
|
CheckStage("api", "Ingestion API checks", "api.*", _api_catalog, ("API Upload",)),
|
|
522
617
|
CheckStage("storage", "Object-storage checks", "s3.checks / s3.content_type_severity",
|
|
@@ -532,6 +627,8 @@ _STAGES: list[CheckStage] = [
|
|
|
532
627
|
"consistency.check_severity", _consistency_catalog, ("Cross-Stage Consistency",)),
|
|
533
628
|
CheckStage("grounding", "Grounding-audit findings (compass grounding-audit)", "eval.*",
|
|
534
629
|
_grounding_catalog),
|
|
630
|
+
CheckStage("fidelity", "Source fidelity and chunk integrity (compass fidelity)",
|
|
631
|
+
"eval.fidelity / eval.source_exclusions", _fidelity_catalog),
|
|
535
632
|
]
|
|
536
633
|
|
|
537
634
|
_cache: Optional[list[tuple[CheckStage, list[CheckRecord]]]] = None
|
|
@@ -549,6 +646,10 @@ def _category(stage: str, title: str, steps: tuple[str, ...]) -> str:
|
|
|
549
646
|
"""The report's own category for a check, so the catalogue and a report cannot disagree."""
|
|
550
647
|
if stage == "grounding":
|
|
551
648
|
return "Grounding"
|
|
649
|
+
if stage == "fidelity":
|
|
650
|
+
# Their titles ("Chunk altered", "Value drift") match no report pattern, so every one
|
|
651
|
+
# of them read "Other" though all of them ask whether the content survived.
|
|
652
|
+
return "Content Preservation"
|
|
552
653
|
from compass.report import _categorise
|
|
553
654
|
return _categorise(title, steps[0] if steps else "")
|
|
554
655
|
|