prismrag-patch 0.1.0__tar.gz → 0.1.1__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.
- prismrag_patch-0.1.1/PKG-INFO +220 -0
- prismrag_patch-0.1.1/README.md +181 -0
- {prismrag_patch-0.1.0 → prismrag_patch-0.1.1}/prismrag_patch/license.py +2 -2
- prismrag_patch-0.1.1/prismrag_patch.egg-info/PKG-INFO +220 -0
- {prismrag_patch-0.1.0 → prismrag_patch-0.1.1}/pyproject.toml +2 -2
- prismrag_patch-0.1.0/PKG-INFO +0 -89
- prismrag_patch-0.1.0/README.md +0 -50
- prismrag_patch-0.1.0/prismrag_patch.egg-info/PKG-INFO +0 -89
- {prismrag_patch-0.1.0 → prismrag_patch-0.1.1}/prismrag_patch/__init__.py +0 -0
- {prismrag_patch-0.1.0 → prismrag_patch-0.1.1}/prismrag_patch/adapters/__init__.py +0 -0
- {prismrag_patch-0.1.0 → prismrag_patch-0.1.1}/prismrag_patch/adapters/chroma.py +0 -0
- {prismrag_patch-0.1.0 → prismrag_patch-0.1.1}/prismrag_patch/adapters/pgvector.py +0 -0
- {prismrag_patch-0.1.0 → prismrag_patch-0.1.1}/prismrag_patch/adapters/pinecone.py +0 -0
- {prismrag_patch-0.1.0 → prismrag_patch-0.1.1}/prismrag_patch/adapters/weaviate.py +0 -0
- {prismrag_patch-0.1.0 → prismrag_patch-0.1.1}/prismrag_patch/core.py +0 -0
- {prismrag_patch-0.1.0 → prismrag_patch-0.1.1}/prismrag_patch.egg-info/SOURCES.txt +0 -0
- {prismrag_patch-0.1.0 → prismrag_patch-0.1.1}/prismrag_patch.egg-info/dependency_links.txt +0 -0
- {prismrag_patch-0.1.0 → prismrag_patch-0.1.1}/prismrag_patch.egg-info/requires.txt +0 -0
- {prismrag_patch-0.1.0 → prismrag_patch-0.1.1}/prismrag_patch.egg-info/top_level.txt +0 -0
- {prismrag_patch-0.1.0 → prismrag_patch-0.1.1}/setup.cfg +0 -0
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: prismrag-patch
|
|
3
|
+
Version: 0.1.1
|
|
4
|
+
Summary: Drop-in hallucination-resistant retrieval for pgvector, ChromaDB, Pinecone, and Weaviate
|
|
5
|
+
Author-email: Insight IT Solutions <prismrag@insightits.com>
|
|
6
|
+
License: Commercial
|
|
7
|
+
Project-URL: Homepage, https://prismrag.insightits.com/prismrag-lib.html
|
|
8
|
+
Project-URL: Repository, https://github.com/aminparva84/InsightPrismRAG
|
|
9
|
+
Project-URL: Bug Tracker, https://prismrag.insightits.com/support
|
|
10
|
+
Keywords: rag,vector-database,hallucination,pgvector,chromadb,pinecone,weaviate,llm
|
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
19
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
20
|
+
Requires-Python: >=3.9
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
Requires-Dist: requests>=2.28
|
|
23
|
+
Requires-Dist: numpy>=1.24
|
|
24
|
+
Provides-Extra: pgvector
|
|
25
|
+
Requires-Dist: psycopg2-binary>=2.9; extra == "pgvector"
|
|
26
|
+
Requires-Dist: pgvector>=0.2; extra == "pgvector"
|
|
27
|
+
Provides-Extra: chroma
|
|
28
|
+
Requires-Dist: chromadb>=0.4; extra == "chroma"
|
|
29
|
+
Provides-Extra: pinecone
|
|
30
|
+
Requires-Dist: pinecone-client>=3.0; extra == "pinecone"
|
|
31
|
+
Provides-Extra: weaviate
|
|
32
|
+
Requires-Dist: weaviate-client>=4.0; extra == "weaviate"
|
|
33
|
+
Provides-Extra: all
|
|
34
|
+
Requires-Dist: psycopg2-binary>=2.9; extra == "all"
|
|
35
|
+
Requires-Dist: pgvector>=0.2; extra == "all"
|
|
36
|
+
Requires-Dist: chromadb>=0.4; extra == "all"
|
|
37
|
+
Requires-Dist: pinecone-client>=3.0; extra == "all"
|
|
38
|
+
Requires-Dist: weaviate-client>=4.0; extra == "all"
|
|
39
|
+
|
|
40
|
+
# prismrag-patch
|
|
41
|
+
|
|
42
|
+
**Drop-in hallucination-resistant retrieval for your own vector database.**
|
|
43
|
+
|
|
44
|
+
PrismRAG Patch wraps pgvector, ChromaDB, Pinecone, or Weaviate with PrismRAG's
|
|
45
|
+
Tier-1 re-mapping technique — deterministic category projection that grounds every
|
|
46
|
+
chunk in your verified taxonomy before it ever reaches the LLM.
|
|
47
|
+
|
|
48
|
+
## Requirements
|
|
49
|
+
|
|
50
|
+
| Requirement | Detail |
|
|
51
|
+
|-------------|--------|
|
|
52
|
+
| Python | 3.10+ |
|
|
53
|
+
| License key | `prlib_` key from [prismrag.insightits.com](https://prismrag.insightits.com/prismrag-lib.html) |
|
|
54
|
+
| Embedding model | **Gemini `gemini-embedding-001`** (recommended) or any model producing float vectors |
|
|
55
|
+
| Gemini API key | Required if using Gemini embeddings — get one at [aistudio.google.com](https://aistudio.google.com) |
|
|
56
|
+
|
|
57
|
+
> **Important:** prismrag-patch does **not** generate embeddings for you.
|
|
58
|
+
> You call your embedding model, then pass the resulting vector to the adapter.
|
|
59
|
+
> The library remaps, enriches, and stores/searches the vector in your database.
|
|
60
|
+
|
|
61
|
+
## Quick start — pgvector + Gemini
|
|
62
|
+
|
|
63
|
+
```python
|
|
64
|
+
import os
|
|
65
|
+
import requests
|
|
66
|
+
import psycopg2
|
|
67
|
+
from prismrag_patch import PrismRAGPatch
|
|
68
|
+
from prismrag_patch.adapters.pgvector import PgvectorAdapter
|
|
69
|
+
|
|
70
|
+
# ── 1. Embedding function using Gemini (768-dim, same as production) ─────────
|
|
71
|
+
GEMINI_KEY = os.environ["GEMINI_API_KEY"] # set in your environment
|
|
72
|
+
|
|
73
|
+
def embed(text: str) -> list[float]:
|
|
74
|
+
"""Call Gemini embedding API and return a 768-dim vector."""
|
|
75
|
+
resp = requests.post(
|
|
76
|
+
f"https://generativelanguage.googleapis.com/v1beta/models/"
|
|
77
|
+
f"gemini-embedding-001:batchEmbedContents?key={GEMINI_KEY}",
|
|
78
|
+
json={"requests": [{
|
|
79
|
+
"model": "models/gemini-embedding-001",
|
|
80
|
+
"content": {"parts": [{"text": text}]},
|
|
81
|
+
"outputDimensionality": 768,
|
|
82
|
+
"taskType": "RETRIEVAL_DOCUMENT",
|
|
83
|
+
}]},
|
|
84
|
+
timeout=30,
|
|
85
|
+
)
|
|
86
|
+
resp.raise_for_status()
|
|
87
|
+
return resp.json()["embeddings"][0]["values"]
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
# ── 2. Define your category mapping ──────────────────────────────────────────
|
|
91
|
+
mapping = {
|
|
92
|
+
"categories": [
|
|
93
|
+
{"slug": "risk", "label": "Risk and Compliance"},
|
|
94
|
+
{"slug": "growth", "label": "Revenue and Growth"},
|
|
95
|
+
],
|
|
96
|
+
"rules": [
|
|
97
|
+
{"word": "volatility", "category_slug": "risk", "weight": 1.0},
|
|
98
|
+
{"word": "fraud", "category_slug": "risk", "weight": 1.0},
|
|
99
|
+
{"word": "revenue", "category_slug": "growth", "weight": 1.0},
|
|
100
|
+
{"word": "earnings", "category_slug": "growth", "weight": 1.0},
|
|
101
|
+
],
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
# ── 3. Initialize prismrag-patch ──────────────────────────────────────────────
|
|
105
|
+
patch = PrismRAGPatch(license_key="prlib_YOUR_KEY_HERE", mapping=mapping)
|
|
106
|
+
|
|
107
|
+
# ── 4. Connect to your database ───────────────────────────────────────────────
|
|
108
|
+
conn = psycopg2.connect("postgresql://user:pass@localhost:5432/mydb")
|
|
109
|
+
adapter = PgvectorAdapter(patch, conn, table="my_chunks")
|
|
110
|
+
adapter.ensure_table(dim=768) # creates table + HNSW index if not exists
|
|
111
|
+
|
|
112
|
+
# ── 5. Embed your document with Gemini, then insert ──────────────────────────
|
|
113
|
+
doc = "Market volatility spiked due to fraud risk exposure."
|
|
114
|
+
vec = embed(doc) # real 768-dim Gemini vector
|
|
115
|
+
row_id = adapter.insert(doc, vec, metadata={"source": "risk_report"})
|
|
116
|
+
# stored vector is remapped toward "risk" category cluster
|
|
117
|
+
# metadata gets prismrag_category + prismrag_label injected automatically
|
|
118
|
+
|
|
119
|
+
# ── 6. Search ─────────────────────────────────────────────────────────────────
|
|
120
|
+
query = "what is our risk exposure?"
|
|
121
|
+
query_vec = embed(query)
|
|
122
|
+
results = adapter.search(query, query_vec, top_k=5)
|
|
123
|
+
for r in results:
|
|
124
|
+
print(r["score"], r["metadata"]["prismrag_category"], r["text"][:60])
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
## Batch insert
|
|
128
|
+
|
|
129
|
+
```python
|
|
130
|
+
records = [
|
|
131
|
+
{"text": doc1, "vector": embed(doc1), "metadata": {"source": "q1"}},
|
|
132
|
+
{"text": doc2, "vector": embed(doc2), "metadata": {"source": "q2"}},
|
|
133
|
+
]
|
|
134
|
+
ids = adapter.batch_insert(records) # single transaction
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
## Installation
|
|
138
|
+
|
|
139
|
+
```bash
|
|
140
|
+
pip install prismrag-patch # core only
|
|
141
|
+
pip install "prismrag-patch[pgvector]" # + pgvector (psycopg2)
|
|
142
|
+
pip install "prismrag-patch[chroma]" # + ChromaDB
|
|
143
|
+
pip install "prismrag-patch[pinecone]" # + Pinecone v3
|
|
144
|
+
pip install "prismrag-patch[weaviate]" # + Weaviate v4
|
|
145
|
+
pip install "prismrag-patch[all]" # all adapters
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
## Other adapters
|
|
149
|
+
|
|
150
|
+
### ChromaDB
|
|
151
|
+
|
|
152
|
+
```python
|
|
153
|
+
import chromadb
|
|
154
|
+
from prismrag_patch.adapters.chroma import ChromaAdapter
|
|
155
|
+
|
|
156
|
+
client = chromadb.Client()
|
|
157
|
+
collection = client.get_or_create_collection("my_chunks")
|
|
158
|
+
adapter = ChromaAdapter(patch, collection)
|
|
159
|
+
adapter.insert(doc, embed(doc), metadata={"source": "report"})
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
### Pinecone
|
|
163
|
+
|
|
164
|
+
```python
|
|
165
|
+
from pinecone import Pinecone
|
|
166
|
+
from prismrag_patch.adapters.pinecone import PineconeAdapter
|
|
167
|
+
|
|
168
|
+
pc = Pinecone(api_key=os.environ["PINECONE_API_KEY"])
|
|
169
|
+
index = pc.Index("my-index")
|
|
170
|
+
adapter = PineconeAdapter(patch, index, namespace="finance")
|
|
171
|
+
adapter.insert(doc, embed(doc), metadata={"source": "report"})
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
### Weaviate
|
|
175
|
+
|
|
176
|
+
```python
|
|
177
|
+
import weaviate
|
|
178
|
+
from prismrag_patch.adapters.weaviate import WeaviateAdapter
|
|
179
|
+
|
|
180
|
+
client = weaviate.connect_to_local()
|
|
181
|
+
collection = client.collections.get("MyChunks")
|
|
182
|
+
adapter = WeaviateAdapter(patch, collection)
|
|
183
|
+
adapter.insert(doc, embed(doc))
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
## How it works
|
|
187
|
+
|
|
188
|
+
```
|
|
189
|
+
Your text
|
|
190
|
+
│
|
|
191
|
+
▼
|
|
192
|
+
Your embedding model (Gemini / OpenAI / Cohere) ← you call this
|
|
193
|
+
│
|
|
194
|
+
▼
|
|
195
|
+
raw vector [0.12, -0.45, 0.88, ...] N dimensions
|
|
196
|
+
│
|
|
197
|
+
▼
|
|
198
|
+
prismrag-patch.insert(text, raw_vector, metadata)
|
|
199
|
+
│
|
|
200
|
+
├─ category inferred from your rules (local, deterministic, no API call)
|
|
201
|
+
├─ vector nudged toward winning category cluster (blend_alpha=0.35)
|
|
202
|
+
└─ metadata enriched with prismrag_category + prismrag_label
|
|
203
|
+
│
|
|
204
|
+
▼
|
|
205
|
+
stored in YOUR database — prismrag-patch never holds your data
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
## What prismrag-patch does NOT do
|
|
209
|
+
|
|
210
|
+
- It does **not** call an LLM
|
|
211
|
+
- It does **not** generate embeddings
|
|
212
|
+
- It does **not** store your data on PrismRAG servers
|
|
213
|
+
- The only network call is a one-time license validation (cached 23 hours, 7-day offline grace period)
|
|
214
|
+
|
|
215
|
+
## License
|
|
216
|
+
|
|
217
|
+
Commercial license required. Get yours at
|
|
218
|
+
[prismrag.insightits.com/prismrag-lib.html](https://prismrag.insightits.com/prismrag-lib.html).
|
|
219
|
+
|
|
220
|
+
© 2026 Insight IT Solutions
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
# prismrag-patch
|
|
2
|
+
|
|
3
|
+
**Drop-in hallucination-resistant retrieval for your own vector database.**
|
|
4
|
+
|
|
5
|
+
PrismRAG Patch wraps pgvector, ChromaDB, Pinecone, or Weaviate with PrismRAG's
|
|
6
|
+
Tier-1 re-mapping technique — deterministic category projection that grounds every
|
|
7
|
+
chunk in your verified taxonomy before it ever reaches the LLM.
|
|
8
|
+
|
|
9
|
+
## Requirements
|
|
10
|
+
|
|
11
|
+
| Requirement | Detail |
|
|
12
|
+
|-------------|--------|
|
|
13
|
+
| Python | 3.10+ |
|
|
14
|
+
| License key | `prlib_` key from [prismrag.insightits.com](https://prismrag.insightits.com/prismrag-lib.html) |
|
|
15
|
+
| Embedding model | **Gemini `gemini-embedding-001`** (recommended) or any model producing float vectors |
|
|
16
|
+
| Gemini API key | Required if using Gemini embeddings — get one at [aistudio.google.com](https://aistudio.google.com) |
|
|
17
|
+
|
|
18
|
+
> **Important:** prismrag-patch does **not** generate embeddings for you.
|
|
19
|
+
> You call your embedding model, then pass the resulting vector to the adapter.
|
|
20
|
+
> The library remaps, enriches, and stores/searches the vector in your database.
|
|
21
|
+
|
|
22
|
+
## Quick start — pgvector + Gemini
|
|
23
|
+
|
|
24
|
+
```python
|
|
25
|
+
import os
|
|
26
|
+
import requests
|
|
27
|
+
import psycopg2
|
|
28
|
+
from prismrag_patch import PrismRAGPatch
|
|
29
|
+
from prismrag_patch.adapters.pgvector import PgvectorAdapter
|
|
30
|
+
|
|
31
|
+
# ── 1. Embedding function using Gemini (768-dim, same as production) ─────────
|
|
32
|
+
GEMINI_KEY = os.environ["GEMINI_API_KEY"] # set in your environment
|
|
33
|
+
|
|
34
|
+
def embed(text: str) -> list[float]:
|
|
35
|
+
"""Call Gemini embedding API and return a 768-dim vector."""
|
|
36
|
+
resp = requests.post(
|
|
37
|
+
f"https://generativelanguage.googleapis.com/v1beta/models/"
|
|
38
|
+
f"gemini-embedding-001:batchEmbedContents?key={GEMINI_KEY}",
|
|
39
|
+
json={"requests": [{
|
|
40
|
+
"model": "models/gemini-embedding-001",
|
|
41
|
+
"content": {"parts": [{"text": text}]},
|
|
42
|
+
"outputDimensionality": 768,
|
|
43
|
+
"taskType": "RETRIEVAL_DOCUMENT",
|
|
44
|
+
}]},
|
|
45
|
+
timeout=30,
|
|
46
|
+
)
|
|
47
|
+
resp.raise_for_status()
|
|
48
|
+
return resp.json()["embeddings"][0]["values"]
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
# ── 2. Define your category mapping ──────────────────────────────────────────
|
|
52
|
+
mapping = {
|
|
53
|
+
"categories": [
|
|
54
|
+
{"slug": "risk", "label": "Risk and Compliance"},
|
|
55
|
+
{"slug": "growth", "label": "Revenue and Growth"},
|
|
56
|
+
],
|
|
57
|
+
"rules": [
|
|
58
|
+
{"word": "volatility", "category_slug": "risk", "weight": 1.0},
|
|
59
|
+
{"word": "fraud", "category_slug": "risk", "weight": 1.0},
|
|
60
|
+
{"word": "revenue", "category_slug": "growth", "weight": 1.0},
|
|
61
|
+
{"word": "earnings", "category_slug": "growth", "weight": 1.0},
|
|
62
|
+
],
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
# ── 3. Initialize prismrag-patch ──────────────────────────────────────────────
|
|
66
|
+
patch = PrismRAGPatch(license_key="prlib_YOUR_KEY_HERE", mapping=mapping)
|
|
67
|
+
|
|
68
|
+
# ── 4. Connect to your database ───────────────────────────────────────────────
|
|
69
|
+
conn = psycopg2.connect("postgresql://user:pass@localhost:5432/mydb")
|
|
70
|
+
adapter = PgvectorAdapter(patch, conn, table="my_chunks")
|
|
71
|
+
adapter.ensure_table(dim=768) # creates table + HNSW index if not exists
|
|
72
|
+
|
|
73
|
+
# ── 5. Embed your document with Gemini, then insert ──────────────────────────
|
|
74
|
+
doc = "Market volatility spiked due to fraud risk exposure."
|
|
75
|
+
vec = embed(doc) # real 768-dim Gemini vector
|
|
76
|
+
row_id = adapter.insert(doc, vec, metadata={"source": "risk_report"})
|
|
77
|
+
# stored vector is remapped toward "risk" category cluster
|
|
78
|
+
# metadata gets prismrag_category + prismrag_label injected automatically
|
|
79
|
+
|
|
80
|
+
# ── 6. Search ─────────────────────────────────────────────────────────────────
|
|
81
|
+
query = "what is our risk exposure?"
|
|
82
|
+
query_vec = embed(query)
|
|
83
|
+
results = adapter.search(query, query_vec, top_k=5)
|
|
84
|
+
for r in results:
|
|
85
|
+
print(r["score"], r["metadata"]["prismrag_category"], r["text"][:60])
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## Batch insert
|
|
89
|
+
|
|
90
|
+
```python
|
|
91
|
+
records = [
|
|
92
|
+
{"text": doc1, "vector": embed(doc1), "metadata": {"source": "q1"}},
|
|
93
|
+
{"text": doc2, "vector": embed(doc2), "metadata": {"source": "q2"}},
|
|
94
|
+
]
|
|
95
|
+
ids = adapter.batch_insert(records) # single transaction
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
## Installation
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
pip install prismrag-patch # core only
|
|
102
|
+
pip install "prismrag-patch[pgvector]" # + pgvector (psycopg2)
|
|
103
|
+
pip install "prismrag-patch[chroma]" # + ChromaDB
|
|
104
|
+
pip install "prismrag-patch[pinecone]" # + Pinecone v3
|
|
105
|
+
pip install "prismrag-patch[weaviate]" # + Weaviate v4
|
|
106
|
+
pip install "prismrag-patch[all]" # all adapters
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
## Other adapters
|
|
110
|
+
|
|
111
|
+
### ChromaDB
|
|
112
|
+
|
|
113
|
+
```python
|
|
114
|
+
import chromadb
|
|
115
|
+
from prismrag_patch.adapters.chroma import ChromaAdapter
|
|
116
|
+
|
|
117
|
+
client = chromadb.Client()
|
|
118
|
+
collection = client.get_or_create_collection("my_chunks")
|
|
119
|
+
adapter = ChromaAdapter(patch, collection)
|
|
120
|
+
adapter.insert(doc, embed(doc), metadata={"source": "report"})
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
### Pinecone
|
|
124
|
+
|
|
125
|
+
```python
|
|
126
|
+
from pinecone import Pinecone
|
|
127
|
+
from prismrag_patch.adapters.pinecone import PineconeAdapter
|
|
128
|
+
|
|
129
|
+
pc = Pinecone(api_key=os.environ["PINECONE_API_KEY"])
|
|
130
|
+
index = pc.Index("my-index")
|
|
131
|
+
adapter = PineconeAdapter(patch, index, namespace="finance")
|
|
132
|
+
adapter.insert(doc, embed(doc), metadata={"source": "report"})
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
### Weaviate
|
|
136
|
+
|
|
137
|
+
```python
|
|
138
|
+
import weaviate
|
|
139
|
+
from prismrag_patch.adapters.weaviate import WeaviateAdapter
|
|
140
|
+
|
|
141
|
+
client = weaviate.connect_to_local()
|
|
142
|
+
collection = client.collections.get("MyChunks")
|
|
143
|
+
adapter = WeaviateAdapter(patch, collection)
|
|
144
|
+
adapter.insert(doc, embed(doc))
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
## How it works
|
|
148
|
+
|
|
149
|
+
```
|
|
150
|
+
Your text
|
|
151
|
+
│
|
|
152
|
+
▼
|
|
153
|
+
Your embedding model (Gemini / OpenAI / Cohere) ← you call this
|
|
154
|
+
│
|
|
155
|
+
▼
|
|
156
|
+
raw vector [0.12, -0.45, 0.88, ...] N dimensions
|
|
157
|
+
│
|
|
158
|
+
▼
|
|
159
|
+
prismrag-patch.insert(text, raw_vector, metadata)
|
|
160
|
+
│
|
|
161
|
+
├─ category inferred from your rules (local, deterministic, no API call)
|
|
162
|
+
├─ vector nudged toward winning category cluster (blend_alpha=0.35)
|
|
163
|
+
└─ metadata enriched with prismrag_category + prismrag_label
|
|
164
|
+
│
|
|
165
|
+
▼
|
|
166
|
+
stored in YOUR database — prismrag-patch never holds your data
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
## What prismrag-patch does NOT do
|
|
170
|
+
|
|
171
|
+
- It does **not** call an LLM
|
|
172
|
+
- It does **not** generate embeddings
|
|
173
|
+
- It does **not** store your data on PrismRAG servers
|
|
174
|
+
- The only network call is a one-time license validation (cached 23 hours, 7-day offline grace period)
|
|
175
|
+
|
|
176
|
+
## License
|
|
177
|
+
|
|
178
|
+
Commercial license required. Get yours at
|
|
179
|
+
[prismrag.insightits.com/prismrag-lib.html](https://prismrag.insightits.com/prismrag-lib.html).
|
|
180
|
+
|
|
181
|
+
© 2026 Insight IT Solutions
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"""
|
|
1
|
+
"""
|
|
2
2
|
License validation for prismrag-patch.
|
|
3
3
|
|
|
4
4
|
Validates against https://prismrag.insightits.com/api/v1/lib/validate.
|
|
@@ -104,7 +104,7 @@ def validate_license(key: str, product: str = "prismrag-patch") -> dict:
|
|
|
104
104
|
return {"valid": True, "offline_grace": True}
|
|
105
105
|
raise LicenseError(
|
|
106
106
|
f"Cannot reach license server and grace period exceeded. "
|
|
107
|
-
f"Check your internet connection or contact
|
|
107
|
+
f"Check your internet connection or contact prismrag@insightits.com. ({exc})"
|
|
108
108
|
) from exc
|
|
109
109
|
|
|
110
110
|
if not data.get("valid"):
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: prismrag-patch
|
|
3
|
+
Version: 0.1.1
|
|
4
|
+
Summary: Drop-in hallucination-resistant retrieval for pgvector, ChromaDB, Pinecone, and Weaviate
|
|
5
|
+
Author-email: Insight IT Solutions <prismrag@insightits.com>
|
|
6
|
+
License: Commercial
|
|
7
|
+
Project-URL: Homepage, https://prismrag.insightits.com/prismrag-lib.html
|
|
8
|
+
Project-URL: Repository, https://github.com/aminparva84/InsightPrismRAG
|
|
9
|
+
Project-URL: Bug Tracker, https://prismrag.insightits.com/support
|
|
10
|
+
Keywords: rag,vector-database,hallucination,pgvector,chromadb,pinecone,weaviate,llm
|
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
19
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
20
|
+
Requires-Python: >=3.9
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
Requires-Dist: requests>=2.28
|
|
23
|
+
Requires-Dist: numpy>=1.24
|
|
24
|
+
Provides-Extra: pgvector
|
|
25
|
+
Requires-Dist: psycopg2-binary>=2.9; extra == "pgvector"
|
|
26
|
+
Requires-Dist: pgvector>=0.2; extra == "pgvector"
|
|
27
|
+
Provides-Extra: chroma
|
|
28
|
+
Requires-Dist: chromadb>=0.4; extra == "chroma"
|
|
29
|
+
Provides-Extra: pinecone
|
|
30
|
+
Requires-Dist: pinecone-client>=3.0; extra == "pinecone"
|
|
31
|
+
Provides-Extra: weaviate
|
|
32
|
+
Requires-Dist: weaviate-client>=4.0; extra == "weaviate"
|
|
33
|
+
Provides-Extra: all
|
|
34
|
+
Requires-Dist: psycopg2-binary>=2.9; extra == "all"
|
|
35
|
+
Requires-Dist: pgvector>=0.2; extra == "all"
|
|
36
|
+
Requires-Dist: chromadb>=0.4; extra == "all"
|
|
37
|
+
Requires-Dist: pinecone-client>=3.0; extra == "all"
|
|
38
|
+
Requires-Dist: weaviate-client>=4.0; extra == "all"
|
|
39
|
+
|
|
40
|
+
# prismrag-patch
|
|
41
|
+
|
|
42
|
+
**Drop-in hallucination-resistant retrieval for your own vector database.**
|
|
43
|
+
|
|
44
|
+
PrismRAG Patch wraps pgvector, ChromaDB, Pinecone, or Weaviate with PrismRAG's
|
|
45
|
+
Tier-1 re-mapping technique — deterministic category projection that grounds every
|
|
46
|
+
chunk in your verified taxonomy before it ever reaches the LLM.
|
|
47
|
+
|
|
48
|
+
## Requirements
|
|
49
|
+
|
|
50
|
+
| Requirement | Detail |
|
|
51
|
+
|-------------|--------|
|
|
52
|
+
| Python | 3.10+ |
|
|
53
|
+
| License key | `prlib_` key from [prismrag.insightits.com](https://prismrag.insightits.com/prismrag-lib.html) |
|
|
54
|
+
| Embedding model | **Gemini `gemini-embedding-001`** (recommended) or any model producing float vectors |
|
|
55
|
+
| Gemini API key | Required if using Gemini embeddings — get one at [aistudio.google.com](https://aistudio.google.com) |
|
|
56
|
+
|
|
57
|
+
> **Important:** prismrag-patch does **not** generate embeddings for you.
|
|
58
|
+
> You call your embedding model, then pass the resulting vector to the adapter.
|
|
59
|
+
> The library remaps, enriches, and stores/searches the vector in your database.
|
|
60
|
+
|
|
61
|
+
## Quick start — pgvector + Gemini
|
|
62
|
+
|
|
63
|
+
```python
|
|
64
|
+
import os
|
|
65
|
+
import requests
|
|
66
|
+
import psycopg2
|
|
67
|
+
from prismrag_patch import PrismRAGPatch
|
|
68
|
+
from prismrag_patch.adapters.pgvector import PgvectorAdapter
|
|
69
|
+
|
|
70
|
+
# ── 1. Embedding function using Gemini (768-dim, same as production) ─────────
|
|
71
|
+
GEMINI_KEY = os.environ["GEMINI_API_KEY"] # set in your environment
|
|
72
|
+
|
|
73
|
+
def embed(text: str) -> list[float]:
|
|
74
|
+
"""Call Gemini embedding API and return a 768-dim vector."""
|
|
75
|
+
resp = requests.post(
|
|
76
|
+
f"https://generativelanguage.googleapis.com/v1beta/models/"
|
|
77
|
+
f"gemini-embedding-001:batchEmbedContents?key={GEMINI_KEY}",
|
|
78
|
+
json={"requests": [{
|
|
79
|
+
"model": "models/gemini-embedding-001",
|
|
80
|
+
"content": {"parts": [{"text": text}]},
|
|
81
|
+
"outputDimensionality": 768,
|
|
82
|
+
"taskType": "RETRIEVAL_DOCUMENT",
|
|
83
|
+
}]},
|
|
84
|
+
timeout=30,
|
|
85
|
+
)
|
|
86
|
+
resp.raise_for_status()
|
|
87
|
+
return resp.json()["embeddings"][0]["values"]
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
# ── 2. Define your category mapping ──────────────────────────────────────────
|
|
91
|
+
mapping = {
|
|
92
|
+
"categories": [
|
|
93
|
+
{"slug": "risk", "label": "Risk and Compliance"},
|
|
94
|
+
{"slug": "growth", "label": "Revenue and Growth"},
|
|
95
|
+
],
|
|
96
|
+
"rules": [
|
|
97
|
+
{"word": "volatility", "category_slug": "risk", "weight": 1.0},
|
|
98
|
+
{"word": "fraud", "category_slug": "risk", "weight": 1.0},
|
|
99
|
+
{"word": "revenue", "category_slug": "growth", "weight": 1.0},
|
|
100
|
+
{"word": "earnings", "category_slug": "growth", "weight": 1.0},
|
|
101
|
+
],
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
# ── 3. Initialize prismrag-patch ──────────────────────────────────────────────
|
|
105
|
+
patch = PrismRAGPatch(license_key="prlib_YOUR_KEY_HERE", mapping=mapping)
|
|
106
|
+
|
|
107
|
+
# ── 4. Connect to your database ───────────────────────────────────────────────
|
|
108
|
+
conn = psycopg2.connect("postgresql://user:pass@localhost:5432/mydb")
|
|
109
|
+
adapter = PgvectorAdapter(patch, conn, table="my_chunks")
|
|
110
|
+
adapter.ensure_table(dim=768) # creates table + HNSW index if not exists
|
|
111
|
+
|
|
112
|
+
# ── 5. Embed your document with Gemini, then insert ──────────────────────────
|
|
113
|
+
doc = "Market volatility spiked due to fraud risk exposure."
|
|
114
|
+
vec = embed(doc) # real 768-dim Gemini vector
|
|
115
|
+
row_id = adapter.insert(doc, vec, metadata={"source": "risk_report"})
|
|
116
|
+
# stored vector is remapped toward "risk" category cluster
|
|
117
|
+
# metadata gets prismrag_category + prismrag_label injected automatically
|
|
118
|
+
|
|
119
|
+
# ── 6. Search ─────────────────────────────────────────────────────────────────
|
|
120
|
+
query = "what is our risk exposure?"
|
|
121
|
+
query_vec = embed(query)
|
|
122
|
+
results = adapter.search(query, query_vec, top_k=5)
|
|
123
|
+
for r in results:
|
|
124
|
+
print(r["score"], r["metadata"]["prismrag_category"], r["text"][:60])
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
## Batch insert
|
|
128
|
+
|
|
129
|
+
```python
|
|
130
|
+
records = [
|
|
131
|
+
{"text": doc1, "vector": embed(doc1), "metadata": {"source": "q1"}},
|
|
132
|
+
{"text": doc2, "vector": embed(doc2), "metadata": {"source": "q2"}},
|
|
133
|
+
]
|
|
134
|
+
ids = adapter.batch_insert(records) # single transaction
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
## Installation
|
|
138
|
+
|
|
139
|
+
```bash
|
|
140
|
+
pip install prismrag-patch # core only
|
|
141
|
+
pip install "prismrag-patch[pgvector]" # + pgvector (psycopg2)
|
|
142
|
+
pip install "prismrag-patch[chroma]" # + ChromaDB
|
|
143
|
+
pip install "prismrag-patch[pinecone]" # + Pinecone v3
|
|
144
|
+
pip install "prismrag-patch[weaviate]" # + Weaviate v4
|
|
145
|
+
pip install "prismrag-patch[all]" # all adapters
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
## Other adapters
|
|
149
|
+
|
|
150
|
+
### ChromaDB
|
|
151
|
+
|
|
152
|
+
```python
|
|
153
|
+
import chromadb
|
|
154
|
+
from prismrag_patch.adapters.chroma import ChromaAdapter
|
|
155
|
+
|
|
156
|
+
client = chromadb.Client()
|
|
157
|
+
collection = client.get_or_create_collection("my_chunks")
|
|
158
|
+
adapter = ChromaAdapter(patch, collection)
|
|
159
|
+
adapter.insert(doc, embed(doc), metadata={"source": "report"})
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
### Pinecone
|
|
163
|
+
|
|
164
|
+
```python
|
|
165
|
+
from pinecone import Pinecone
|
|
166
|
+
from prismrag_patch.adapters.pinecone import PineconeAdapter
|
|
167
|
+
|
|
168
|
+
pc = Pinecone(api_key=os.environ["PINECONE_API_KEY"])
|
|
169
|
+
index = pc.Index("my-index")
|
|
170
|
+
adapter = PineconeAdapter(patch, index, namespace="finance")
|
|
171
|
+
adapter.insert(doc, embed(doc), metadata={"source": "report"})
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
### Weaviate
|
|
175
|
+
|
|
176
|
+
```python
|
|
177
|
+
import weaviate
|
|
178
|
+
from prismrag_patch.adapters.weaviate import WeaviateAdapter
|
|
179
|
+
|
|
180
|
+
client = weaviate.connect_to_local()
|
|
181
|
+
collection = client.collections.get("MyChunks")
|
|
182
|
+
adapter = WeaviateAdapter(patch, collection)
|
|
183
|
+
adapter.insert(doc, embed(doc))
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
## How it works
|
|
187
|
+
|
|
188
|
+
```
|
|
189
|
+
Your text
|
|
190
|
+
│
|
|
191
|
+
▼
|
|
192
|
+
Your embedding model (Gemini / OpenAI / Cohere) ← you call this
|
|
193
|
+
│
|
|
194
|
+
▼
|
|
195
|
+
raw vector [0.12, -0.45, 0.88, ...] N dimensions
|
|
196
|
+
│
|
|
197
|
+
▼
|
|
198
|
+
prismrag-patch.insert(text, raw_vector, metadata)
|
|
199
|
+
│
|
|
200
|
+
├─ category inferred from your rules (local, deterministic, no API call)
|
|
201
|
+
├─ vector nudged toward winning category cluster (blend_alpha=0.35)
|
|
202
|
+
└─ metadata enriched with prismrag_category + prismrag_label
|
|
203
|
+
│
|
|
204
|
+
▼
|
|
205
|
+
stored in YOUR database — prismrag-patch never holds your data
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
## What prismrag-patch does NOT do
|
|
209
|
+
|
|
210
|
+
- It does **not** call an LLM
|
|
211
|
+
- It does **not** generate embeddings
|
|
212
|
+
- It does **not** store your data on PrismRAG servers
|
|
213
|
+
- The only network call is a one-time license validation (cached 23 hours, 7-day offline grace period)
|
|
214
|
+
|
|
215
|
+
## License
|
|
216
|
+
|
|
217
|
+
Commercial license required. Get yours at
|
|
218
|
+
[prismrag.insightits.com/prismrag-lib.html](https://prismrag.insightits.com/prismrag-lib.html).
|
|
219
|
+
|
|
220
|
+
© 2026 Insight IT Solutions
|
|
@@ -4,11 +4,11 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "prismrag-patch"
|
|
7
|
-
version = "0.1.
|
|
7
|
+
version = "0.1.1"
|
|
8
8
|
description = "Drop-in hallucination-resistant retrieval for pgvector, ChromaDB, Pinecone, and Weaviate"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
license = { text = "Commercial" }
|
|
11
|
-
authors = [{ name = "Insight IT Solutions", email = "
|
|
11
|
+
authors = [{ name = "Insight IT Solutions", email = "prismrag@insightits.com" }]
|
|
12
12
|
requires-python = ">=3.9"
|
|
13
13
|
keywords = ["rag", "vector-database", "hallucination", "pgvector", "chromadb", "pinecone", "weaviate", "llm"]
|
|
14
14
|
classifiers = [
|
prismrag_patch-0.1.0/PKG-INFO
DELETED
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: prismrag-patch
|
|
3
|
-
Version: 0.1.0
|
|
4
|
-
Summary: Drop-in hallucination-resistant retrieval for pgvector, ChromaDB, Pinecone, and Weaviate
|
|
5
|
-
Author-email: Insight IT Solutions <sales@prismrag.insightits.com>
|
|
6
|
-
License: Commercial
|
|
7
|
-
Project-URL: Homepage, https://prismrag.insightits.com/prismrag-lib.html
|
|
8
|
-
Project-URL: Repository, https://github.com/aminparva84/InsightPrismRAG
|
|
9
|
-
Project-URL: Bug Tracker, https://prismrag.insightits.com/support
|
|
10
|
-
Keywords: rag,vector-database,hallucination,pgvector,chromadb,pinecone,weaviate,llm
|
|
11
|
-
Classifier: Development Status :: 4 - Beta
|
|
12
|
-
Classifier: Intended Audience :: Developers
|
|
13
|
-
Classifier: Programming Language :: Python :: 3
|
|
14
|
-
Classifier: Programming Language :: Python :: 3.9
|
|
15
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
16
|
-
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
-
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
-
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
19
|
-
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
20
|
-
Requires-Python: >=3.9
|
|
21
|
-
Description-Content-Type: text/markdown
|
|
22
|
-
Requires-Dist: requests>=2.28
|
|
23
|
-
Requires-Dist: numpy>=1.24
|
|
24
|
-
Provides-Extra: pgvector
|
|
25
|
-
Requires-Dist: psycopg2-binary>=2.9; extra == "pgvector"
|
|
26
|
-
Requires-Dist: pgvector>=0.2; extra == "pgvector"
|
|
27
|
-
Provides-Extra: chroma
|
|
28
|
-
Requires-Dist: chromadb>=0.4; extra == "chroma"
|
|
29
|
-
Provides-Extra: pinecone
|
|
30
|
-
Requires-Dist: pinecone-client>=3.0; extra == "pinecone"
|
|
31
|
-
Provides-Extra: weaviate
|
|
32
|
-
Requires-Dist: weaviate-client>=4.0; extra == "weaviate"
|
|
33
|
-
Provides-Extra: all
|
|
34
|
-
Requires-Dist: psycopg2-binary>=2.9; extra == "all"
|
|
35
|
-
Requires-Dist: pgvector>=0.2; extra == "all"
|
|
36
|
-
Requires-Dist: chromadb>=0.4; extra == "all"
|
|
37
|
-
Requires-Dist: pinecone-client>=3.0; extra == "all"
|
|
38
|
-
Requires-Dist: weaviate-client>=4.0; extra == "all"
|
|
39
|
-
|
|
40
|
-
# prismrag-patch
|
|
41
|
-
|
|
42
|
-
**Drop-in hallucination-resistant retrieval for your own vector database.**
|
|
43
|
-
|
|
44
|
-
PrismRAG Patch wraps pgvector, ChromaDB, Pinecone, or Weaviate with PrismRAG's
|
|
45
|
-
Tier-1 re-mapping technique — deterministic category projection that grounds every
|
|
46
|
-
chunk in your verified rules before it ever reaches the LLM.
|
|
47
|
-
|
|
48
|
-
```python
|
|
49
|
-
from prismrag_patch import PrismRAGPatch
|
|
50
|
-
from prismrag_patch.adapters.pgvector import PgvectorAdapter
|
|
51
|
-
|
|
52
|
-
mapping = {
|
|
53
|
-
"categories": [
|
|
54
|
-
{"slug": "risk", "label": "Risk & Compliance"},
|
|
55
|
-
{"slug": "growth", "label": "Growth"},
|
|
56
|
-
],
|
|
57
|
-
"rules": [
|
|
58
|
-
{"word": "volatility", "category_slug": "risk", "weight": 1.0},
|
|
59
|
-
{"word": "revenue", "category_slug": "growth", "weight": 1.0},
|
|
60
|
-
],
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
patch = PrismRAGPatch(license_key="prlib_…", mapping=mapping)
|
|
64
|
-
adapter = PgvectorAdapter(patch, connection=your_psycopg2_conn)
|
|
65
|
-
|
|
66
|
-
# Insert — re-mapped before storage
|
|
67
|
-
adapter.insert(text=doc, vector=embed(doc))
|
|
68
|
-
|
|
69
|
-
# Search — query re-mapped identically, no hallucination path
|
|
70
|
-
results = adapter.search("what is our risk exposure?", query_vector=q_vec)
|
|
71
|
-
```
|
|
72
|
-
|
|
73
|
-
## Installation
|
|
74
|
-
|
|
75
|
-
```bash
|
|
76
|
-
pip install prismrag-patch # core only
|
|
77
|
-
pip install "prismrag-patch[pgvector]" # + pgvector support
|
|
78
|
-
pip install "prismrag-patch[chroma]" # + ChromaDB support
|
|
79
|
-
pip install "prismrag-patch[pinecone]" # + Pinecone support
|
|
80
|
-
pip install "prismrag-patch[weaviate]" # + Weaviate support
|
|
81
|
-
pip install "prismrag-patch[all]" # all adapters
|
|
82
|
-
```
|
|
83
|
-
|
|
84
|
-
## License
|
|
85
|
-
|
|
86
|
-
Commercial license required. Get yours at
|
|
87
|
-
[prismrag.insightits.com/prismrag-lib.html](https://prismrag.insightits.com/prismrag-lib.html).
|
|
88
|
-
|
|
89
|
-
© 2026 Insight IT Solutions
|
prismrag_patch-0.1.0/README.md
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
# prismrag-patch
|
|
2
|
-
|
|
3
|
-
**Drop-in hallucination-resistant retrieval for your own vector database.**
|
|
4
|
-
|
|
5
|
-
PrismRAG Patch wraps pgvector, ChromaDB, Pinecone, or Weaviate with PrismRAG's
|
|
6
|
-
Tier-1 re-mapping technique — deterministic category projection that grounds every
|
|
7
|
-
chunk in your verified rules before it ever reaches the LLM.
|
|
8
|
-
|
|
9
|
-
```python
|
|
10
|
-
from prismrag_patch import PrismRAGPatch
|
|
11
|
-
from prismrag_patch.adapters.pgvector import PgvectorAdapter
|
|
12
|
-
|
|
13
|
-
mapping = {
|
|
14
|
-
"categories": [
|
|
15
|
-
{"slug": "risk", "label": "Risk & Compliance"},
|
|
16
|
-
{"slug": "growth", "label": "Growth"},
|
|
17
|
-
],
|
|
18
|
-
"rules": [
|
|
19
|
-
{"word": "volatility", "category_slug": "risk", "weight": 1.0},
|
|
20
|
-
{"word": "revenue", "category_slug": "growth", "weight": 1.0},
|
|
21
|
-
],
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
patch = PrismRAGPatch(license_key="prlib_…", mapping=mapping)
|
|
25
|
-
adapter = PgvectorAdapter(patch, connection=your_psycopg2_conn)
|
|
26
|
-
|
|
27
|
-
# Insert — re-mapped before storage
|
|
28
|
-
adapter.insert(text=doc, vector=embed(doc))
|
|
29
|
-
|
|
30
|
-
# Search — query re-mapped identically, no hallucination path
|
|
31
|
-
results = adapter.search("what is our risk exposure?", query_vector=q_vec)
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
## Installation
|
|
35
|
-
|
|
36
|
-
```bash
|
|
37
|
-
pip install prismrag-patch # core only
|
|
38
|
-
pip install "prismrag-patch[pgvector]" # + pgvector support
|
|
39
|
-
pip install "prismrag-patch[chroma]" # + ChromaDB support
|
|
40
|
-
pip install "prismrag-patch[pinecone]" # + Pinecone support
|
|
41
|
-
pip install "prismrag-patch[weaviate]" # + Weaviate support
|
|
42
|
-
pip install "prismrag-patch[all]" # all adapters
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
## License
|
|
46
|
-
|
|
47
|
-
Commercial license required. Get yours at
|
|
48
|
-
[prismrag.insightits.com/prismrag-lib.html](https://prismrag.insightits.com/prismrag-lib.html).
|
|
49
|
-
|
|
50
|
-
© 2026 Insight IT Solutions
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: prismrag-patch
|
|
3
|
-
Version: 0.1.0
|
|
4
|
-
Summary: Drop-in hallucination-resistant retrieval for pgvector, ChromaDB, Pinecone, and Weaviate
|
|
5
|
-
Author-email: Insight IT Solutions <sales@prismrag.insightits.com>
|
|
6
|
-
License: Commercial
|
|
7
|
-
Project-URL: Homepage, https://prismrag.insightits.com/prismrag-lib.html
|
|
8
|
-
Project-URL: Repository, https://github.com/aminparva84/InsightPrismRAG
|
|
9
|
-
Project-URL: Bug Tracker, https://prismrag.insightits.com/support
|
|
10
|
-
Keywords: rag,vector-database,hallucination,pgvector,chromadb,pinecone,weaviate,llm
|
|
11
|
-
Classifier: Development Status :: 4 - Beta
|
|
12
|
-
Classifier: Intended Audience :: Developers
|
|
13
|
-
Classifier: Programming Language :: Python :: 3
|
|
14
|
-
Classifier: Programming Language :: Python :: 3.9
|
|
15
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
16
|
-
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
-
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
-
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
19
|
-
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
20
|
-
Requires-Python: >=3.9
|
|
21
|
-
Description-Content-Type: text/markdown
|
|
22
|
-
Requires-Dist: requests>=2.28
|
|
23
|
-
Requires-Dist: numpy>=1.24
|
|
24
|
-
Provides-Extra: pgvector
|
|
25
|
-
Requires-Dist: psycopg2-binary>=2.9; extra == "pgvector"
|
|
26
|
-
Requires-Dist: pgvector>=0.2; extra == "pgvector"
|
|
27
|
-
Provides-Extra: chroma
|
|
28
|
-
Requires-Dist: chromadb>=0.4; extra == "chroma"
|
|
29
|
-
Provides-Extra: pinecone
|
|
30
|
-
Requires-Dist: pinecone-client>=3.0; extra == "pinecone"
|
|
31
|
-
Provides-Extra: weaviate
|
|
32
|
-
Requires-Dist: weaviate-client>=4.0; extra == "weaviate"
|
|
33
|
-
Provides-Extra: all
|
|
34
|
-
Requires-Dist: psycopg2-binary>=2.9; extra == "all"
|
|
35
|
-
Requires-Dist: pgvector>=0.2; extra == "all"
|
|
36
|
-
Requires-Dist: chromadb>=0.4; extra == "all"
|
|
37
|
-
Requires-Dist: pinecone-client>=3.0; extra == "all"
|
|
38
|
-
Requires-Dist: weaviate-client>=4.0; extra == "all"
|
|
39
|
-
|
|
40
|
-
# prismrag-patch
|
|
41
|
-
|
|
42
|
-
**Drop-in hallucination-resistant retrieval for your own vector database.**
|
|
43
|
-
|
|
44
|
-
PrismRAG Patch wraps pgvector, ChromaDB, Pinecone, or Weaviate with PrismRAG's
|
|
45
|
-
Tier-1 re-mapping technique — deterministic category projection that grounds every
|
|
46
|
-
chunk in your verified rules before it ever reaches the LLM.
|
|
47
|
-
|
|
48
|
-
```python
|
|
49
|
-
from prismrag_patch import PrismRAGPatch
|
|
50
|
-
from prismrag_patch.adapters.pgvector import PgvectorAdapter
|
|
51
|
-
|
|
52
|
-
mapping = {
|
|
53
|
-
"categories": [
|
|
54
|
-
{"slug": "risk", "label": "Risk & Compliance"},
|
|
55
|
-
{"slug": "growth", "label": "Growth"},
|
|
56
|
-
],
|
|
57
|
-
"rules": [
|
|
58
|
-
{"word": "volatility", "category_slug": "risk", "weight": 1.0},
|
|
59
|
-
{"word": "revenue", "category_slug": "growth", "weight": 1.0},
|
|
60
|
-
],
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
patch = PrismRAGPatch(license_key="prlib_…", mapping=mapping)
|
|
64
|
-
adapter = PgvectorAdapter(patch, connection=your_psycopg2_conn)
|
|
65
|
-
|
|
66
|
-
# Insert — re-mapped before storage
|
|
67
|
-
adapter.insert(text=doc, vector=embed(doc))
|
|
68
|
-
|
|
69
|
-
# Search — query re-mapped identically, no hallucination path
|
|
70
|
-
results = adapter.search("what is our risk exposure?", query_vector=q_vec)
|
|
71
|
-
```
|
|
72
|
-
|
|
73
|
-
## Installation
|
|
74
|
-
|
|
75
|
-
```bash
|
|
76
|
-
pip install prismrag-patch # core only
|
|
77
|
-
pip install "prismrag-patch[pgvector]" # + pgvector support
|
|
78
|
-
pip install "prismrag-patch[chroma]" # + ChromaDB support
|
|
79
|
-
pip install "prismrag-patch[pinecone]" # + Pinecone support
|
|
80
|
-
pip install "prismrag-patch[weaviate]" # + Weaviate support
|
|
81
|
-
pip install "prismrag-patch[all]" # all adapters
|
|
82
|
-
```
|
|
83
|
-
|
|
84
|
-
## License
|
|
85
|
-
|
|
86
|
-
Commercial license required. Get yours at
|
|
87
|
-
[prismrag.insightits.com/prismrag-lib.html](https://prismrag.insightits.com/prismrag-lib.html).
|
|
88
|
-
|
|
89
|
-
© 2026 Insight IT Solutions
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|