Free OSS RAG library — ingest, graph RAG search, communities, bridges, append (API parity)
Project description
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
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file prismrag_patch-0.2.1.tar.gz.
File metadata
- Download URL: prismrag_patch-0.2.1.tar.gz
- Upload date:
- Size: 30.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
70002adab9d92c2ccc55bd99b1a0e9b282ad33ea9e7ff1a2be0f4804630fb85a
|
|
| MD5 |
7257385b28a6cac60500e38516435a69
|
|
| BLAKE2b-256 |
ac3c23acc69f27a2b85d73609ec75eee7d82eaddd4032dbdecf6d11081be5eeb
|
File details
Details for the file prismrag_patch-0.2.1-py3-none-any.whl.
File metadata
- Download URL: prismrag_patch-0.2.1-py3-none-any.whl
- Upload date:
- Size: 41.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7e314c4044e333362406686871ccfb2563dcca0af4042863ce341674b2c96ab1
|
|
| MD5 |
205154ad15e13db67bc85e577e347a49
|
|
| BLAKE2b-256 |
6a71f333e3ba0bab36796a57f16ad00a7998ca3d299defce6e76d5fc333d6e84
|