prismrag-patch
Free OSS RAG library with full API core parity — ingest, graph RAG search, communities, bridges, append.
Official site: prismrag.insightits.com/prismrag-lib.html · Product overview: INFO.md · PyPI: pypi.org/project/prismrag-patch
What's in 0.2.1
- No license key — Apache-2.0, pip-only, fully offline
PrismRAGclient — mirrors SaaS core endpoints locally- Graph RAG — word graph, Louvain communities, BFS retrieval
- Dual vectors — 768-d semantic + 256-d personal (RulesStrategy projection)
- Append + quality scoring — extend mappings without full retrain
- Step-by-step tests —
tests/test_lib_step*.py+ evaluation harness
Quick start — full RAG pipeline (no DB required)
from prismrag_patch import PrismRAG
mapping = {
"categories": [
{"slug": "medication", "label": "Medication"},
{"slug": "lab_results", "label": "Lab Results"},
],
"rules": [
{"word": "metformin", "category_slug": "medication"},
{"word": "troponin", "category_slug": "lab_results"},
],
}
rag = PrismRAG(mapping=mapping, tenant_id="demo")
job = rag.ingest(records=[
{"word": "metformin", "text": "metformin for diabetes"},
{"word": "troponin", "text": "troponin heart attack marker"},
])
print(job["status"], job["community_count"])
results = rag.search("What medications for diabetes?", top_k=5)
for hit in results["results"]:
print(hit["category_slug"], hit["chunk_ref"])
comms = rag.list_communities()
bridge = rag.create_bridge(comms[0]["community_id"], comms[1]["community_id"])
quality = rag.chunk_quality()
Vector DB adapters (Tier-1 remap)
Works with pgvector, ChromaDB, Pinecone, or Weaviate — bring your own embeddings:
from prismrag_patch import PrismRAGPatch
from prismrag_patch.adapters.pgvector import PgvectorAdapter
import psycopg2
patch = PrismRAGPatch(mapping=mapping) # no license_key
conn = psycopg2.connect("postgresql://user:pass@localhost/mydb")
adapter = PgvectorAdapter(patch, conn)
adapter.insert("metformin therapy", your_embed_fn("metformin therapy"))
PostgreSQL store (SaaS schema parity)
Use the same prismrag.* tables as production — no HTTP API required:
import os
from prismrag_patch import PrismRAG, PostgresStore
dsn = os.environ["PRISMRAG_DB_DSN"] # postgresql://user:pass@host:5432/prismrag
tenant_id = "10000000-0000-0000-0000-000000000001"
# Option A: factory
rag = PrismRAG.from_postgres(dsn=dsn, mapping=mapping, tenant_id=tenant_id)
# Option B: explicit store
store = PostgresStore(dsn=dsn)
store.ensure_tenant(tenant_id)
rag = PrismRAG(mapping=mapping, tenant_id=tenant_id, store=store)
rag.ingest(records=[...])
print(rag.search("credit risk", top_k=5))
Requires prismrag/schema.sql applied to your database and pip install "prismrag-patch[graph,pgvector]".
Integration tests: PRISMRAG_DB_DSN=... pytest tests/test_lib_postgres_store.py -v
Installation
pip install prismrag-patch # core (mapping, ingest, search in-memory)
pip install "prismrag-patch[graph]" # + networkx + python-louvain (communities)
pip install "prismrag-patch[pgvector]" # + PostgreSQL adapter
pip install "prismrag-patch[all]" # everything
Running parity tests
cd prismrag_patch && pip install -e ".[graph]"
cd .. && pytest tests/test_lib_step01_mapping.py -v # step 1: mapping
pytest tests/test_lib_step02_ingest.py -v # step 2: ingest
pytest tests/test_lib_step03_graph.py -v # step 3: graph/communities
pytest tests/test_lib_step04_search.py -v # step 4: search
pytest tests/test_lib_step05_bridge_append.py -v # step 5: bridge/append/quality
pytest tests/test_lib_step06_evaluation.py -v -s # step 6: evaluation report
API parity matrix
| SaaS endpoint | Library method |
|---|---|
POST /jobs (inline ingest) |
rag.ingest(...) |
GET /jobs/{id} |
rag.get_job(job_id) |
POST /search |
rag.search(query, top_k=, category_filter=) |
GET /communities |
rag.list_communities() |
POST /bridges |
rag.create_bridge(a, b, bridge_label=) |
POST /append |
rag.append_chunks(...) |
GET /chunks/quality |
rag.chunk_quality() |
| Chunk export | rag.export_chunks() |
License
Apache-2.0 — free for commercial and personal use.
© 2026 Insight IT Solutions
Release files for prismrag-patch 0.2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| prismrag_patch-0.2.1.tar.gz | 30.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| prismrag_patch-0.2.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 72.4 kB
Release files / prismrag_patch-0.2.1.tar.gz
| Download URL | prismrag_patch-0.2.1.tar.gz |
|---|---|
| Size | 30.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
70002adab9d92c2ccc55bd99b1a0e9b282ad33ea9e7ff1a2be0f4804630fb85a
|
|
BLAKE2b-256 checksum How to use checksums |
ac3c23acc69f27a2b85d73609ec75eee7d82eaddd4032dbdecf6d11081be5eeb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.10
|
Release files / prismrag_patch-0.2.1-py3-none-any.whl
| Download URL | prismrag_patch-0.2.1-py3-none-any.whl |
|---|---|
| Size | 41.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7e314c4044e333362406686871ccfb2563dcca0af4042863ce341674b2c96ab1
|
|
BLAKE2b-256 checksum How to use checksums |
6a71f333e3ba0bab36796a57f16ad00a7998ca3d299defce6e76d5fc333d6e84
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.10
|