compass-kb-validation 4.0.2__tar.gz → 4.1.0__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.2 → compass_kb_validation-4.1.0}/PKG-INFO +41 -9
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/README.md +40 -8
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/compass/__init__.py +1 -1
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/compass/alias.py +4 -1
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/compass/benchmark.py +6 -4
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/compass/check_catalog.py +13 -3
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/compass/chunk_coherence.py +65 -0
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/compass/cli.py +41 -21
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/compass/config/__init__.py +12 -2
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/compass/config_lint.py +17 -4
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/compass/content_fidelity.py +378 -41
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/compass/content_inspect.py +55 -6
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/compass/corpus_health.py +6 -2
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/compass/eval_enrich.py +7 -7
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/compass/eval_interop.py +67 -18
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/compass/evidence.py +12 -6
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/compass/grounding.py +9 -4
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/compass/lineage.py +20 -4
- compass_kb_validation-4.1.0/compass/pdf_support.py +47 -0
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/compass/provenance.py +22 -10
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/compass/providers/__init__.py +8 -1
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/compass/providers/embedding.py +30 -0
- compass_kb_validation-4.1.0/compass/providers/snapshot.py +311 -0
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/compass/providers/storage.py +158 -5
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/compass/providers/vectorstore.py +106 -6
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/compass/readiness.py +43 -4
- compass_kb_validation-4.1.0/compass/snapshot_doctor.py +212 -0
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/compass/text_probes.py +32 -2
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/compass/validators/redis_chunks.py +46 -13
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/compass/validators/retrieval_quality.py +38 -15
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/compass/validators/s3_storage.py +24 -9
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/compass_kb_validation.egg-info/PKG-INFO +41 -9
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/compass_kb_validation.egg-info/SOURCES.txt +5 -0
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/discover_and_validate.py +23 -0
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/tests/test_fidelity_precision.py +4 -1
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/tests/test_measurement_fixes.py +9 -4
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/tests/test_storage_validator.py +6 -2
- compass_kb_validation-4.1.0/tests/test_v410_any_pipeline.py +230 -0
- compass_kb_validation-4.1.0/tests/test_v410_gate.py +444 -0
- compass_kb_validation-4.1.0/tests/test_v410_portability.py +181 -0
- compass_kb_validation-4.0.2/compass/providers/snapshot.py +0 -161
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/LICENSE +0 -0
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/compass/__main__.py +0 -0
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/compass/ask.py +0 -0
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/compass/baseline.py +0 -0
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/compass/chunk_eval.py +0 -0
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/compass/chunk_integrity.py +0 -0
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/compass/citation.py +0 -0
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/compass/corpus.py +0 -0
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/compass/diagnostics.py +0 -0
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/compass/diff.py +0 -0
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/compass/drift.py +0 -0
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/compass/embedding_drift.py +0 -0
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/compass/grounding_diff.py +0 -0
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/compass/grounding_rollup.py +0 -0
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/compass/gt_lint.py +0 -0
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/compass/health.py +0 -0
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/compass/incremental.py +0 -0
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/compass/init_wizard.py +0 -0
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/compass/live_dashboard.py +0 -0
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/compass/mcp_server.py +0 -0
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/compass/models/__init__.py +0 -0
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/compass/notifications.py +0 -0
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/compass/pipeline/__init__.py +0 -0
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/compass/profiler.py +0 -0
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/compass/providers/extractor.py +0 -0
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/compass/providers/graph.py +0 -0
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/compass/providers/source.py +0 -0
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/compass/quality_gate.py +0 -0
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/compass/remediation.py +0 -0
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/compass/report/__init__.py +0 -0
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/compass/report/_report_css.py +0 -0
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/compass/report/_report_js.py +0 -0
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/compass/report/analysis.py +0 -0
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/compass/report/audit.py +0 -0
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/compass/report/export.py +0 -0
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/compass/report/grounding_report.py +0 -0
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/compass/report/shell.py +0 -0
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/compass/retrieval_analysis.py +0 -0
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/compass/simulate.py +0 -0
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/compass/text_match.py +0 -0
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/compass/trend_tracker.py +0 -0
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/compass/utils/__init__.py +0 -0
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/compass/validators/__init__.py +0 -0
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/compass/validators/api_upload.py +0 -0
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/compass/validators/base.py +0 -0
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/compass/validators/base_sparql.py +0 -0
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/compass/validators/cross_stage.py +0 -0
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/compass/validators/graphdb_metadata.py +0 -0
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/compass/validators/neptune_metadata.py +0 -0
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/compass/validators/registry.py +0 -0
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/compass_kb_validation.egg-info/dependency_links.txt +0 -0
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/compass_kb_validation.egg-info/entry_points.txt +0 -0
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/compass_kb_validation.egg-info/requires.txt +0 -0
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/compass_kb_validation.egg-info/top_level.txt +0 -0
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/ingestion_validation/__init__.py +0 -0
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/profile_kb.py +0 -0
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/pyproject.toml +0 -0
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/run_validation.py +0 -0
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/setup.cfg +0 -0
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/tests/test_alias.py +0 -0
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/tests/test_alias_disambiguation.py +0 -0
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/tests/test_alias_temporal.py +0 -0
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/tests/test_alt_adapters.py +0 -0
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/tests/test_analysis_report.py +0 -0
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/tests/test_api_upload.py +0 -0
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/tests/test_ask.py +0 -0
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/tests/test_baseline.py +0 -0
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/tests/test_benchmark.py +0 -0
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/tests/test_calibrate_truth.py +0 -0
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/tests/test_check_catalog.py +0 -0
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/tests/test_chunk_eval.py +0 -0
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/tests/test_chunk_integrity.py +0 -0
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/tests/test_chunk_structure_checks.py +0 -0
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/tests/test_citation.py +0 -0
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/tests/test_citation_levels.py +0 -0
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/tests/test_cli.py +0 -0
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/tests/test_cli_commands.py +0 -0
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/tests/test_compat_shim.py +0 -0
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/tests/test_config.py +0 -0
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/tests/test_config_lint.py +0 -0
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/tests/test_content_fidelity.py +0 -0
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/tests/test_content_inspect.py +0 -0
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/tests/test_corpus.py +0 -0
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/tests/test_corpus_health.py +0 -0
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/tests/test_coverage.py +0 -0
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/tests/test_coverage_and_drift_config.py +0 -0
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/tests/test_cross_stage.py +0 -0
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/tests/test_diagnostics.py +0 -0
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/tests/test_diff.py +0 -0
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/tests/test_discover_cli.py +0 -0
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/tests/test_discovery_parallel.py +0 -0
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/tests/test_drift.py +0 -0
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/tests/test_embedding_contract.py +0 -0
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/tests/test_embedding_drift.py +0 -0
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/tests/test_eval_enrich.py +0 -0
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/tests/test_eval_interop.py +0 -0
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/tests/test_evidence.py +0 -0
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/tests/test_gate.py +0 -0
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/tests/test_graph_transport.py +0 -0
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/tests/test_graph_validators.py +0 -0
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/tests/test_grounding.py +0 -0
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/tests/test_grounding_report.py +0 -0
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/tests/test_grounding_rollup.py +0 -0
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/tests/test_health.py +0 -0
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/tests/test_incremental.py +0 -0
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/tests/test_init_wizard.py +0 -0
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/tests/test_lineage.py +0 -0
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/tests/test_manifest.py +0 -0
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/tests/test_mcp.py +0 -0
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/tests/test_migration.py +0 -0
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/tests/test_models.py +0 -0
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/tests/test_multi_index.py +0 -0
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/tests/test_neptune_bugfixes.py +0 -0
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/tests/test_neptune_bugfixes2.py +0 -0
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/tests/test_notifications.py +0 -0
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/tests/test_pipeline.py +0 -0
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/tests/test_profiler.py +0 -0
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/tests/test_providers.py +0 -0
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/tests/test_quality_gate.py +0 -0
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/tests/test_readiness.py +0 -0
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/tests/test_redis_chunks.py +0 -0
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/tests/test_registry.py +0 -0
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/tests/test_remediation.py +0 -0
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/tests/test_report_store_section.py +0 -0
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/tests/test_reporting.py +0 -0
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/tests/test_requirements_config.py +0 -0
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/tests/test_retrieval_assertions.py +0 -0
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/tests/test_retrieval_fields.py +0 -0
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/tests/test_retrieval_quality.py +0 -0
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/tests/test_review_hardening.py +0 -0
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/tests/test_run_cli.py +0 -0
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/tests/test_simulate.py +0 -0
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/tests/test_source_exclusions.py +0 -0
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/tests/test_source_verification.py +0 -0
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/tests/test_sources.py +0 -0
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/tests/test_trends.py +0 -0
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/tests/test_universal_concerns.py +0 -0
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/tests/test_utils.py +0 -0
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/tests/test_v402_fixes.py +0 -0
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/tests/test_v4_defect_fixes.py +0 -0
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/tests/test_vector_fastpath.py +0 -0
- {compass_kb_validation-4.0.2 → compass_kb_validation-4.1.0}/tests/test_vectorstore_filters.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: compass-kb-validation
|
|
3
|
-
Version: 4.0
|
|
3
|
+
Version: 4.1.0
|
|
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
|
|
@@ -205,7 +205,8 @@ a knowledge base — they don't turn COMPASS into a retrieval app or an agent-se
|
|
|
205
205
|
answer); `compass mcp` is an **inspection surface** (read-only KB tools an agent can call, not
|
|
206
206
|
a serving layer). Everything here stays on COMPASS's side of the line and never affects a
|
|
207
207
|
validation pass/fail. They read an `embedding:` block in the project YAML (provider `openai` /
|
|
208
|
-
`azure_openai` / `bedrock
|
|
208
|
+
`azure_openai` / `bedrock` / `openai_compatible` for a self-hosted server such as vLLM, Ollama or
|
|
209
|
+
TEI, `model_id`, `dimensions`) so a query is embedded the way ingestion was.
|
|
209
210
|
|
|
210
211
|
```bash
|
|
211
212
|
# Ask the KB a question - returns the ranked chunks it would retrieve (no generated answer)
|
|
@@ -339,6 +340,10 @@ eval:
|
|
|
339
340
|
match: shingle # shingle | exact
|
|
340
341
|
coverage_min: {default: 0.90, quarterly: 0.97} # keyed by document_type
|
|
341
342
|
prefer_snapshot: true
|
|
343
|
+
figure_regions: snapshot # snapshot | off: numbers inside figures reported apart
|
|
344
|
+
figure_types: [figure, chart, image] # snapshot element types that are figures
|
|
345
|
+
lost_passages_allowed: 0 # named lost passages tolerated (snapshot baseline)
|
|
346
|
+
number_format: "1,234.5" # or "1.234,5" | "1 234,5" | "1'234.5"
|
|
342
347
|
source_exclusions: # nothing is excluded that is not listed here
|
|
343
348
|
repeated_on_pages: 5 # headers and footers
|
|
344
349
|
min_chars: 75 # small fragments
|
|
@@ -360,6 +365,16 @@ A document where not one chunk traces to its source is `SOURCE_MISMATCH`: either
|
|
|
360
365
|
source key is wrong, or the store holds another document's text under that id. Neither is averaged
|
|
361
366
|
into coverage as a 0%. A snapshot that cannot be found is reported with the key it was looked for at.
|
|
362
367
|
|
|
368
|
+
What gates is what can be named. Against a snapshot, every passage the extractor produced and the
|
|
369
|
+
store lacks is a lost passage, reported with its element type, page and box, and one is enough for
|
|
370
|
+
`CONTENT_LOSS` (`lost_passages_allowed` raises that). A number in body text that is not stored is
|
|
371
|
+
listed with its page and sentence. Numbers inside a figure region, and runs of evenly spaced numbers
|
|
372
|
+
such as an axis (`20.0% 22.0% 24.0%`), are reported apart as `figure_numbers` and never gate; words
|
|
373
|
+
inside a figure are still compared. Page coverage is shown as context, not as a gate. The JSON keeps
|
|
374
|
+
every finding, body text first; the console shows the first few. A caption or a `Source:` note
|
|
375
|
+
stored more than one chunk away from its figure is `CAPTION_DETACHED`, with both chunk ids. A
|
|
376
|
+
source that cannot be read (encrypted, image-only) is compared through its snapshot.
|
|
377
|
+
|
|
363
378
|
Findings say what is missing, not who lost it, until you declare the extractor's own output. Any
|
|
364
379
|
extractor that writes JSON works: map its fields once, and each finding becomes `PIPELINE_DROP`,
|
|
365
380
|
`PIPELINE_ALTER` or `EXTRACTOR_MISS`.
|
|
@@ -369,18 +384,30 @@ eval:
|
|
|
369
384
|
snapshot:
|
|
370
385
|
provider: storage_json
|
|
371
386
|
location: "snapshots/{project}/{id}/{e_tag}/document.json" # also {source_key}
|
|
387
|
+
fallback_locations: ["backup/{e_tag}/document.json"] # tried in order after it
|
|
388
|
+
version: latest_with_elements # current (default) | latest_with_elements
|
|
372
389
|
format: my_extractor
|
|
373
390
|
formats:
|
|
374
|
-
my_extractor: #
|
|
375
|
-
elements: "
|
|
376
|
-
type: "
|
|
391
|
+
my_extractor: # paths into the extractor's JSON
|
|
392
|
+
elements: "metadata.element_list"
|
|
393
|
+
type: "chunk_type"
|
|
377
394
|
text: "text"
|
|
378
|
-
|
|
379
|
-
|
|
395
|
+
order: "chunk_index"
|
|
396
|
+
page: "grounding[0].page" # [n] picks one item
|
|
397
|
+
boxes: "grounding[*].box" # [*] takes all: an element may have several boxes
|
|
398
|
+
box_keys: [left, top, right, bottom] # for boxes written as objects
|
|
399
|
+
page_base: 0 # the extractor counts pages from 0
|
|
380
400
|
cells: "table.cells"
|
|
381
|
-
order: "reading_order"
|
|
382
401
|
```
|
|
383
402
|
|
|
403
|
+
`version: latest_with_elements` reads older object versions when a later write replaced the element
|
|
404
|
+
list with a text-only file, or the key was deleted under bucket versioning. Each document's snapshot
|
|
405
|
+
is `present`, `superseded` (read from an older version or a fallback), `missing`, `wrong_shape` or
|
|
406
|
+
`unreadable`; the counts are in `snapshot_health`, and `readiness.min_snapshot_coverage` (0 to 1)
|
|
407
|
+
fails readiness when too few were read. `compass doctor` reads the snapshots of a few documents,
|
|
408
|
+
says which location and version holds the element list, and prints a `formats` entry to paste when
|
|
409
|
+
the mapping is wrong.
|
|
410
|
+
|
|
384
411
|
### KB readiness
|
|
385
412
|
|
|
386
413
|
`compass readiness --discover D.json [--grounding G.json] [--benchmark B.json] [--drift X.json]
|
|
@@ -410,6 +437,7 @@ it changes no verdict.
|
|
|
410
437
|
| `corpus_at_risk` | risk | ingestion |
|
|
411
438
|
| `corpus_verdict_missing` * | risk | ingestion |
|
|
412
439
|
| `documents_unexamined` * (skipped, pending or empty checks) | risk | ingestion |
|
|
440
|
+
| `checks_not_run` * (a backend such as the PDF reader failed to load) | risk | ingestion |
|
|
413
441
|
| `partial_run` * (`discover --since`) | risk | ingestion |
|
|
414
442
|
| `retrieval_query_errors` * | risk | retrieval config |
|
|
415
443
|
| `retrieval_found_nothing` | risk | retrieval config |
|
|
@@ -422,6 +450,9 @@ it changes no verdict.
|
|
|
422
450
|
| `fidelity_numbers_missing` | advisory | ingestion |
|
|
423
451
|
| `fidelity_value_drift` | advisory | ingestion |
|
|
424
452
|
| `fidelity_source_mismatch` | risk | ingestion |
|
|
453
|
+
| `fidelity_caption_detached` | risk | ingestion |
|
|
454
|
+
| `fidelity_documents_unverifiable` * (could not be compared) | risk | ingestion |
|
|
455
|
+
| `fidelity_snapshot_coverage` * (below `readiness.min_snapshot_coverage`) | gate | ingestion |
|
|
425
456
|
| `chunk_integrity_findings` | advisory | ingestion |
|
|
426
457
|
| `stale_versions`, `stale_versions_unchecked` | advisory | ingestion |
|
|
427
458
|
| `documents_within_threshold` | advisory | ingestion |
|
|
@@ -587,12 +618,13 @@ environments:
|
|
|
587
618
|
graphql_mutation: |
|
|
588
619
|
mutation ($file: Upload!, $metadata: JSON) { uploadDocument(file:$file, metadata:$metadata){ status document_id } }
|
|
589
620
|
s3:
|
|
590
|
-
provider: s3 # s3 | minio | r2 | azure_blob | gcs …
|
|
621
|
+
provider: s3 # s3 | minio | r2 | azure_blob | gcs | local …
|
|
591
622
|
bucket_name: my-documents
|
|
592
623
|
prefix: knowledge-base/
|
|
593
624
|
redis:
|
|
594
625
|
provider: redis # redis | qdrant | pinecone | pgvector …
|
|
595
626
|
search_index: my_embeddings
|
|
627
|
+
text_field: text # the field holding chunk text (content, page_content, ...)
|
|
596
628
|
expected_embedding_dim: 1536
|
|
597
629
|
expected_distance_metric: COSINE
|
|
598
630
|
```
|
|
@@ -132,7 +132,8 @@ a knowledge base — they don't turn COMPASS into a retrieval app or an agent-se
|
|
|
132
132
|
answer); `compass mcp` is an **inspection surface** (read-only KB tools an agent can call, not
|
|
133
133
|
a serving layer). Everything here stays on COMPASS's side of the line and never affects a
|
|
134
134
|
validation pass/fail. They read an `embedding:` block in the project YAML (provider `openai` /
|
|
135
|
-
`azure_openai` / `bedrock
|
|
135
|
+
`azure_openai` / `bedrock` / `openai_compatible` for a self-hosted server such as vLLM, Ollama or
|
|
136
|
+
TEI, `model_id`, `dimensions`) so a query is embedded the way ingestion was.
|
|
136
137
|
|
|
137
138
|
```bash
|
|
138
139
|
# Ask the KB a question - returns the ranked chunks it would retrieve (no generated answer)
|
|
@@ -266,6 +267,10 @@ eval:
|
|
|
266
267
|
match: shingle # shingle | exact
|
|
267
268
|
coverage_min: {default: 0.90, quarterly: 0.97} # keyed by document_type
|
|
268
269
|
prefer_snapshot: true
|
|
270
|
+
figure_regions: snapshot # snapshot | off: numbers inside figures reported apart
|
|
271
|
+
figure_types: [figure, chart, image] # snapshot element types that are figures
|
|
272
|
+
lost_passages_allowed: 0 # named lost passages tolerated (snapshot baseline)
|
|
273
|
+
number_format: "1,234.5" # or "1.234,5" | "1 234,5" | "1'234.5"
|
|
269
274
|
source_exclusions: # nothing is excluded that is not listed here
|
|
270
275
|
repeated_on_pages: 5 # headers and footers
|
|
271
276
|
min_chars: 75 # small fragments
|
|
@@ -287,6 +292,16 @@ A document where not one chunk traces to its source is `SOURCE_MISMATCH`: either
|
|
|
287
292
|
source key is wrong, or the store holds another document's text under that id. Neither is averaged
|
|
288
293
|
into coverage as a 0%. A snapshot that cannot be found is reported with the key it was looked for at.
|
|
289
294
|
|
|
295
|
+
What gates is what can be named. Against a snapshot, every passage the extractor produced and the
|
|
296
|
+
store lacks is a lost passage, reported with its element type, page and box, and one is enough for
|
|
297
|
+
`CONTENT_LOSS` (`lost_passages_allowed` raises that). A number in body text that is not stored is
|
|
298
|
+
listed with its page and sentence. Numbers inside a figure region, and runs of evenly spaced numbers
|
|
299
|
+
such as an axis (`20.0% 22.0% 24.0%`), are reported apart as `figure_numbers` and never gate; words
|
|
300
|
+
inside a figure are still compared. Page coverage is shown as context, not as a gate. The JSON keeps
|
|
301
|
+
every finding, body text first; the console shows the first few. A caption or a `Source:` note
|
|
302
|
+
stored more than one chunk away from its figure is `CAPTION_DETACHED`, with both chunk ids. A
|
|
303
|
+
source that cannot be read (encrypted, image-only) is compared through its snapshot.
|
|
304
|
+
|
|
290
305
|
Findings say what is missing, not who lost it, until you declare the extractor's own output. Any
|
|
291
306
|
extractor that writes JSON works: map its fields once, and each finding becomes `PIPELINE_DROP`,
|
|
292
307
|
`PIPELINE_ALTER` or `EXTRACTOR_MISS`.
|
|
@@ -296,18 +311,30 @@ eval:
|
|
|
296
311
|
snapshot:
|
|
297
312
|
provider: storage_json
|
|
298
313
|
location: "snapshots/{project}/{id}/{e_tag}/document.json" # also {source_key}
|
|
314
|
+
fallback_locations: ["backup/{e_tag}/document.json"] # tried in order after it
|
|
315
|
+
version: latest_with_elements # current (default) | latest_with_elements
|
|
299
316
|
format: my_extractor
|
|
300
317
|
formats:
|
|
301
|
-
my_extractor: #
|
|
302
|
-
elements: "
|
|
303
|
-
type: "
|
|
318
|
+
my_extractor: # paths into the extractor's JSON
|
|
319
|
+
elements: "metadata.element_list"
|
|
320
|
+
type: "chunk_type"
|
|
304
321
|
text: "text"
|
|
305
|
-
|
|
306
|
-
|
|
322
|
+
order: "chunk_index"
|
|
323
|
+
page: "grounding[0].page" # [n] picks one item
|
|
324
|
+
boxes: "grounding[*].box" # [*] takes all: an element may have several boxes
|
|
325
|
+
box_keys: [left, top, right, bottom] # for boxes written as objects
|
|
326
|
+
page_base: 0 # the extractor counts pages from 0
|
|
307
327
|
cells: "table.cells"
|
|
308
|
-
order: "reading_order"
|
|
309
328
|
```
|
|
310
329
|
|
|
330
|
+
`version: latest_with_elements` reads older object versions when a later write replaced the element
|
|
331
|
+
list with a text-only file, or the key was deleted under bucket versioning. Each document's snapshot
|
|
332
|
+
is `present`, `superseded` (read from an older version or a fallback), `missing`, `wrong_shape` or
|
|
333
|
+
`unreadable`; the counts are in `snapshot_health`, and `readiness.min_snapshot_coverage` (0 to 1)
|
|
334
|
+
fails readiness when too few were read. `compass doctor` reads the snapshots of a few documents,
|
|
335
|
+
says which location and version holds the element list, and prints a `formats` entry to paste when
|
|
336
|
+
the mapping is wrong.
|
|
337
|
+
|
|
311
338
|
### KB readiness
|
|
312
339
|
|
|
313
340
|
`compass readiness --discover D.json [--grounding G.json] [--benchmark B.json] [--drift X.json]
|
|
@@ -337,6 +364,7 @@ it changes no verdict.
|
|
|
337
364
|
| `corpus_at_risk` | risk | ingestion |
|
|
338
365
|
| `corpus_verdict_missing` * | risk | ingestion |
|
|
339
366
|
| `documents_unexamined` * (skipped, pending or empty checks) | risk | ingestion |
|
|
367
|
+
| `checks_not_run` * (a backend such as the PDF reader failed to load) | risk | ingestion |
|
|
340
368
|
| `partial_run` * (`discover --since`) | risk | ingestion |
|
|
341
369
|
| `retrieval_query_errors` * | risk | retrieval config |
|
|
342
370
|
| `retrieval_found_nothing` | risk | retrieval config |
|
|
@@ -349,6 +377,9 @@ it changes no verdict.
|
|
|
349
377
|
| `fidelity_numbers_missing` | advisory | ingestion |
|
|
350
378
|
| `fidelity_value_drift` | advisory | ingestion |
|
|
351
379
|
| `fidelity_source_mismatch` | risk | ingestion |
|
|
380
|
+
| `fidelity_caption_detached` | risk | ingestion |
|
|
381
|
+
| `fidelity_documents_unverifiable` * (could not be compared) | risk | ingestion |
|
|
382
|
+
| `fidelity_snapshot_coverage` * (below `readiness.min_snapshot_coverage`) | gate | ingestion |
|
|
352
383
|
| `chunk_integrity_findings` | advisory | ingestion |
|
|
353
384
|
| `stale_versions`, `stale_versions_unchecked` | advisory | ingestion |
|
|
354
385
|
| `documents_within_threshold` | advisory | ingestion |
|
|
@@ -514,12 +545,13 @@ environments:
|
|
|
514
545
|
graphql_mutation: |
|
|
515
546
|
mutation ($file: Upload!, $metadata: JSON) { uploadDocument(file:$file, metadata:$metadata){ status document_id } }
|
|
516
547
|
s3:
|
|
517
|
-
provider: s3 # s3 | minio | r2 | azure_blob | gcs …
|
|
548
|
+
provider: s3 # s3 | minio | r2 | azure_blob | gcs | local …
|
|
518
549
|
bucket_name: my-documents
|
|
519
550
|
prefix: knowledge-base/
|
|
520
551
|
redis:
|
|
521
552
|
provider: redis # redis | qdrant | pinecone | pgvector …
|
|
522
553
|
search_index: my_embeddings
|
|
554
|
+
text_field: text # the field holding chunk text (content, page_content, ...)
|
|
523
555
|
expected_embedding_dim: 1536
|
|
524
556
|
expected_distance_metric: COSINE
|
|
525
557
|
```
|
|
@@ -390,7 +390,10 @@ def build_alias_map(adapter: Any, fields: list[str], configured: Optional[dict]
|
|
|
390
390
|
why so the report can be honest about reduced coverage.
|
|
391
391
|
"""
|
|
392
392
|
amap = AliasMap(configured=dict(configured or {}))
|
|
393
|
-
|
|
393
|
+
# An adapter states whether it can list values; one that predates the flag is trusted when it
|
|
394
|
+
# has the method at all.
|
|
395
|
+
if adapter is None or not getattr(adapter, "enumerates_values",
|
|
396
|
+
callable(getattr(adapter, "distinct_values", None))):
|
|
394
397
|
amap.note = "backend cannot enumerate distinct values - no aliases derived"
|
|
395
398
|
return amap
|
|
396
399
|
names: list[str] = []
|
|
@@ -183,10 +183,12 @@ def ground_truth_ids(case: dict, cfg: Any) -> set:
|
|
|
183
183
|
|
|
184
184
|
doc_field = getattr(cfg, "gt_chunk_doc_field", "document_title")
|
|
185
185
|
page_field = getattr(cfg, "gt_chunk_page_field", "page_start")
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
186
|
+
from compass.eval_interop import as_chunks
|
|
187
|
+
|
|
188
|
+
text_field = getattr(cfg, "gt_chunk_text_field", "text") or "text"
|
|
189
|
+
chunks = as_chunks(get_path(case, getattr(cfg, "gt_chunks_path", "context.chunks")), text_field)
|
|
190
|
+
if not chunks:
|
|
191
|
+
chunks = as_chunks(case.get("chunks"), text_field)
|
|
190
192
|
out = {chunk_identity(c, doc_field, page_field) for c in chunks if isinstance(c, dict)}
|
|
191
193
|
return {i for i in out if i}
|
|
192
194
|
|
|
@@ -149,9 +149,12 @@ _TEXT: dict[str, dict[str, tuple[str, str, str]]] = {
|
|
|
149
149
|
"A degenerate vector cannot be retrieved correctly, and it fails silently.",
|
|
150
150
|
"Re-embed the document and check the embedding step's output."),
|
|
151
151
|
"chunk_boundaries": (
|
|
152
|
-
"
|
|
153
|
-
"
|
|
154
|
-
"
|
|
152
|
+
"No sentence is cut across two chunks on the same page: the first chunk ends without "
|
|
153
|
+
"closing punctuation and not on a heading, and the next continues the sentence.",
|
|
154
|
+
"Each half of the sentence is retrieved without the other. A cut at a page break is "
|
|
155
|
+
"not counted, because layout chunkers end a block there on purpose.",
|
|
156
|
+
"Read the named chunk pairs. Under fixed-size chunking the splits are reported, not "
|
|
157
|
+
"scored."),
|
|
155
158
|
"content_fidelity": (
|
|
156
159
|
"Chunk text can be found in the source file on a live run.",
|
|
157
160
|
"Extraction altered the text, so the KB no longer says what the document says.",
|
|
@@ -492,6 +495,12 @@ _TEXT: dict[str, dict[str, tuple[str, str, str]]] = {
|
|
|
492
495
|
"or the store holds another document's text under this id.",
|
|
493
496
|
"Check eval.fidelity.text_field and eval.citation_source_key_fields, then the "
|
|
494
497
|
"document's chunks."),
|
|
498
|
+
"caption_detached": (
|
|
499
|
+
"Whether each caption or source note is stored in its figure's chunk or the next one.",
|
|
500
|
+
"A reader retrieving the figure gets it without its source or caption, and the "
|
|
501
|
+
"caption arrives with text it does not describe.",
|
|
502
|
+
"Check the chunker's merge step, which can move a short caption into a neighbour. "
|
|
503
|
+
"Needs eval.snapshot for element types and boxes."),
|
|
495
504
|
"unverifiable": (
|
|
496
505
|
"Whether a document or page has text that can be compared at all.",
|
|
497
506
|
"Nothing was concluded: an image-only page, a garbled text layer or an unreadable "
|
|
@@ -543,6 +552,7 @@ _FIDELITY_TITLES = {
|
|
|
543
552
|
"numbers_missing": ("Numbers missing", "warn"),
|
|
544
553
|
"value_drift": ("Value drift", "warn"),
|
|
545
554
|
"source_mismatch": ("Source mismatch", "warn"),
|
|
555
|
+
"caption_detached": ("Caption detached from its figure", "warn"),
|
|
546
556
|
"unverifiable": ("Unverifiable document or page", "info"),
|
|
547
557
|
"wrong_page": ("Chunk on the wrong page", "warn"),
|
|
548
558
|
"altered": ("Chunk altered", "warn"),
|
|
@@ -192,6 +192,71 @@ def structure_cuts(texts: list[str]) -> list[dict]:
|
|
|
192
192
|
return cuts
|
|
193
193
|
|
|
194
194
|
|
|
195
|
+
_CONTINUATION_MARKS = ",;:)]"
|
|
196
|
+
# Sentence ends in scripts that write them full width (Chinese, Japanese).
|
|
197
|
+
_WIDE_SENTENCE_END = "\u3002\uff01\uff1f\u2026"
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
def uncased_share(texts: list[str]) -> float:
|
|
201
|
+
"""Share of letters with no upper or lower case (Chinese, Japanese, Thai, Arabic, ...).
|
|
202
|
+
|
|
203
|
+
The sentence-split rule tells a continued sentence by a lowercase opening letter, which these
|
|
204
|
+
scripts do not have, so above half the rule cannot judge the text and must say so.
|
|
205
|
+
"""
|
|
206
|
+
letters = [ch for text in texts for ch in text if ch.isalpha()]
|
|
207
|
+
if not letters:
|
|
208
|
+
return 0.0
|
|
209
|
+
return sum(1 for ch in letters if not (ch.isupper() or ch.islower())) / len(letters)
|
|
210
|
+
_HEADING_WORDS = 10
|
|
211
|
+
|
|
212
|
+
|
|
213
|
+
def _heading_like(line: str) -> bool:
|
|
214
|
+
"""A short line in title or upper case, or a markdown heading: a chunk may end on it."""
|
|
215
|
+
line = line.strip()
|
|
216
|
+
if _HEADING.match(line):
|
|
217
|
+
return True
|
|
218
|
+
words = [w for w in re.findall(r"[^\W\d_][\w'-]*", line)]
|
|
219
|
+
if not words or len(words) > _HEADING_WORDS:
|
|
220
|
+
return False
|
|
221
|
+
capitalised = sum(1 for w in words if w[0].isupper())
|
|
222
|
+
return capitalised / len(words) >= 0.6
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
def sentence_splits(texts: list[str], pages: list | None = None) -> list[dict]:
|
|
226
|
+
"""Boundaries that cut one sentence in two on the same page.
|
|
227
|
+
|
|
228
|
+
``texts`` are a document's chunks in order and ``pages`` their ``(first, last)`` pages,
|
|
229
|
+
when known. A boundary is a split when the first chunk ends without closing punctuation,
|
|
230
|
+
its last line is not a heading, the next chunk opens by continuing the sentence (a
|
|
231
|
+
lowercase letter, or a comma, semicolon or closing bracket), and both sides are on one
|
|
232
|
+
page, so a page break, which layout chunkers keep on purpose, never counts. Tables, lists
|
|
233
|
+
and code are left to the structure checks.
|
|
234
|
+
|
|
235
|
+
Returns ``[{"boundary": i, "page": p}]``, where ``i`` is the first chunk's position.
|
|
236
|
+
"""
|
|
237
|
+
out: list[dict] = []
|
|
238
|
+
for i, (left, right) in enumerate(zip(texts, texts[1:])):
|
|
239
|
+
left_lines, right_lines = _content_lines(left), _content_lines(right)
|
|
240
|
+
if not left_lines or not right_lines:
|
|
241
|
+
continue
|
|
242
|
+
tail, head = left_lines[-1].rstrip(), right_lines[0].lstrip()
|
|
243
|
+
if (tail[-1] in _SENTENCE_END or tail[-1] in _WIDE_SENTENCE_END
|
|
244
|
+
or tail.endswith(("|", "```")) or _PIPE_ROW.match(tail)
|
|
245
|
+
or _LIST_ITEM.match(tail) or _heading_like(tail)):
|
|
246
|
+
continue
|
|
247
|
+
if (not (head[0].islower() or head[0] in _CONTINUATION_MARKS) or _PIPE_ROW.match(head)
|
|
248
|
+
or _LIST_ITEM.match(head)):
|
|
249
|
+
continue
|
|
250
|
+
page = None
|
|
251
|
+
if pages and i + 1 < len(pages):
|
|
252
|
+
left_end, right_start = pages[i][1], pages[i + 1][0]
|
|
253
|
+
if left_end is not None and right_start is not None and left_end != right_start:
|
|
254
|
+
continue # the cut falls at a page break
|
|
255
|
+
page = left_end if left_end is not None else right_start
|
|
256
|
+
out.append({"boundary": i, "page": page, "tail": tail[-60:], "head": head[:60]})
|
|
257
|
+
return out
|
|
258
|
+
|
|
259
|
+
|
|
195
260
|
def infer_chunking(texts: list[str], *, summary_populated: bool, min_chunks: int,
|
|
196
261
|
min_spread: float) -> tuple[bool, str]:
|
|
197
262
|
"""Do these chunks look clearly not fixed-size? Returns (non_fixed, evidence).
|
|
@@ -476,6 +476,8 @@ def _doctor_run(settings, *, verbose: bool, indent: str = " ") -> tuple[int, bo
|
|
|
476
476
|
print(dl)
|
|
477
477
|
if label.lower().startswith(("object", "storage", "s3")):
|
|
478
478
|
print(_extractor_line(settings, indent))
|
|
479
|
+
for sl in _snapshot_lines(settings, label, indent):
|
|
480
|
+
print(sl)
|
|
479
481
|
return checked, any_down
|
|
480
482
|
|
|
481
483
|
|
|
@@ -491,6 +493,21 @@ def _extractor_line(settings, indent: str = " ") -> str:
|
|
|
491
493
|
return f"{indent} PDF text extractor: {name}"
|
|
492
494
|
|
|
493
495
|
|
|
496
|
+
def _snapshot_lines(settings, label: str, indent: str = " ") -> list[str]:
|
|
497
|
+
"""Where the extractor snapshots are and whether they read, on a few documents."""
|
|
498
|
+
if not (getattr(settings.eval, "snapshot", None) or {}).get("provider"):
|
|
499
|
+
return []
|
|
500
|
+
from compass.providers import get_adapter
|
|
501
|
+
from compass.snapshot_doctor import diagnose
|
|
502
|
+
|
|
503
|
+
try:
|
|
504
|
+
storage = _stage_adapter(settings, label)
|
|
505
|
+
vectorstore = get_adapter("vectorstore", settings.redis.provider, config=settings.redis)
|
|
506
|
+
return diagnose(settings, vectorstore=vectorstore, storage=storage, indent=indent + " ")
|
|
507
|
+
except Exception as exc: # noqa: BLE001 - a diagnostic must never break doctor
|
|
508
|
+
return [f"{indent} Extractor snapshots: NOT CHECKED ({exc})"]
|
|
509
|
+
|
|
510
|
+
|
|
494
511
|
def _embedding_drift_lines(settings, indent: str = " ") -> list[str]:
|
|
495
512
|
"""Warn when the stored vectors do not look like the CONFIGURED embedding model.
|
|
496
513
|
|
|
@@ -1798,25 +1815,18 @@ def cmd_grounding_audit(argv: list[str]) -> int:
|
|
|
1798
1815
|
return 2
|
|
1799
1816
|
records = [one]
|
|
1800
1817
|
else:
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
#
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
obj = _json.loads(line)
|
|
1814
|
-
except Exception: # noqa: BLE001 - point at the offending line, not char 1
|
|
1815
|
-
print(f" --eval-results: line {n} is not valid JSON. Expected JSONL "
|
|
1816
|
-
"(one object per line) or a single JSON array.")
|
|
1817
|
-
return 2
|
|
1818
|
-
if isinstance(obj, dict): # skip non-object lines instead of crashing run_audit
|
|
1819
|
-
records.append(obj)
|
|
1818
|
+
from compass.eval_interop import read_records
|
|
1819
|
+
|
|
1820
|
+
# A JSON array, one object (a case, or cases wrapped under "results" and the like),
|
|
1821
|
+
# or JSONL: each tool writes a different one.
|
|
1822
|
+
try:
|
|
1823
|
+
records = read_records(Path(args.eval_results).read_text(encoding="utf-8-sig"))
|
|
1824
|
+
except ValueError as exc:
|
|
1825
|
+
print(f" --eval-results: {exc}")
|
|
1826
|
+
return 2
|
|
1827
|
+
if not records:
|
|
1828
|
+
print(" --eval-results: no case objects found in the file.")
|
|
1829
|
+
return 2
|
|
1820
1830
|
except Exception as exc: # noqa: BLE001 - clean message, never a traceback
|
|
1821
1831
|
print(f" Could not read eval input: {exc}")
|
|
1822
1832
|
return 2
|
|
@@ -1868,8 +1878,18 @@ def cmd_grounding_audit(argv: list[str]) -> int:
|
|
|
1868
1878
|
# to learn the aliases are wrong, once to get real numbers.
|
|
1869
1879
|
return _report_alias_health(records, settings.eval, alias_map, adapter)
|
|
1870
1880
|
|
|
1871
|
-
results = [
|
|
1872
|
-
|
|
1881
|
+
results = []
|
|
1882
|
+
unaudited: list[str] = []
|
|
1883
|
+
for n, rec in enumerate(records, 1):
|
|
1884
|
+
try:
|
|
1885
|
+
results.append(run_audit(rec, adapter, settings.eval, doc_exists=doc_exists,
|
|
1886
|
+
alias_map=alias_map, fetch_pages=fetch_pages))
|
|
1887
|
+
except Exception as exc: # noqa: BLE001 - one malformed case must not lose the rest
|
|
1888
|
+
name = str(rec.get("test_id") or rec.get("id") or f"record {n}")
|
|
1889
|
+
unaudited.append(f"{name}: {type(exc).__name__}: {exc}")
|
|
1890
|
+
if unaudited:
|
|
1891
|
+
print(f" [WARN] {len(unaudited)} case(s) could not be audited and are not in the "
|
|
1892
|
+
f"results; first: {unaudited[0]}", file=sys.stderr)
|
|
1873
1893
|
|
|
1874
1894
|
# On stderr so it reaches a --format json user too: a rule that did not compile leaves the
|
|
1875
1895
|
# drops it was written for reported as ingestion faults, with nothing else to explain why.
|
|
@@ -397,6 +397,10 @@ class RedisConfig:
|
|
|
397
397
|
chunk_overlap: int = 100
|
|
398
398
|
expected_embedding_dim: int = 0
|
|
399
399
|
embedding_field: str = "text_embedding"
|
|
400
|
+
# The field holding each chunk's text. Every check reads chunk text as "text"; when the index
|
|
401
|
+
# names it otherwise (content, page_content, document, ...), the adapter presents this field
|
|
402
|
+
# under that name and sends text searches to it. "text" = as stored.
|
|
403
|
+
text_field: str = "text"
|
|
400
404
|
boundary_bad_ratio_threshold: float = 0.3
|
|
401
405
|
content_fidelity_min_coverage: float = 0.5
|
|
402
406
|
test_query_keywords: list[str] = field(default_factory=list)
|
|
@@ -877,6 +881,9 @@ class ReadinessConfig:
|
|
|
877
881
|
artifacts: dict[str, str] = field(default_factory=dict)
|
|
878
882
|
min_recall: float = 0.0
|
|
879
883
|
min_kb_confirmed_pct: float = 0.0
|
|
884
|
+
# Share of fidelity's documents (0-1) that must have a readable extractor snapshot when
|
|
885
|
+
# eval.snapshot is declared. 0 = off. Below it, attribution covers too few to trust.
|
|
886
|
+
min_snapshot_coverage: float = 0.0
|
|
880
887
|
|
|
881
888
|
|
|
882
889
|
@dataclass
|
|
@@ -1080,8 +1087,11 @@ def _hydrate(cls: type, data: dict | None) -> Any:
|
|
|
1080
1087
|
_MAPPING_KEYS: dict[tuple[str, str], tuple[str, ...]] = {
|
|
1081
1088
|
("eval", "fidelity"): ("normalization", "match", "shingle_k", "coverage_min", "type_field",
|
|
1082
1089
|
"prefer_snapshot", "chunk_integrity", "page_tolerance", "page_field",
|
|
1083
|
-
"page_end_field", "position_field", "text_field"
|
|
1084
|
-
|
|
1090
|
+
"page_end_field", "position_field", "text_field", "figure_regions",
|
|
1091
|
+
"figure_types", "figure_text", "table_types", "caption_types",
|
|
1092
|
+
"caption_pattern", "lost_passages_allowed", "number_format"),
|
|
1093
|
+
("eval", "snapshot"): ("provider", "location", "format", "formats", "fallback_locations",
|
|
1094
|
+
"version"),
|
|
1085
1095
|
("eval", "source_exclusions"): ("repeated_on_pages", "min_chars", "roles", "patterns",
|
|
1086
1096
|
"page_roles", "must_retain"),
|
|
1087
1097
|
}
|
|
@@ -215,20 +215,33 @@ def _lint_fidelity(settings: Any) -> list[Finding]:
|
|
|
215
215
|
name = str(snapshot.get("format") or "canonical")
|
|
216
216
|
if name != "canonical" and name not in (snapshot.get("formats") or {}):
|
|
217
217
|
out.append(("warn", f"eval.snapshot.format '{name}' has no entry in eval.snapshot.formats."))
|
|
218
|
-
from compass.providers.snapshot import LOCATION_FIELDS,
|
|
218
|
+
from compass.providers.snapshot import (LOCATION_FIELDS, MAPPING_KEYS, VERSION_MODES,
|
|
219
|
+
location_fields)
|
|
219
220
|
|
|
220
221
|
location = str(snapshot.get("location") or "")
|
|
221
222
|
if not location:
|
|
222
223
|
out.append(("warn", "eval.snapshot.location is empty, so no snapshot can be found."))
|
|
223
|
-
else
|
|
224
|
+
patterns = [("location", location)] if location else []
|
|
225
|
+
patterns += [(f"fallback_locations[{i}]", str(p))
|
|
226
|
+
for i, p in enumerate(snapshot.get("fallback_locations") or [])]
|
|
227
|
+
for where, pattern in patterns:
|
|
224
228
|
try:
|
|
225
|
-
unknown = sorted(set(location_fields(
|
|
229
|
+
unknown = sorted(set(location_fields(pattern)) - set(LOCATION_FIELDS))
|
|
226
230
|
except ValueError as exc:
|
|
227
231
|
unknown = [f"unparseable: {exc}"]
|
|
228
232
|
if unknown:
|
|
229
|
-
out.append(("error", f"eval.snapshot.
|
|
233
|
+
out.append(("error", f"eval.snapshot.{where} uses "
|
|
230
234
|
f"{', '.join('{' + u + '}' for u in unknown)}, which nothing fills in; the "
|
|
231
235
|
f"placeholders are {', '.join('{' + f + '}' for f in LOCATION_FIELDS)}."))
|
|
236
|
+
mode = str(snapshot.get("version") or "current")
|
|
237
|
+
if mode not in VERSION_MODES:
|
|
238
|
+
out.append(("error", f"eval.snapshot.version '{mode}' is not one of "
|
|
239
|
+
f"{', '.join(VERSION_MODES)}."))
|
|
240
|
+
for fmt, mapping in (snapshot.get("formats") or {}).items():
|
|
241
|
+
extra = sorted(set(mapping or {}) - set(MAPPING_KEYS)) if isinstance(mapping, dict) else []
|
|
242
|
+
if extra:
|
|
243
|
+
out.append(("warn", f"eval.snapshot.formats.{fmt} has unknown key(s) "
|
|
244
|
+
f"{', '.join(extra)}; the keys are {', '.join(MAPPING_KEYS)}."))
|
|
232
245
|
extractor = str(getattr(ev, "source_extractor", "auto") or "auto").lower()
|
|
233
246
|
if extractor != "auto" and extractor not in available("extractor"):
|
|
234
247
|
out.append(("warn", f"eval.source_extractor '{extractor}' is not registered "
|