Multi-tenant RAG: hybrid retrieval, chunking, embeddings, ingestion, PDF + image + repo pipelines, agent-extraction indexing, priority-aware ranking.
Actively maintained. Last release 7 days ago. A safe choice.
pip install matrx-ragmatrx-rag
Multi-tenant RAG: hybrid retrieval, chunking, embeddings, ingestion,
PDF + image + repo pipelines, agent-extraction indexing, NER/KG writes,
priority-aware ranking — extracted from aidream/services/rag/ so any
host (aidream's cloud server, matrx-local) can consume the same stack.
Cross-repo system-of-record: /Users/armanisadeghi/code/common-docs/systems/knowledge/rag/STATE.md — read it before touching this feature in ANY repo.
Editing rules for this package: CLAUDE.md · matrx_rag/FEATURE.md.
What it does
- Ingestion:
ingest_source(source_kind, source_id, ...)— chunk → embed → upsert; NER inline for non-code sources. - PDF / image / code repo pipelines with provenance.
- Hybrid search: pgvector HNSW + lexical FTS → RRF → optional Cohere → MMR.
- Priority-aware ranking: agent-extracted chunks with non-zero
priority. - Agent-extraction → RAG:
extraction_indexingmaterializes page-extraction payloads as chunks. - Data stores: curated buckets with scoped search.
- Eval harness: retrieval + answer quality assessment.
Host integration
- aidream wires the package in
aidream/package_integration.py::_configure_matrx_rag(NER extractor, embedding cache, ORM models, search callable). - aidream/services/rag/ is a re-export shim; HTTP routes live in
aidream/api/routers/rag.py. - Auto-ingest (gates, budget, scope suggestions) lives in
aidream/services/auto_ingest/— not in this package.
Schema
Migrations: matrx_rag/migrations/ (mirrored in db/migrations/ until package owns the runner).
ORM / pgvector notes: /Users/armanisadeghi/code/common-docs/systems/knowledge/projects/knowledge-system/README.md.
Package development
See for injection seams, test baselines, and the no--imports rule.