compass-kb-validation 2.9.0__tar.gz → 3.0.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-2.9.0 → compass_kb_validation-3.0.0}/PKG-INFO +6 -6
- {compass_kb_validation-2.9.0 → compass_kb_validation-3.0.0}/README.md +5 -5
- {compass_kb_validation-2.9.0/ingestion_validation → compass_kb_validation-3.0.0/compass}/__init__.py +1 -1
- {compass_kb_validation-2.9.0/ingestion_validation → compass_kb_validation-3.0.0/compass}/__main__.py +2 -2
- {compass_kb_validation-2.9.0/ingestion_validation → compass_kb_validation-3.0.0/compass}/ask.py +2 -2
- {compass_kb_validation-2.9.0/ingestion_validation → compass_kb_validation-3.0.0/compass}/cli.py +55 -55
- {compass_kb_validation-2.9.0/ingestion_validation → compass_kb_validation-3.0.0/compass}/config/__init__.py +1 -1
- {compass_kb_validation-2.9.0/ingestion_validation → compass_kb_validation-3.0.0/compass}/config_lint.py +1 -1
- {compass_kb_validation-2.9.0/ingestion_validation → compass_kb_validation-3.0.0/compass}/corpus_health.py +2 -2
- {compass_kb_validation-2.9.0/ingestion_validation → compass_kb_validation-3.0.0/compass}/evidence.py +3 -3
- {compass_kb_validation-2.9.0/ingestion_validation → compass_kb_validation-3.0.0/compass}/live_dashboard.py +1 -1
- {compass_kb_validation-2.9.0/ingestion_validation → compass_kb_validation-3.0.0/compass}/mcp_server.py +5 -5
- {compass_kb_validation-2.9.0/ingestion_validation → compass_kb_validation-3.0.0/compass}/notifications.py +1 -1
- {compass_kb_validation-2.9.0/ingestion_validation → compass_kb_validation-3.0.0/compass}/pipeline/__init__.py +6 -6
- {compass_kb_validation-2.9.0/ingestion_validation → compass_kb_validation-3.0.0/compass}/profiler.py +1 -1
- {compass_kb_validation-2.9.0/ingestion_validation → compass_kb_validation-3.0.0/compass}/provenance.py +3 -3
- {compass_kb_validation-2.9.0/ingestion_validation → compass_kb_validation-3.0.0/compass}/providers/__init__.py +6 -6
- {compass_kb_validation-2.9.0/ingestion_validation → compass_kb_validation-3.0.0/compass}/providers/embedding.py +1 -1
- {compass_kb_validation-2.9.0/ingestion_validation → compass_kb_validation-3.0.0/compass}/providers/graph.py +1 -1
- {compass_kb_validation-2.9.0/ingestion_validation → compass_kb_validation-3.0.0/compass}/providers/source.py +1 -1
- {compass_kb_validation-2.9.0/ingestion_validation → compass_kb_validation-3.0.0/compass}/providers/storage.py +1 -1
- {compass_kb_validation-2.9.0/ingestion_validation → compass_kb_validation-3.0.0/compass}/providers/vectorstore.py +1 -1
- {compass_kb_validation-2.9.0/ingestion_validation → compass_kb_validation-3.0.0/compass}/report/__init__.py +7 -7
- {compass_kb_validation-2.9.0/ingestion_validation → compass_kb_validation-3.0.0/compass}/report/analysis.py +1 -1
- {compass_kb_validation-2.9.0/ingestion_validation → compass_kb_validation-3.0.0/compass}/report/audit.py +1 -1
- {compass_kb_validation-2.9.0/ingestion_validation → compass_kb_validation-3.0.0/compass}/report/export.py +1 -1
- {compass_kb_validation-2.9.0/ingestion_validation → compass_kb_validation-3.0.0/compass}/report/shell.py +3 -3
- {compass_kb_validation-2.9.0/ingestion_validation → compass_kb_validation-3.0.0/compass}/retrieval_analysis.py +4 -4
- {compass_kb_validation-2.9.0/ingestion_validation → compass_kb_validation-3.0.0/compass}/trend_tracker.py +2 -2
- compass_kb_validation-3.0.0/compass/validators/__init__.py +19 -0
- {compass_kb_validation-2.9.0/ingestion_validation → compass_kb_validation-3.0.0/compass}/validators/api_upload.py +3 -3
- {compass_kb_validation-2.9.0/ingestion_validation → compass_kb_validation-3.0.0/compass}/validators/base.py +1 -1
- {compass_kb_validation-2.9.0/ingestion_validation → compass_kb_validation-3.0.0/compass}/validators/base_sparql.py +3 -3
- {compass_kb_validation-2.9.0/ingestion_validation → compass_kb_validation-3.0.0/compass}/validators/cross_stage.py +3 -3
- {compass_kb_validation-2.9.0/ingestion_validation → compass_kb_validation-3.0.0/compass}/validators/graphdb_metadata.py +3 -3
- {compass_kb_validation-2.9.0/ingestion_validation → compass_kb_validation-3.0.0/compass}/validators/neptune_metadata.py +3 -3
- {compass_kb_validation-2.9.0/ingestion_validation → compass_kb_validation-3.0.0/compass}/validators/redis_chunks.py +6 -6
- {compass_kb_validation-2.9.0/ingestion_validation → compass_kb_validation-3.0.0/compass}/validators/registry.py +10 -10
- {compass_kb_validation-2.9.0/ingestion_validation → compass_kb_validation-3.0.0/compass}/validators/retrieval_quality.py +9 -9
- {compass_kb_validation-2.9.0/ingestion_validation → compass_kb_validation-3.0.0/compass}/validators/s3_storage.py +6 -6
- {compass_kb_validation-2.9.0 → compass_kb_validation-3.0.0}/compass_kb_validation.egg-info/PKG-INFO +6 -6
- compass_kb_validation-3.0.0/compass_kb_validation.egg-info/SOURCES.txt +119 -0
- {compass_kb_validation-2.9.0 → compass_kb_validation-3.0.0}/compass_kb_validation.egg-info/entry_points.txt +1 -1
- {compass_kb_validation-2.9.0 → compass_kb_validation-3.0.0}/compass_kb_validation.egg-info/top_level.txt +1 -0
- {compass_kb_validation-2.9.0 → compass_kb_validation-3.0.0}/discover_and_validate.py +19 -19
- compass_kb_validation-3.0.0/ingestion_validation/__init__.py +52 -0
- {compass_kb_validation-2.9.0 → compass_kb_validation-3.0.0}/profile_kb.py +4 -4
- {compass_kb_validation-2.9.0 → compass_kb_validation-3.0.0}/pyproject.toml +3 -3
- {compass_kb_validation-2.9.0 → compass_kb_validation-3.0.0}/run_validation.py +8 -8
- {compass_kb_validation-2.9.0 → compass_kb_validation-3.0.0}/tests/test_alt_adapters.py +4 -4
- {compass_kb_validation-2.9.0 → compass_kb_validation-3.0.0}/tests/test_analysis_report.py +6 -6
- {compass_kb_validation-2.9.0 → compass_kb_validation-3.0.0}/tests/test_api_upload.py +4 -4
- {compass_kb_validation-2.9.0 → compass_kb_validation-3.0.0}/tests/test_ask.py +12 -12
- {compass_kb_validation-2.9.0 → compass_kb_validation-3.0.0}/tests/test_baseline.py +2 -2
- {compass_kb_validation-2.9.0 → compass_kb_validation-3.0.0}/tests/test_check_catalog.py +6 -6
- {compass_kb_validation-2.9.0 → compass_kb_validation-3.0.0}/tests/test_citation.py +3 -3
- {compass_kb_validation-2.9.0 → compass_kb_validation-3.0.0}/tests/test_cli.py +6 -6
- compass_kb_validation-3.0.0/tests/test_compat_shim.py +48 -0
- {compass_kb_validation-2.9.0 → compass_kb_validation-3.0.0}/tests/test_config.py +3 -3
- {compass_kb_validation-2.9.0 → compass_kb_validation-3.0.0}/tests/test_config_lint.py +7 -7
- {compass_kb_validation-2.9.0 → compass_kb_validation-3.0.0}/tests/test_content_inspect.py +1 -1
- {compass_kb_validation-2.9.0 → compass_kb_validation-3.0.0}/tests/test_corpus.py +3 -3
- {compass_kb_validation-2.9.0 → compass_kb_validation-3.0.0}/tests/test_corpus_health.py +6 -6
- {compass_kb_validation-2.9.0 → compass_kb_validation-3.0.0}/tests/test_coverage.py +4 -4
- {compass_kb_validation-2.9.0 → compass_kb_validation-3.0.0}/tests/test_cross_stage.py +4 -4
- {compass_kb_validation-2.9.0 → compass_kb_validation-3.0.0}/tests/test_diagnostics.py +1 -1
- {compass_kb_validation-2.9.0 → compass_kb_validation-3.0.0}/tests/test_discover_cli.py +10 -10
- {compass_kb_validation-2.9.0 → compass_kb_validation-3.0.0}/tests/test_embedding_drift.py +7 -7
- {compass_kb_validation-2.9.0 → compass_kb_validation-3.0.0}/tests/test_eval_interop.py +8 -8
- {compass_kb_validation-2.9.0 → compass_kb_validation-3.0.0}/tests/test_evidence.py +5 -5
- {compass_kb_validation-2.9.0 → compass_kb_validation-3.0.0}/tests/test_graph_transport.py +3 -3
- {compass_kb_validation-2.9.0 → compass_kb_validation-3.0.0}/tests/test_graph_validators.py +6 -6
- {compass_kb_validation-2.9.0 → compass_kb_validation-3.0.0}/tests/test_grounding.py +2 -2
- {compass_kb_validation-2.9.0 → compass_kb_validation-3.0.0}/tests/test_init_wizard.py +6 -6
- {compass_kb_validation-2.9.0 → compass_kb_validation-3.0.0}/tests/test_manifest.py +1 -1
- {compass_kb_validation-2.9.0 → compass_kb_validation-3.0.0}/tests/test_mcp.py +4 -4
- {compass_kb_validation-2.9.0 → compass_kb_validation-3.0.0}/tests/test_migration.py +4 -4
- {compass_kb_validation-2.9.0 → compass_kb_validation-3.0.0}/tests/test_models.py +1 -1
- {compass_kb_validation-2.9.0 → compass_kb_validation-3.0.0}/tests/test_neptune_bugfixes.py +9 -9
- {compass_kb_validation-2.9.0 → compass_kb_validation-3.0.0}/tests/test_neptune_bugfixes2.py +11 -11
- {compass_kb_validation-2.9.0 → compass_kb_validation-3.0.0}/tests/test_notifications.py +2 -2
- {compass_kb_validation-2.9.0 → compass_kb_validation-3.0.0}/tests/test_pipeline.py +4 -4
- {compass_kb_validation-2.9.0 → compass_kb_validation-3.0.0}/tests/test_profiler.py +3 -3
- {compass_kb_validation-2.9.0 → compass_kb_validation-3.0.0}/tests/test_providers.py +15 -15
- {compass_kb_validation-2.9.0 → compass_kb_validation-3.0.0}/tests/test_redis_chunks.py +5 -5
- {compass_kb_validation-2.9.0 → compass_kb_validation-3.0.0}/tests/test_registry.py +5 -5
- {compass_kb_validation-2.9.0 → compass_kb_validation-3.0.0}/tests/test_remediation.py +6 -6
- {compass_kb_validation-2.9.0 → compass_kb_validation-3.0.0}/tests/test_reporting.py +7 -7
- {compass_kb_validation-2.9.0 → compass_kb_validation-3.0.0}/tests/test_retrieval_assertions.py +4 -4
- {compass_kb_validation-2.9.0 → compass_kb_validation-3.0.0}/tests/test_retrieval_quality.py +4 -4
- {compass_kb_validation-2.9.0 → compass_kb_validation-3.0.0}/tests/test_review_hardening.py +6 -6
- {compass_kb_validation-2.9.0 → compass_kb_validation-3.0.0}/tests/test_sources.py +9 -9
- {compass_kb_validation-2.9.0 → compass_kb_validation-3.0.0}/tests/test_storage_validator.py +4 -4
- {compass_kb_validation-2.9.0 → compass_kb_validation-3.0.0}/tests/test_trends.py +2 -2
- {compass_kb_validation-2.9.0 → compass_kb_validation-3.0.0}/tests/test_universal_concerns.py +10 -10
- {compass_kb_validation-2.9.0 → compass_kb_validation-3.0.0}/tests/test_utils.py +1 -1
- {compass_kb_validation-2.9.0 → compass_kb_validation-3.0.0}/tests/test_vectorstore_filters.py +3 -3
- compass_kb_validation-2.9.0/compass_kb_validation.egg-info/SOURCES.txt +0 -117
- compass_kb_validation-2.9.0/ingestion_validation/validators/__init__.py +0 -19
- {compass_kb_validation-2.9.0 → compass_kb_validation-3.0.0}/LICENSE +0 -0
- {compass_kb_validation-2.9.0/ingestion_validation → compass_kb_validation-3.0.0/compass}/baseline.py +0 -0
- {compass_kb_validation-2.9.0/ingestion_validation → compass_kb_validation-3.0.0/compass}/chunk_coherence.py +0 -0
- {compass_kb_validation-2.9.0/ingestion_validation → compass_kb_validation-3.0.0/compass}/citation.py +0 -0
- {compass_kb_validation-2.9.0/ingestion_validation → compass_kb_validation-3.0.0/compass}/content_inspect.py +0 -0
- {compass_kb_validation-2.9.0/ingestion_validation → compass_kb_validation-3.0.0/compass}/corpus.py +0 -0
- {compass_kb_validation-2.9.0/ingestion_validation → compass_kb_validation-3.0.0/compass}/diagnostics.py +0 -0
- {compass_kb_validation-2.9.0/ingestion_validation → compass_kb_validation-3.0.0/compass}/embedding_drift.py +0 -0
- {compass_kb_validation-2.9.0/ingestion_validation → compass_kb_validation-3.0.0/compass}/eval_interop.py +0 -0
- {compass_kb_validation-2.9.0/ingestion_validation → compass_kb_validation-3.0.0/compass}/grounding.py +0 -0
- {compass_kb_validation-2.9.0/ingestion_validation → compass_kb_validation-3.0.0/compass}/init_wizard.py +0 -0
- {compass_kb_validation-2.9.0/ingestion_validation → compass_kb_validation-3.0.0/compass}/models/__init__.py +0 -0
- {compass_kb_validation-2.9.0/ingestion_validation → compass_kb_validation-3.0.0/compass}/remediation.py +0 -0
- {compass_kb_validation-2.9.0/ingestion_validation → compass_kb_validation-3.0.0/compass}/report/_report_css.py +0 -0
- {compass_kb_validation-2.9.0/ingestion_validation → compass_kb_validation-3.0.0/compass}/report/_report_js.py +0 -0
- {compass_kb_validation-2.9.0/ingestion_validation → compass_kb_validation-3.0.0/compass}/text_probes.py +0 -0
- {compass_kb_validation-2.9.0/ingestion_validation → compass_kb_validation-3.0.0/compass}/utils/__init__.py +0 -0
- {compass_kb_validation-2.9.0 → compass_kb_validation-3.0.0}/compass_kb_validation.egg-info/dependency_links.txt +0 -0
- {compass_kb_validation-2.9.0 → compass_kb_validation-3.0.0}/compass_kb_validation.egg-info/requires.txt +0 -0
- {compass_kb_validation-2.9.0 → compass_kb_validation-3.0.0}/setup.cfg +0 -0
- {compass_kb_validation-2.9.0 → compass_kb_validation-3.0.0}/tests/test_benchmark.py +0 -0
- {compass_kb_validation-2.9.0 → compass_kb_validation-3.0.0}/tests/test_discovery_parallel.py +0 -0
- {compass_kb_validation-2.9.0 → compass_kb_validation-3.0.0}/tests/test_gate.py +0 -0
- {compass_kb_validation-2.9.0 → compass_kb_validation-3.0.0}/tests/test_run_cli.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: compass-kb-validation
|
|
3
|
-
Version:
|
|
3
|
+
Version: 3.0.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
|
|
@@ -303,7 +303,7 @@ a mock ingestion API — see **[integration/README.md](integration/README.md)**.
|
|
|
303
303
|
compass/
|
|
304
304
|
├── run_validation.py # Entry point — live ingestion validation
|
|
305
305
|
├── discover_and_validate.py # Entry point — post-hoc discovery
|
|
306
|
-
├──
|
|
306
|
+
├── compass/ # Main package
|
|
307
307
|
│ ├── models/ # StepResult / PipelineResult (stdlib dataclasses)
|
|
308
308
|
│ ├── config/ # Layered YAML config + typed Settings
|
|
309
309
|
│ ├── utils/ # Run-id, logging, polling w/ backoff
|
|
@@ -391,9 +391,9 @@ environments:
|
|
|
391
391
|
Steps are declarative — register a validator and reference it in `pipeline.steps`:
|
|
392
392
|
|
|
393
393
|
```python
|
|
394
|
-
from
|
|
395
|
-
from
|
|
396
|
-
from
|
|
394
|
+
from compass.validators.base import BaseValidator
|
|
395
|
+
from compass.validators.registry import register_step, StepSpec
|
|
396
|
+
from compass.models import StepResult, StepStatus
|
|
397
397
|
|
|
398
398
|
class PiiRedactionValidator(BaseValidator):
|
|
399
399
|
step_name = "PII Redaction"
|
|
@@ -420,7 +420,7 @@ the KB is not retrieval-ready. Every entry point returns a CI-friendly exit
|
|
|
420
420
|
code — **0 = gate passed, 1 = gate failed, 2 = config error** — and emits JUnit
|
|
421
421
|
XML for any CI system.
|
|
422
422
|
|
|
423
|
-
> **Reliable exit codes:** invoke the gate via `python -m
|
|
423
|
+
> **Reliable exit codes:** invoke the gate via `python -m compass discover …`
|
|
424
424
|
> or the `compass-discover` console script — both `sys.exit()` the code directly. Avoid
|
|
425
425
|
> piping (`… | tee`) which returns the pipe's exit code, and note that the `compass` shim in
|
|
426
426
|
> Git-Bash on Windows can drop the code. To verify in a shell: `… ; echo $?` (bash) or
|
|
@@ -236,7 +236,7 @@ a mock ingestion API — see **[integration/README.md](integration/README.md)**.
|
|
|
236
236
|
compass/
|
|
237
237
|
├── run_validation.py # Entry point — live ingestion validation
|
|
238
238
|
├── discover_and_validate.py # Entry point — post-hoc discovery
|
|
239
|
-
├──
|
|
239
|
+
├── compass/ # Main package
|
|
240
240
|
│ ├── models/ # StepResult / PipelineResult (stdlib dataclasses)
|
|
241
241
|
│ ├── config/ # Layered YAML config + typed Settings
|
|
242
242
|
│ ├── utils/ # Run-id, logging, polling w/ backoff
|
|
@@ -324,9 +324,9 @@ environments:
|
|
|
324
324
|
Steps are declarative — register a validator and reference it in `pipeline.steps`:
|
|
325
325
|
|
|
326
326
|
```python
|
|
327
|
-
from
|
|
328
|
-
from
|
|
329
|
-
from
|
|
327
|
+
from compass.validators.base import BaseValidator
|
|
328
|
+
from compass.validators.registry import register_step, StepSpec
|
|
329
|
+
from compass.models import StepResult, StepStatus
|
|
330
330
|
|
|
331
331
|
class PiiRedactionValidator(BaseValidator):
|
|
332
332
|
step_name = "PII Redaction"
|
|
@@ -353,7 +353,7 @@ the KB is not retrieval-ready. Every entry point returns a CI-friendly exit
|
|
|
353
353
|
code — **0 = gate passed, 1 = gate failed, 2 = config error** — and emits JUnit
|
|
354
354
|
XML for any CI system.
|
|
355
355
|
|
|
356
|
-
> **Reliable exit codes:** invoke the gate via `python -m
|
|
356
|
+
> **Reliable exit codes:** invoke the gate via `python -m compass discover …`
|
|
357
357
|
> or the `compass-discover` console script — both `sys.exit()` the code directly. Avoid
|
|
358
358
|
> piping (`… | tee`) which returns the pipe's exit code, and note that the `compass` shim in
|
|
359
359
|
> Git-Bash on Windows can drop the code. To verify in a shell: `… ; echo $?` (bash) or
|
{compass_kb_validation-2.9.0/ingestion_validation → compass_kb_validation-3.0.0/compass}/__main__.py
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"""Allow `python -m
|
|
1
|
+
"""Allow `python -m compass ...` as a portable entry point.
|
|
2
2
|
|
|
3
3
|
A reliable fallback when the installed `compass` console script isn't on PATH or
|
|
4
4
|
hits a permission quirk (e.g. Git Bash on Windows resolving the non-exe wrapper).
|
|
@@ -6,7 +6,7 @@ hits a permission quirk (e.g. Git Bash on Windows resolving the non-exe wrapper)
|
|
|
6
6
|
|
|
7
7
|
import sys
|
|
8
8
|
|
|
9
|
-
from
|
|
9
|
+
from compass.cli import main
|
|
10
10
|
|
|
11
11
|
if __name__ == "__main__":
|
|
12
12
|
sys.exit(main(sys.argv[1:]))
|
{compass_kb_validation-2.9.0/ingestion_validation → compass_kb_validation-3.0.0/compass}/ask.py
RENAMED
|
@@ -15,8 +15,8 @@ from __future__ import annotations
|
|
|
15
15
|
import struct
|
|
16
16
|
from typing import Any
|
|
17
17
|
|
|
18
|
-
from
|
|
19
|
-
from
|
|
18
|
+
from compass.config import Settings
|
|
19
|
+
from compass.providers import get_adapter
|
|
20
20
|
|
|
21
21
|
|
|
22
22
|
def pack_f32(vec: list[float]) -> bytes:
|
{compass_kb_validation-2.9.0/ingestion_validation → compass_kb_validation-3.0.0/compass}/cli.py
RENAMED
|
@@ -154,7 +154,7 @@ reports/
|
|
|
154
154
|
"""
|
|
155
155
|
|
|
156
156
|
# A ready GitHub Actions gate: validate the KB on every push and fail the build on a
|
|
157
|
-
# regression. `python -m
|
|
157
|
+
# regression. `python -m compass` (not the `compass` shim) so the exit code
|
|
158
158
|
# is never dropped by a wrapper.
|
|
159
159
|
_CI_WORKFLOW = """\
|
|
160
160
|
# COMPASS knowledge-base validation gate. Fails the build if the KB regresses.
|
|
@@ -183,7 +183,7 @@ jobs:
|
|
|
183
183
|
REDIS_PASSWORD: ${{{{ secrets.REDIS_PASSWORD }}}}
|
|
184
184
|
# OPENAI_API_KEY: ${{{{ secrets.OPENAI_API_KEY }}}}
|
|
185
185
|
run: |
|
|
186
|
-
python -m
|
|
186
|
+
python -m compass discover --project {name} \\
|
|
187
187
|
--fail-under 99 \\
|
|
188
188
|
--against baselines/{name}.json --fail-on-regression
|
|
189
189
|
"""
|
|
@@ -214,7 +214,7 @@ def cmd_init(argv: list[str]) -> int:
|
|
|
214
214
|
print(" --interactive needs a terminal (stdin is not a TTY). "
|
|
215
215
|
"Run `compass init <name>` for the non-interactive scaffold.")
|
|
216
216
|
return 2
|
|
217
|
-
from
|
|
217
|
+
from compass.init_wizard import run_wizard
|
|
218
218
|
print(" COMPASS project wizard - answer a few questions (Enter accepts the default).\n")
|
|
219
219
|
result = run_wizard(name)
|
|
220
220
|
name, project_yaml, env_example = result["name"], result["project_yaml"], result["env_example"]
|
|
@@ -282,8 +282,8 @@ def cmd_lint(argv: list[str]) -> int:
|
|
|
282
282
|
help="Exit non-zero on warnings AND advisories too, not just errors.")
|
|
283
283
|
args = p.parse_args(argv)
|
|
284
284
|
|
|
285
|
-
from
|
|
286
|
-
from
|
|
285
|
+
from compass.config import load_settings, project_config_file
|
|
286
|
+
from compass.config_lint import format_findings, lint_settings
|
|
287
287
|
|
|
288
288
|
if args.project and project_config_file(args.project) is None:
|
|
289
289
|
print(f" Project '{args.project}' not found (config/projects/{args.project}.yaml).")
|
|
@@ -316,7 +316,7 @@ def _reach(fn) -> tuple[bool, str]:
|
|
|
316
316
|
|
|
317
317
|
def _diag_lines(target: str, default_port: int, *, tls=None) -> list[str]:
|
|
318
318
|
"""Run DNS/TCP/TLS diagnostics on one endpoint and format them for the console."""
|
|
319
|
-
from
|
|
319
|
+
from compass.diagnostics import diagnose_endpoint
|
|
320
320
|
|
|
321
321
|
d = diagnose_endpoint(target, default_port, tls=tls)
|
|
322
322
|
out: list[str] = []
|
|
@@ -369,7 +369,7 @@ def cmd_doctor(argv: list[str]) -> int:
|
|
|
369
369
|
if args.all_projects:
|
|
370
370
|
return _doctor_all_projects(args)
|
|
371
371
|
|
|
372
|
-
from
|
|
372
|
+
from compass.config import find_project_root, load_settings, validate_config
|
|
373
373
|
|
|
374
374
|
try:
|
|
375
375
|
settings = load_settings(project=args.project, env=args.env)
|
|
@@ -404,7 +404,7 @@ def cmd_doctor(argv: list[str]) -> int:
|
|
|
404
404
|
|
|
405
405
|
def _doctor_stages(s) -> list:
|
|
406
406
|
"""(label, configured?, probe, detail, diagnostic-target, default-port, tls) per stage."""
|
|
407
|
-
from
|
|
407
|
+
from compass.providers import get_adapter
|
|
408
408
|
return [
|
|
409
409
|
("Vector store", bool(s.redis.host),
|
|
410
410
|
lambda: get_adapter("vectorstore", s.redis.provider, config=s.redis).ping(),
|
|
@@ -458,7 +458,7 @@ def _doctor_run(settings, *, verbose: bool, indent: str = " ") -> tuple[int, bo
|
|
|
458
458
|
|
|
459
459
|
def _doctor_all_projects(args) -> int:
|
|
460
460
|
"""Run connectivity across every project under config/projects/ (ENH-34)."""
|
|
461
|
-
from
|
|
461
|
+
from compass.config import list_projects, load_settings
|
|
462
462
|
|
|
463
463
|
names = list_projects()
|
|
464
464
|
if not names:
|
|
@@ -518,7 +518,7 @@ def _settings_from_check(args):
|
|
|
518
518
|
"""Build an in-memory Settings from check flags / connection URL (no project YAML)."""
|
|
519
519
|
import os
|
|
520
520
|
|
|
521
|
-
from
|
|
521
|
+
from compass.config import Settings
|
|
522
522
|
|
|
523
523
|
settings = Settings()
|
|
524
524
|
r = settings.redis
|
|
@@ -598,10 +598,10 @@ def cmd_check(argv: list[str]) -> int:
|
|
|
598
598
|
return 2
|
|
599
599
|
|
|
600
600
|
import discover_and_validate as dav
|
|
601
|
-
from
|
|
602
|
-
from
|
|
603
|
-
from
|
|
604
|
-
from
|
|
601
|
+
from compass.corpus import analyze_corpus
|
|
602
|
+
from compass.profiler import apply_profile_to_settings, profile_kb
|
|
603
|
+
from compass.report import generate_batch_dashboard
|
|
604
|
+
from compass.utils import configure_logging, new_run_id
|
|
605
605
|
|
|
606
606
|
configure_logging()
|
|
607
607
|
run_id = new_run_id()
|
|
@@ -665,7 +665,7 @@ def cmd_check(argv: list[str]) -> int:
|
|
|
665
665
|
|
|
666
666
|
def _baseline_step(args, results, corpus, project: str, run_id: str, profile: dict | None) -> bool:
|
|
667
667
|
"""Save a baseline and/or diff against one. Returns True if a regression was found."""
|
|
668
|
-
from
|
|
668
|
+
from compass import baseline as bl
|
|
669
669
|
|
|
670
670
|
if getattr(args, "save_baseline", None) is not None:
|
|
671
671
|
out = args.save_baseline or f"baselines/{project}.json"
|
|
@@ -690,9 +690,9 @@ def cmd_demo(argv: list[str]) -> int:
|
|
|
690
690
|
p.add_argument("--no-open", action="store_true")
|
|
691
691
|
args = p.parse_args(argv)
|
|
692
692
|
|
|
693
|
-
from
|
|
694
|
-
from
|
|
695
|
-
from
|
|
693
|
+
from compass.corpus import analyze_corpus
|
|
694
|
+
from compass.models import PipelineResult, StepResult, StepStatus
|
|
695
|
+
from compass.report import generate_batch_dashboard
|
|
696
696
|
|
|
697
697
|
def _doc(i: int, mode: str) -> dict:
|
|
698
698
|
# mode: "clean" = all pass; "advisory" = PASSED but with warn/neutral misses
|
|
@@ -761,7 +761,7 @@ def _supports_filters(provider: str) -> bool:
|
|
|
761
761
|
Asked of the registered adapter class (a declared capability), never inferred from
|
|
762
762
|
the vendor name - so a new backend that supports filters works with no CLI change.
|
|
763
763
|
"""
|
|
764
|
-
from
|
|
764
|
+
from compass.providers import capability
|
|
765
765
|
|
|
766
766
|
return bool(capability("vectorstore", provider, "supports_metadata_filters", False))
|
|
767
767
|
|
|
@@ -803,10 +803,10 @@ def cmd_ask(argv: list[str]) -> int:
|
|
|
803
803
|
|
|
804
804
|
import json as _json
|
|
805
805
|
|
|
806
|
-
from
|
|
807
|
-
from
|
|
808
|
-
from
|
|
809
|
-
from
|
|
806
|
+
from compass import __version__
|
|
807
|
+
from compass.ask import ask_kb, format_text, parse_filters
|
|
808
|
+
from compass.config import load_settings, project_config_file
|
|
809
|
+
from compass.eval_interop import normalize_filters, to_eval_case
|
|
810
810
|
|
|
811
811
|
question = " ".join(args.question).strip()
|
|
812
812
|
if not question and not args.batch:
|
|
@@ -904,7 +904,7 @@ def cmd_mcp(argv: list[str]) -> int:
|
|
|
904
904
|
|
|
905
905
|
import json as _json
|
|
906
906
|
|
|
907
|
-
from
|
|
907
|
+
from compass.mcp_server import serve, vscode_config
|
|
908
908
|
|
|
909
909
|
if args.print_config:
|
|
910
910
|
print(_json.dumps(vscode_config(args.project, args.env or None), indent=2))
|
|
@@ -918,7 +918,7 @@ def cmd_mcp(argv: list[str]) -> int:
|
|
|
918
918
|
except Exception: # noqa: BLE001 - dotenv optional / file absent
|
|
919
919
|
pass
|
|
920
920
|
|
|
921
|
-
from
|
|
921
|
+
from compass.config import load_settings, project_config_file
|
|
922
922
|
if args.project and project_config_file(args.project) is None:
|
|
923
923
|
print(f" Project '{args.project}' not found (config/projects/{args.project}.yaml).")
|
|
924
924
|
return 2
|
|
@@ -965,8 +965,8 @@ def cmd_migrate(argv: list[str]) -> int:
|
|
|
965
965
|
|
|
966
966
|
import json as _json
|
|
967
967
|
|
|
968
|
-
from
|
|
969
|
-
from
|
|
968
|
+
from compass.config import load_settings, project_config_file
|
|
969
|
+
from compass.retrieval_analysis import format_migration, migration_report
|
|
970
970
|
|
|
971
971
|
if args.project and project_config_file(args.project) is None:
|
|
972
972
|
print(f" Project '{args.project}' not found (config/projects/{args.project}.yaml).")
|
|
@@ -994,7 +994,7 @@ def cmd_migrate(argv: list[str]) -> int:
|
|
|
994
994
|
return 1
|
|
995
995
|
|
|
996
996
|
if args.html or args.open:
|
|
997
|
-
from
|
|
997
|
+
from compass.report.analysis import generate_migration_report
|
|
998
998
|
html_path = generate_migration_report(payload, args.html or "reports/migration-report.html",
|
|
999
999
|
project=args.project or "")
|
|
1000
1000
|
print(f" HTML report: {html_path}")
|
|
@@ -1066,8 +1066,8 @@ def cmd_coverage(argv: list[str]) -> int:
|
|
|
1066
1066
|
|
|
1067
1067
|
import json as _json
|
|
1068
1068
|
|
|
1069
|
-
from
|
|
1070
|
-
from
|
|
1069
|
+
from compass.config import load_settings, project_config_file
|
|
1070
|
+
from compass.retrieval_analysis import coverage_report, format_coverage
|
|
1071
1071
|
|
|
1072
1072
|
if args.project and project_config_file(args.project) is None:
|
|
1073
1073
|
print(f" Project '{args.project}' not found (config/projects/{args.project}.yaml).")
|
|
@@ -1084,8 +1084,8 @@ def cmd_coverage(argv: list[str]) -> int:
|
|
|
1084
1084
|
print(f" No questions found in {args.questions}.")
|
|
1085
1085
|
return 2
|
|
1086
1086
|
|
|
1087
|
-
from
|
|
1088
|
-
from
|
|
1087
|
+
from compass.ask import parse_filters
|
|
1088
|
+
from compass.eval_interop import normalize_filters
|
|
1089
1089
|
filters = parse_filters(args.filter)
|
|
1090
1090
|
if args.filter_json:
|
|
1091
1091
|
try:
|
|
@@ -1110,7 +1110,7 @@ def cmd_coverage(argv: list[str]) -> int:
|
|
|
1110
1110
|
return 1
|
|
1111
1111
|
|
|
1112
1112
|
if args.html or args.open:
|
|
1113
|
-
from
|
|
1113
|
+
from compass.report.analysis import generate_coverage_report
|
|
1114
1114
|
html_path = generate_coverage_report(payload, args.html or "reports/coverage-report.html",
|
|
1115
1115
|
project=args.project or "")
|
|
1116
1116
|
print(f" HTML report: {html_path}")
|
|
@@ -1170,9 +1170,9 @@ def cmd_compare(argv: list[str]) -> int:
|
|
|
1170
1170
|
|
|
1171
1171
|
import json as _json
|
|
1172
1172
|
|
|
1173
|
-
from
|
|
1174
|
-
from
|
|
1175
|
-
from
|
|
1173
|
+
from compass.config import load_settings, project_config_file
|
|
1174
|
+
from compass.eval_interop import load_ground_truth
|
|
1175
|
+
from compass.retrieval_analysis import comparison_report, format_comparison
|
|
1176
1176
|
|
|
1177
1177
|
if args.project and project_config_file(args.project) is None:
|
|
1178
1178
|
print(f" Project '{args.project}' not found (config/projects/{args.project}.yaml).")
|
|
@@ -1216,7 +1216,7 @@ def cmd_compare(argv: list[str]) -> int:
|
|
|
1216
1216
|
return 1
|
|
1217
1217
|
|
|
1218
1218
|
if args.html or args.open:
|
|
1219
|
-
from
|
|
1219
|
+
from compass.report.analysis import generate_comparison_report
|
|
1220
1220
|
html_path = generate_comparison_report(payload, args.html or "reports/comparison-report.html",
|
|
1221
1221
|
project=args.project or "")
|
|
1222
1222
|
print(f" HTML report: {html_path}")
|
|
@@ -1279,8 +1279,8 @@ def cmd_evidence(argv: list[str]) -> int:
|
|
|
1279
1279
|
except Exception: # noqa: BLE001 - dotenv optional / file absent
|
|
1280
1280
|
pass
|
|
1281
1281
|
|
|
1282
|
-
from
|
|
1283
|
-
from
|
|
1282
|
+
from compass import evidence as ev
|
|
1283
|
+
from compass.config import load_settings, project_config_file
|
|
1284
1284
|
|
|
1285
1285
|
if args.project and project_config_file(args.project) is None:
|
|
1286
1286
|
print(f" Project '{args.project}' not found (config/projects/{args.project}.yaml).")
|
|
@@ -1316,7 +1316,7 @@ def cmd_evidence(argv: list[str]) -> int:
|
|
|
1316
1316
|
return 1
|
|
1317
1317
|
|
|
1318
1318
|
if args.format == "html":
|
|
1319
|
-
from
|
|
1319
|
+
from compass.report.audit import generate_evidence_report
|
|
1320
1320
|
out = generate_evidence_report(payload, args.output or f"reports/evidence-{args.project or 'kb'}.html",
|
|
1321
1321
|
project=args.project or "")
|
|
1322
1322
|
print(f" HTML report: {out}")
|
|
@@ -1342,7 +1342,7 @@ def cmd_evidence(argv: list[str]) -> int:
|
|
|
1342
1342
|
|
|
1343
1343
|
|
|
1344
1344
|
def evidence_mod_all() -> tuple:
|
|
1345
|
-
from
|
|
1345
|
+
from compass.evidence import ALL_CHECKS
|
|
1346
1346
|
return ALL_CHECKS
|
|
1347
1347
|
|
|
1348
1348
|
|
|
@@ -1362,8 +1362,8 @@ def cmd_quality(argv: list[str]) -> int:
|
|
|
1362
1362
|
|
|
1363
1363
|
import json as _json
|
|
1364
1364
|
|
|
1365
|
-
from
|
|
1366
|
-
from
|
|
1365
|
+
from compass.config import load_settings, project_config_file
|
|
1366
|
+
from compass.corpus_health import format_quality, quality_report
|
|
1367
1367
|
|
|
1368
1368
|
if args.project and project_config_file(args.project) is None:
|
|
1369
1369
|
print(f" Project '{args.project}' not found (config/projects/{args.project}.yaml).")
|
|
@@ -1410,8 +1410,8 @@ def cmd_freshness(argv: list[str]) -> int:
|
|
|
1410
1410
|
|
|
1411
1411
|
import json as _json
|
|
1412
1412
|
|
|
1413
|
-
from
|
|
1414
|
-
from
|
|
1413
|
+
from compass.config import load_settings, project_config_file
|
|
1414
|
+
from compass.corpus_health import format_freshness, freshness_report
|
|
1415
1415
|
|
|
1416
1416
|
if args.project and project_config_file(args.project) is None:
|
|
1417
1417
|
print(f" Project '{args.project}' not found (config/projects/{args.project}.yaml).")
|
|
@@ -1442,8 +1442,8 @@ def _graph_doc_exists(settings):
|
|
|
1442
1442
|
"""Build a source-existence callback backed by a configured graph, using the
|
|
1443
1443
|
eval.citation_graph_ask SPARQL ASK template ("{doc}" substituted). Returns None if no
|
|
1444
1444
|
graph is configured/reachable, so the audit simply skips the extra check."""
|
|
1445
|
-
from
|
|
1446
|
-
from
|
|
1445
|
+
from compass.profiler import _configured_graph
|
|
1446
|
+
from compass.providers import get_adapter
|
|
1447
1447
|
|
|
1448
1448
|
cfg, provider = _configured_graph(settings)
|
|
1449
1449
|
template = getattr(settings.eval, "citation_graph_ask", "")
|
|
@@ -1489,9 +1489,9 @@ def cmd_grounding_audit(argv: list[str]) -> int:
|
|
|
1489
1489
|
|
|
1490
1490
|
import json as _json
|
|
1491
1491
|
|
|
1492
|
-
from
|
|
1493
|
-
from
|
|
1494
|
-
from
|
|
1492
|
+
from compass.config import load_settings, project_config_file
|
|
1493
|
+
from compass.grounding import render_report, run_audit
|
|
1494
|
+
from compass.providers import get_adapter
|
|
1495
1495
|
|
|
1496
1496
|
if args.project and project_config_file(args.project) is None:
|
|
1497
1497
|
print(f" Project '{args.project}' not found (config/projects/{args.project}.yaml).")
|
|
@@ -1559,7 +1559,7 @@ def cmd_grounding_audit(argv: list[str]) -> int:
|
|
|
1559
1559
|
results = [run_audit(rec, adapter, settings.eval, doc_exists=doc_exists) for rec in records]
|
|
1560
1560
|
|
|
1561
1561
|
if args.format == "html":
|
|
1562
|
-
from
|
|
1562
|
+
from compass.report.audit import generate_grounding_report
|
|
1563
1563
|
out = generate_grounding_report(results, args.output or f"reports/grounding-{args.project or 'kb'}.html",
|
|
1564
1564
|
project=args.project or "")
|
|
1565
1565
|
print(f" HTML report: {out}")
|
|
@@ -1646,7 +1646,7 @@ def cmd_selftest(argv: list[str]) -> int:
|
|
|
1646
1646
|
still sees 0 the code is dropped by a pipe or a stale/wrapped `compass`, not by COMPASS.
|
|
1647
1647
|
This exits with a distinctive code so the user can check it directly.
|
|
1648
1648
|
"""
|
|
1649
|
-
from
|
|
1649
|
+
from compass import __version__
|
|
1650
1650
|
|
|
1651
1651
|
print(f"compass {__version__}")
|
|
1652
1652
|
print(f" module: {__file__}")
|
|
@@ -1664,9 +1664,9 @@ def cmd_selftest(argv: list[str]) -> int:
|
|
|
1664
1664
|
print(" PowerShell: compass selftest ; echo \"exit=$LASTEXITCODE\"")
|
|
1665
1665
|
print(f" If you see exit={_SELFTEST_CODE}: exit codes propagate, so a 0 from a FAILED")
|
|
1666
1666
|
print(" `compass discover --fail-under ...` is a pipe (e.g. `| tee`) or a wrapper")
|
|
1667
|
-
print(" dropping it - use `python -m
|
|
1667
|
+
print(" dropping it - use `python -m compass discover ...` in CI.")
|
|
1668
1668
|
print(" If you see exit=0 here: your `compass` command is NOT this build (stale/shim);")
|
|
1669
|
-
print(" reinstall, or run `python -m
|
|
1669
|
+
print(" reinstall, or run `python -m compass selftest`.")
|
|
1670
1670
|
return _SELFTEST_CODE
|
|
1671
1671
|
|
|
1672
1672
|
|
|
@@ -1710,7 +1710,7 @@ Run `compass <command> --help` for command-specific options.
|
|
|
1710
1710
|
def main(argv: list[str] | None = None) -> int:
|
|
1711
1711
|
argv = list(sys.argv[1:] if argv is None else argv)
|
|
1712
1712
|
if argv and argv[0] in ("--version", "-V", "version"):
|
|
1713
|
-
from
|
|
1713
|
+
from compass import __version__
|
|
1714
1714
|
print(f"compass {__version__}")
|
|
1715
1715
|
return 0
|
|
1716
1716
|
if not argv or argv[0] in ("-h", "--help", "help"):
|
|
@@ -137,7 +137,7 @@ def _default_s3_checks() -> dict[str, bool]:
|
|
|
137
137
|
@dataclass
|
|
138
138
|
class S3Config:
|
|
139
139
|
# provider selects the storage adapter: s3 | minio | r2 | spaces | wasabi |
|
|
140
|
-
# azure_blob | gcs | ... (see
|
|
140
|
+
# azure_blob | gcs | ... (see compass/providers/storage.py)
|
|
141
141
|
provider: str = "s3"
|
|
142
142
|
# vendor-specific options (e.g. endpoint_url_env, addressing_style) passed
|
|
143
143
|
# verbatim to the adapter.
|
|
@@ -138,7 +138,7 @@ def _lint_skip_steps(settings: Any) -> list[Finding]:
|
|
|
138
138
|
if not skip:
|
|
139
139
|
return []
|
|
140
140
|
try:
|
|
141
|
-
from
|
|
141
|
+
from compass.validators.registry import registered_steps
|
|
142
142
|
known = list(registered_steps())
|
|
143
143
|
except Exception: # noqa: BLE001 - registry unavailable; skip this check rather than crash lint
|
|
144
144
|
return []
|
|
@@ -13,8 +13,8 @@ from collections import Counter
|
|
|
13
13
|
from datetime import datetime, timezone
|
|
14
14
|
from typing import Any, Optional
|
|
15
15
|
|
|
16
|
-
from
|
|
17
|
-
from
|
|
16
|
+
from compass.config import Settings
|
|
17
|
+
from compass.providers import get_adapter
|
|
18
18
|
|
|
19
19
|
_WORD = re.compile(r"\w+")
|
|
20
20
|
_SENTENCE_END = tuple(".!?\"')]}")
|
{compass_kb_validation-2.9.0/ingestion_validation → compass_kb_validation-3.0.0/compass}/evidence.py
RENAMED
|
@@ -17,9 +17,9 @@ import re
|
|
|
17
17
|
from dataclasses import dataclass, field
|
|
18
18
|
from typing import Any, Optional
|
|
19
19
|
|
|
20
|
-
from
|
|
21
|
-
from
|
|
22
|
-
from
|
|
20
|
+
from compass import text_probes
|
|
21
|
+
from compass.providers import get_adapter
|
|
22
|
+
from compass.retrieval_analysis import _cosine, _unpack_f32
|
|
23
23
|
|
|
24
24
|
ALL_CHECKS = ("paraphrase", "boundary_spanning", "exact_term",
|
|
25
25
|
"duplicate_chunks", "near_duplicate", "chunk_boundaries")
|
|
@@ -15,10 +15,10 @@ import json
|
|
|
15
15
|
import sys
|
|
16
16
|
from typing import Any
|
|
17
17
|
|
|
18
|
-
from
|
|
19
|
-
from
|
|
20
|
-
from
|
|
21
|
-
from
|
|
18
|
+
from compass import __version__
|
|
19
|
+
from compass.ask import ask_kb
|
|
20
|
+
from compass.config import Settings
|
|
21
|
+
from compass.providers import get_adapter
|
|
22
22
|
|
|
23
23
|
PROTOCOL_VERSION = "2024-11-05"
|
|
24
24
|
|
|
@@ -209,7 +209,7 @@ def serve(settings: Settings, stdin: Any = None, stdout: Any = None) -> None:
|
|
|
209
209
|
|
|
210
210
|
def vscode_config(project: str | None, env: str | None) -> dict:
|
|
211
211
|
"""A ready-to-paste .vscode/mcp.json snippet for this project."""
|
|
212
|
-
args = ["-m", "
|
|
212
|
+
args = ["-m", "compass", "mcp"]
|
|
213
213
|
if project:
|
|
214
214
|
args += ["--project", project]
|
|
215
215
|
if env:
|
|
@@ -6,11 +6,11 @@ import logging
|
|
|
6
6
|
import time
|
|
7
7
|
from typing import Callable, Optional
|
|
8
8
|
|
|
9
|
-
from
|
|
10
|
-
from
|
|
11
|
-
from
|
|
12
|
-
from
|
|
13
|
-
from
|
|
9
|
+
from compass.config import Settings
|
|
10
|
+
from compass.models import PipelineResult, StepResult, StepStatus
|
|
11
|
+
from compass.utils import get_run_id
|
|
12
|
+
from compass.validators.base import BaseValidator
|
|
13
|
+
from compass.validators.registry import build_validators, get_step, registered_steps
|
|
14
14
|
|
|
15
15
|
log = logging.getLogger(__name__)
|
|
16
16
|
|
|
@@ -86,7 +86,7 @@ class IngestionPipeline:
|
|
|
86
86
|
|
|
87
87
|
``settings.pipeline.steps`` lets a project declare its own pipeline shape
|
|
88
88
|
and order in YAML, including custom steps registered via
|
|
89
|
-
:mod:`
|
|
89
|
+
:mod:`compass.validators.registry`.
|
|
90
90
|
"""
|
|
91
91
|
return build_validators(self.settings, self.settings.pipeline.steps or None)
|
|
92
92
|
|
{compass_kb_validation-2.9.0/ingestion_validation → compass_kb_validation-3.0.0/compass}/profiler.py
RENAMED
|
@@ -13,7 +13,7 @@ from __future__ import annotations
|
|
|
13
13
|
from collections import Counter
|
|
14
14
|
from typing import Any
|
|
15
15
|
|
|
16
|
-
from
|
|
16
|
+
from compass.providers import get_adapter
|
|
17
17
|
|
|
18
18
|
# Content types that mean "no MIME metadata was set at upload" (informational only).
|
|
19
19
|
_GENERIC_MIME = {"", "(empty)", "binary/octet-stream", "application/octet-stream"}
|
|
@@ -145,7 +145,7 @@ def probe_provenance(
|
|
|
145
145
|
|
|
146
146
|
def inspect_and_extract(body: bytes, file_name: str) -> str:
|
|
147
147
|
"""Return the plain text of a source object using the multi-format inspector's extractors."""
|
|
148
|
-
from
|
|
148
|
+
from compass.content_inspect import detect_format
|
|
149
149
|
|
|
150
150
|
fmt = detect_format(body, file_name)
|
|
151
151
|
# Reuse the format handlers but keep only their extracted-text detail. Simpler: pull the
|
|
@@ -153,12 +153,12 @@ def inspect_and_extract(body: bytes, file_name: str) -> str:
|
|
|
153
153
|
if fmt == "pdf":
|
|
154
154
|
return _pdf_text(body)
|
|
155
155
|
if fmt in ("docx", "pptx", "xlsx"):
|
|
156
|
-
from
|
|
156
|
+
from compass.content_inspect import _zip_text
|
|
157
157
|
prefix = {"docx": "word/", "pptx": "ppt/slides/", "xlsx": "xl/"}[fmt]
|
|
158
158
|
text, _ = _zip_text(body, prefix)
|
|
159
159
|
return text or ""
|
|
160
160
|
if fmt in ("html", "xml"):
|
|
161
|
-
from
|
|
161
|
+
from compass.content_inspect import _strip_xml_text
|
|
162
162
|
cleaned = re.sub(rb"(?is)<(script|style)[^>]*>.*?</\1>", b" ", body)
|
|
163
163
|
return _strip_xml_text(cleaned)
|
|
164
164
|
if fmt == "text":
|
|
@@ -4,7 +4,7 @@ This is the extensibility backbone for supporting additional backends.
|
|
|
4
4
|
Each backend category — object storage, vector store, knowledge graph — defines
|
|
5
5
|
an adapter ABC. Concrete adapters register themselves under a vendor name:
|
|
6
6
|
|
|
7
|
-
from
|
|
7
|
+
from compass.providers import register
|
|
8
8
|
|
|
9
9
|
@register("storage", "azure_blob")
|
|
10
10
|
class AzureBlobAdapter(StorageAdapter):
|
|
@@ -33,11 +33,11 @@ _REGISTRY: dict[str, dict[str, Type[Any]]] = {}
|
|
|
33
33
|
# Built-in adapter modules imported lazily on first access of a category, so
|
|
34
34
|
# importing this package never forces optional SDKs (boto3, redis, ...) to load.
|
|
35
35
|
_BUILTIN_MODULES: dict[str, list[str]] = {
|
|
36
|
-
"storage": ["
|
|
37
|
-
"vectorstore": ["
|
|
38
|
-
"graph": ["
|
|
39
|
-
"source": ["
|
|
40
|
-
"embedding": ["
|
|
36
|
+
"storage": ["compass.providers.storage"],
|
|
37
|
+
"vectorstore": ["compass.providers.vectorstore"],
|
|
38
|
+
"graph": ["compass.providers.graph"],
|
|
39
|
+
"source": ["compass.providers.source"],
|
|
40
|
+
"embedding": ["compass.providers.embedding"],
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
_loaded_categories: set[str] = set()
|