prismrag-patch 0.1.0__tar.gz → 0.1.2__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.
@@ -0,0 +1,232 @@
1
+ Metadata-Version: 2.4
2
+ Name: prismrag-patch
3
+ Version: 0.1.2
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
+ Works with **any embedding model** — Gemini, OpenAI, Cohere, HuggingFace, or your
49
+ own local model. No lock-in.
50
+
51
+ ## Requirements
52
+
53
+ | Requirement | Detail |
54
+ |-------------|--------|
55
+ | Python | 3.10+ |
56
+ | License key | `prlib_` key from [prismrag.insightits.com](https://prismrag.insightits.com/prismrag-lib.html) |
57
+ | Embedding model | Any model that returns a list of floats — you provide the vector |
58
+
59
+ > **prismrag-patch does not generate embeddings.** You call your embedding model
60
+ > of choice, then pass the resulting vector to the adapter. The library remaps,
61
+ > enriches, and stores/searches it in your database.
62
+
63
+ ## Quick start
64
+
65
+ ```python
66
+ from prismrag_patch import PrismRAGPatch
67
+ from prismrag_patch.adapters.pgvector import PgvectorAdapter
68
+ import psycopg2
69
+
70
+ # ── 1. Your embedding function — use any model ────────────────────────────────
71
+
72
+ # Option A: OpenAI
73
+ from openai import OpenAI
74
+ def embed(text):
75
+ return OpenAI().embeddings.create(
76
+ input=text, model="text-embedding-3-small"
77
+ ).data[0].embedding # 1536-dim
78
+
79
+ # Option B: Gemini
80
+ import os, requests
81
+ def embed(text):
82
+ resp = requests.post(
83
+ "https://generativelanguage.googleapis.com/v1beta/models/"
84
+ f"gemini-embedding-001:batchEmbedContents?key={os.environ['GEMINI_API_KEY']}",
85
+ json={"requests": [{"model": "models/gemini-embedding-001",
86
+ "content": {"parts": [{"text": text}]},
87
+ "outputDimensionality": 768}]},
88
+ timeout=30,
89
+ )
90
+ return resp.json()["embeddings"][0]["values"] # 768-dim
91
+
92
+ # Option C: HuggingFace (local, no API key)
93
+ from sentence_transformers import SentenceTransformer
94
+ _model = SentenceTransformer("all-MiniLM-L6-v2")
95
+ def embed(text):
96
+ return _model.encode(text).tolist() # 384-dim
97
+
98
+
99
+ # ── 2. Define your category mapping ──────────────────────────────────────────
100
+ mapping = {
101
+ "categories": [
102
+ {"slug": "risk", "label": "Risk and Compliance"},
103
+ {"slug": "growth", "label": "Revenue and Growth"},
104
+ ],
105
+ "rules": [
106
+ {"word": "volatility", "category_slug": "risk", "weight": 1.0},
107
+ {"word": "fraud", "category_slug": "risk", "weight": 1.0},
108
+ {"word": "revenue", "category_slug": "growth", "weight": 1.0},
109
+ {"word": "earnings", "category_slug": "growth", "weight": 1.0},
110
+ ],
111
+ }
112
+
113
+ # ── 3. Initialize and connect ─────────────────────────────────────────────────
114
+ patch = PrismRAGPatch(license_key="prlib_YOUR_KEY_HERE", mapping=mapping)
115
+ conn = psycopg2.connect("postgresql://user:pass@localhost:5432/mydb")
116
+ adapter = PgvectorAdapter(patch, conn, table="my_chunks")
117
+ adapter.ensure_table(dim=768) # match your model's output dimension
118
+
119
+ # ── 4. Embed with your model, insert with prismrag-patch ─────────────────────
120
+ doc = "Market volatility spiked due to fraud risk exposure."
121
+ vec = embed(doc) # your model produces the vector
122
+ row_id = adapter.insert(doc, vec, metadata={"source": "risk_report"})
123
+ # stored vector is remapped toward "risk" category cluster
124
+ # metadata gets prismrag_category + prismrag_label injected automatically
125
+
126
+ # ── 5. Search ─────────────────────────────────────────────────────────────────
127
+ query = "what is our risk exposure?"
128
+ query_vec = embed(query)
129
+ results = adapter.search(query, query_vec, top_k=5)
130
+ for r in results:
131
+ print(r["score"], r["metadata"]["prismrag_category"], r["text"][:60])
132
+ ```
133
+
134
+ ## Batch insert
135
+
136
+ ```python
137
+ records = [
138
+ {"text": doc1, "vector": embed(doc1), "metadata": {"source": "q1"}},
139
+ {"text": doc2, "vector": embed(doc2), "metadata": {"source": "q2"}},
140
+ ]
141
+ ids = adapter.batch_insert(records) # single transaction
142
+ ```
143
+
144
+ ## Installation
145
+
146
+ ```bash
147
+ pip install prismrag-patch # core only
148
+ pip install "prismrag-patch[pgvector]" # + pgvector (psycopg2)
149
+ pip install "prismrag-patch[chroma]" # + ChromaDB
150
+ pip install "prismrag-patch[pinecone]" # + Pinecone v3
151
+ pip install "prismrag-patch[weaviate]" # + Weaviate v4
152
+ pip install "prismrag-patch[all]" # all adapters
153
+ ```
154
+
155
+ ## Other adapters
156
+
157
+ ### ChromaDB
158
+
159
+ ```python
160
+ import chromadb
161
+ from prismrag_patch.adapters.chroma import ChromaAdapter
162
+
163
+ client = chromadb.Client()
164
+ collection = client.get_or_create_collection("my_chunks")
165
+ adapter = ChromaAdapter(patch, collection)
166
+ adapter.insert(doc, embed(doc), metadata={"source": "report"})
167
+ ```
168
+
169
+ ### Pinecone
170
+
171
+ ```python
172
+ from pinecone import Pinecone
173
+ from prismrag_patch.adapters.pinecone import PineconeAdapter
174
+
175
+ pc = Pinecone(api_key="YOUR_PINECONE_KEY")
176
+ index = pc.Index("my-index")
177
+ adapter = PineconeAdapter(patch, index, namespace="finance")
178
+ adapter.insert(doc, embed(doc), metadata={"source": "report"})
179
+ ```
180
+
181
+ ### Weaviate
182
+
183
+ ```python
184
+ import weaviate
185
+ from prismrag_patch.adapters.weaviate import WeaviateAdapter
186
+
187
+ client = weaviate.connect_to_local()
188
+ collection = client.collections.get("MyChunks")
189
+ adapter = WeaviateAdapter(patch, collection)
190
+ adapter.insert(doc, embed(doc))
191
+ ```
192
+
193
+ ## How it works
194
+
195
+ ```
196
+ Your text
197
+
198
+
199
+ Any embedding model (OpenAI / Gemini / HuggingFace / Cohere / your own)
200
+
201
+
202
+ raw vector [0.12, -0.45, 0.88, ...] N dimensions
203
+
204
+
205
+ prismrag-patch.insert(text, raw_vector, metadata)
206
+
207
+ ├─ category inferred from your rules (local, deterministic, no API call)
208
+ ├─ vector nudged toward winning category cluster (blend_alpha=0.35)
209
+ └─ metadata enriched with prismrag_category + prismrag_label
210
+
211
+
212
+ stored in YOUR database — prismrag-patch never holds your data
213
+ ```
214
+
215
+ ## What prismrag-patch does NOT do
216
+
217
+ - Generate embeddings — you bring your own model
218
+ - Call an LLM
219
+ - Store your data on PrismRAG servers
220
+ - Lock you into any embedding provider
221
+
222
+ The only network call is a one-time license validation (cached 23 hours,
223
+ 7-day offline grace period).
224
+
225
+ ## License
226
+
227
+ Commercial license required. Get yours at
228
+ [prismrag.insightits.com/prismrag-lib.html](https://prismrag.insightits.com/prismrag-lib.html).
229
+
230
+ Questions? [prismrag@insightits.com](mailto:prismrag@insightits.com)
231
+
232
+ © 2026 Insight IT Solutions
@@ -0,0 +1,193 @@
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
+ Works with **any embedding model** — Gemini, OpenAI, Cohere, HuggingFace, or your
10
+ own local model. No lock-in.
11
+
12
+ ## Requirements
13
+
14
+ | Requirement | Detail |
15
+ |-------------|--------|
16
+ | Python | 3.10+ |
17
+ | License key | `prlib_` key from [prismrag.insightits.com](https://prismrag.insightits.com/prismrag-lib.html) |
18
+ | Embedding model | Any model that returns a list of floats — you provide the vector |
19
+
20
+ > **prismrag-patch does not generate embeddings.** You call your embedding model
21
+ > of choice, then pass the resulting vector to the adapter. The library remaps,
22
+ > enriches, and stores/searches it in your database.
23
+
24
+ ## Quick start
25
+
26
+ ```python
27
+ from prismrag_patch import PrismRAGPatch
28
+ from prismrag_patch.adapters.pgvector import PgvectorAdapter
29
+ import psycopg2
30
+
31
+ # ── 1. Your embedding function — use any model ────────────────────────────────
32
+
33
+ # Option A: OpenAI
34
+ from openai import OpenAI
35
+ def embed(text):
36
+ return OpenAI().embeddings.create(
37
+ input=text, model="text-embedding-3-small"
38
+ ).data[0].embedding # 1536-dim
39
+
40
+ # Option B: Gemini
41
+ import os, requests
42
+ def embed(text):
43
+ resp = requests.post(
44
+ "https://generativelanguage.googleapis.com/v1beta/models/"
45
+ f"gemini-embedding-001:batchEmbedContents?key={os.environ['GEMINI_API_KEY']}",
46
+ json={"requests": [{"model": "models/gemini-embedding-001",
47
+ "content": {"parts": [{"text": text}]},
48
+ "outputDimensionality": 768}]},
49
+ timeout=30,
50
+ )
51
+ return resp.json()["embeddings"][0]["values"] # 768-dim
52
+
53
+ # Option C: HuggingFace (local, no API key)
54
+ from sentence_transformers import SentenceTransformer
55
+ _model = SentenceTransformer("all-MiniLM-L6-v2")
56
+ def embed(text):
57
+ return _model.encode(text).tolist() # 384-dim
58
+
59
+
60
+ # ── 2. Define your category mapping ──────────────────────────────────────────
61
+ mapping = {
62
+ "categories": [
63
+ {"slug": "risk", "label": "Risk and Compliance"},
64
+ {"slug": "growth", "label": "Revenue and Growth"},
65
+ ],
66
+ "rules": [
67
+ {"word": "volatility", "category_slug": "risk", "weight": 1.0},
68
+ {"word": "fraud", "category_slug": "risk", "weight": 1.0},
69
+ {"word": "revenue", "category_slug": "growth", "weight": 1.0},
70
+ {"word": "earnings", "category_slug": "growth", "weight": 1.0},
71
+ ],
72
+ }
73
+
74
+ # ── 3. Initialize and connect ─────────────────────────────────────────────────
75
+ patch = PrismRAGPatch(license_key="prlib_YOUR_KEY_HERE", mapping=mapping)
76
+ conn = psycopg2.connect("postgresql://user:pass@localhost:5432/mydb")
77
+ adapter = PgvectorAdapter(patch, conn, table="my_chunks")
78
+ adapter.ensure_table(dim=768) # match your model's output dimension
79
+
80
+ # ── 4. Embed with your model, insert with prismrag-patch ─────────────────────
81
+ doc = "Market volatility spiked due to fraud risk exposure."
82
+ vec = embed(doc) # your model produces the vector
83
+ row_id = adapter.insert(doc, vec, metadata={"source": "risk_report"})
84
+ # stored vector is remapped toward "risk" category cluster
85
+ # metadata gets prismrag_category + prismrag_label injected automatically
86
+
87
+ # ── 5. Search ─────────────────────────────────────────────────────────────────
88
+ query = "what is our risk exposure?"
89
+ query_vec = embed(query)
90
+ results = adapter.search(query, query_vec, top_k=5)
91
+ for r in results:
92
+ print(r["score"], r["metadata"]["prismrag_category"], r["text"][:60])
93
+ ```
94
+
95
+ ## Batch insert
96
+
97
+ ```python
98
+ records = [
99
+ {"text": doc1, "vector": embed(doc1), "metadata": {"source": "q1"}},
100
+ {"text": doc2, "vector": embed(doc2), "metadata": {"source": "q2"}},
101
+ ]
102
+ ids = adapter.batch_insert(records) # single transaction
103
+ ```
104
+
105
+ ## Installation
106
+
107
+ ```bash
108
+ pip install prismrag-patch # core only
109
+ pip install "prismrag-patch[pgvector]" # + pgvector (psycopg2)
110
+ pip install "prismrag-patch[chroma]" # + ChromaDB
111
+ pip install "prismrag-patch[pinecone]" # + Pinecone v3
112
+ pip install "prismrag-patch[weaviate]" # + Weaviate v4
113
+ pip install "prismrag-patch[all]" # all adapters
114
+ ```
115
+
116
+ ## Other adapters
117
+
118
+ ### ChromaDB
119
+
120
+ ```python
121
+ import chromadb
122
+ from prismrag_patch.adapters.chroma import ChromaAdapter
123
+
124
+ client = chromadb.Client()
125
+ collection = client.get_or_create_collection("my_chunks")
126
+ adapter = ChromaAdapter(patch, collection)
127
+ adapter.insert(doc, embed(doc), metadata={"source": "report"})
128
+ ```
129
+
130
+ ### Pinecone
131
+
132
+ ```python
133
+ from pinecone import Pinecone
134
+ from prismrag_patch.adapters.pinecone import PineconeAdapter
135
+
136
+ pc = Pinecone(api_key="YOUR_PINECONE_KEY")
137
+ index = pc.Index("my-index")
138
+ adapter = PineconeAdapter(patch, index, namespace="finance")
139
+ adapter.insert(doc, embed(doc), metadata={"source": "report"})
140
+ ```
141
+
142
+ ### Weaviate
143
+
144
+ ```python
145
+ import weaviate
146
+ from prismrag_patch.adapters.weaviate import WeaviateAdapter
147
+
148
+ client = weaviate.connect_to_local()
149
+ collection = client.collections.get("MyChunks")
150
+ adapter = WeaviateAdapter(patch, collection)
151
+ adapter.insert(doc, embed(doc))
152
+ ```
153
+
154
+ ## How it works
155
+
156
+ ```
157
+ Your text
158
+
159
+
160
+ Any embedding model (OpenAI / Gemini / HuggingFace / Cohere / your own)
161
+
162
+
163
+ raw vector [0.12, -0.45, 0.88, ...] N dimensions
164
+
165
+
166
+ prismrag-patch.insert(text, raw_vector, metadata)
167
+
168
+ ├─ category inferred from your rules (local, deterministic, no API call)
169
+ ├─ vector nudged toward winning category cluster (blend_alpha=0.35)
170
+ └─ metadata enriched with prismrag_category + prismrag_label
171
+
172
+
173
+ stored in YOUR database — prismrag-patch never holds your data
174
+ ```
175
+
176
+ ## What prismrag-patch does NOT do
177
+
178
+ - Generate embeddings — you bring your own model
179
+ - Call an LLM
180
+ - Store your data on PrismRAG servers
181
+ - Lock you into any embedding provider
182
+
183
+ The only network call is a one-time license validation (cached 23 hours,
184
+ 7-day offline grace period).
185
+
186
+ ## License
187
+
188
+ Commercial license required. Get yours at
189
+ [prismrag.insightits.com/prismrag-lib.html](https://prismrag.insightits.com/prismrag-lib.html).
190
+
191
+ Questions? [prismrag@insightits.com](mailto:prismrag@insightits.com)
192
+
193
+ © 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 support@prismrag.insightits.com. ({exc})"
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,232 @@
1
+ Metadata-Version: 2.4
2
+ Name: prismrag-patch
3
+ Version: 0.1.2
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
+ Works with **any embedding model** — Gemini, OpenAI, Cohere, HuggingFace, or your
49
+ own local model. No lock-in.
50
+
51
+ ## Requirements
52
+
53
+ | Requirement | Detail |
54
+ |-------------|--------|
55
+ | Python | 3.10+ |
56
+ | License key | `prlib_` key from [prismrag.insightits.com](https://prismrag.insightits.com/prismrag-lib.html) |
57
+ | Embedding model | Any model that returns a list of floats — you provide the vector |
58
+
59
+ > **prismrag-patch does not generate embeddings.** You call your embedding model
60
+ > of choice, then pass the resulting vector to the adapter. The library remaps,
61
+ > enriches, and stores/searches it in your database.
62
+
63
+ ## Quick start
64
+
65
+ ```python
66
+ from prismrag_patch import PrismRAGPatch
67
+ from prismrag_patch.adapters.pgvector import PgvectorAdapter
68
+ import psycopg2
69
+
70
+ # ── 1. Your embedding function — use any model ────────────────────────────────
71
+
72
+ # Option A: OpenAI
73
+ from openai import OpenAI
74
+ def embed(text):
75
+ return OpenAI().embeddings.create(
76
+ input=text, model="text-embedding-3-small"
77
+ ).data[0].embedding # 1536-dim
78
+
79
+ # Option B: Gemini
80
+ import os, requests
81
+ def embed(text):
82
+ resp = requests.post(
83
+ "https://generativelanguage.googleapis.com/v1beta/models/"
84
+ f"gemini-embedding-001:batchEmbedContents?key={os.environ['GEMINI_API_KEY']}",
85
+ json={"requests": [{"model": "models/gemini-embedding-001",
86
+ "content": {"parts": [{"text": text}]},
87
+ "outputDimensionality": 768}]},
88
+ timeout=30,
89
+ )
90
+ return resp.json()["embeddings"][0]["values"] # 768-dim
91
+
92
+ # Option C: HuggingFace (local, no API key)
93
+ from sentence_transformers import SentenceTransformer
94
+ _model = SentenceTransformer("all-MiniLM-L6-v2")
95
+ def embed(text):
96
+ return _model.encode(text).tolist() # 384-dim
97
+
98
+
99
+ # ── 2. Define your category mapping ──────────────────────────────────────────
100
+ mapping = {
101
+ "categories": [
102
+ {"slug": "risk", "label": "Risk and Compliance"},
103
+ {"slug": "growth", "label": "Revenue and Growth"},
104
+ ],
105
+ "rules": [
106
+ {"word": "volatility", "category_slug": "risk", "weight": 1.0},
107
+ {"word": "fraud", "category_slug": "risk", "weight": 1.0},
108
+ {"word": "revenue", "category_slug": "growth", "weight": 1.0},
109
+ {"word": "earnings", "category_slug": "growth", "weight": 1.0},
110
+ ],
111
+ }
112
+
113
+ # ── 3. Initialize and connect ─────────────────────────────────────────────────
114
+ patch = PrismRAGPatch(license_key="prlib_YOUR_KEY_HERE", mapping=mapping)
115
+ conn = psycopg2.connect("postgresql://user:pass@localhost:5432/mydb")
116
+ adapter = PgvectorAdapter(patch, conn, table="my_chunks")
117
+ adapter.ensure_table(dim=768) # match your model's output dimension
118
+
119
+ # ── 4. Embed with your model, insert with prismrag-patch ─────────────────────
120
+ doc = "Market volatility spiked due to fraud risk exposure."
121
+ vec = embed(doc) # your model produces the vector
122
+ row_id = adapter.insert(doc, vec, metadata={"source": "risk_report"})
123
+ # stored vector is remapped toward "risk" category cluster
124
+ # metadata gets prismrag_category + prismrag_label injected automatically
125
+
126
+ # ── 5. Search ─────────────────────────────────────────────────────────────────
127
+ query = "what is our risk exposure?"
128
+ query_vec = embed(query)
129
+ results = adapter.search(query, query_vec, top_k=5)
130
+ for r in results:
131
+ print(r["score"], r["metadata"]["prismrag_category"], r["text"][:60])
132
+ ```
133
+
134
+ ## Batch insert
135
+
136
+ ```python
137
+ records = [
138
+ {"text": doc1, "vector": embed(doc1), "metadata": {"source": "q1"}},
139
+ {"text": doc2, "vector": embed(doc2), "metadata": {"source": "q2"}},
140
+ ]
141
+ ids = adapter.batch_insert(records) # single transaction
142
+ ```
143
+
144
+ ## Installation
145
+
146
+ ```bash
147
+ pip install prismrag-patch # core only
148
+ pip install "prismrag-patch[pgvector]" # + pgvector (psycopg2)
149
+ pip install "prismrag-patch[chroma]" # + ChromaDB
150
+ pip install "prismrag-patch[pinecone]" # + Pinecone v3
151
+ pip install "prismrag-patch[weaviate]" # + Weaviate v4
152
+ pip install "prismrag-patch[all]" # all adapters
153
+ ```
154
+
155
+ ## Other adapters
156
+
157
+ ### ChromaDB
158
+
159
+ ```python
160
+ import chromadb
161
+ from prismrag_patch.adapters.chroma import ChromaAdapter
162
+
163
+ client = chromadb.Client()
164
+ collection = client.get_or_create_collection("my_chunks")
165
+ adapter = ChromaAdapter(patch, collection)
166
+ adapter.insert(doc, embed(doc), metadata={"source": "report"})
167
+ ```
168
+
169
+ ### Pinecone
170
+
171
+ ```python
172
+ from pinecone import Pinecone
173
+ from prismrag_patch.adapters.pinecone import PineconeAdapter
174
+
175
+ pc = Pinecone(api_key="YOUR_PINECONE_KEY")
176
+ index = pc.Index("my-index")
177
+ adapter = PineconeAdapter(patch, index, namespace="finance")
178
+ adapter.insert(doc, embed(doc), metadata={"source": "report"})
179
+ ```
180
+
181
+ ### Weaviate
182
+
183
+ ```python
184
+ import weaviate
185
+ from prismrag_patch.adapters.weaviate import WeaviateAdapter
186
+
187
+ client = weaviate.connect_to_local()
188
+ collection = client.collections.get("MyChunks")
189
+ adapter = WeaviateAdapter(patch, collection)
190
+ adapter.insert(doc, embed(doc))
191
+ ```
192
+
193
+ ## How it works
194
+
195
+ ```
196
+ Your text
197
+
198
+
199
+ Any embedding model (OpenAI / Gemini / HuggingFace / Cohere / your own)
200
+
201
+
202
+ raw vector [0.12, -0.45, 0.88, ...] N dimensions
203
+
204
+
205
+ prismrag-patch.insert(text, raw_vector, metadata)
206
+
207
+ ├─ category inferred from your rules (local, deterministic, no API call)
208
+ ├─ vector nudged toward winning category cluster (blend_alpha=0.35)
209
+ └─ metadata enriched with prismrag_category + prismrag_label
210
+
211
+
212
+ stored in YOUR database — prismrag-patch never holds your data
213
+ ```
214
+
215
+ ## What prismrag-patch does NOT do
216
+
217
+ - Generate embeddings — you bring your own model
218
+ - Call an LLM
219
+ - Store your data on PrismRAG servers
220
+ - Lock you into any embedding provider
221
+
222
+ The only network call is a one-time license validation (cached 23 hours,
223
+ 7-day offline grace period).
224
+
225
+ ## License
226
+
227
+ Commercial license required. Get yours at
228
+ [prismrag.insightits.com/prismrag-lib.html](https://prismrag.insightits.com/prismrag-lib.html).
229
+
230
+ Questions? [prismrag@insightits.com](mailto:prismrag@insightits.com)
231
+
232
+ © 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.0"
7
+ version = "0.1.2"
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 = "sales@prismrag.insightits.com" }]
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 = [
@@ -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
@@ -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