@retrivora-ai/rag-engine 2.6.2 → 2.6.3

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.
Files changed (49) hide show
  1. package/dist/ChromaDBProvider-NDA2IBOH.mjs +8 -0
  2. package/dist/MilvusProvider-H6GGL5FQ.mjs +8 -0
  3. package/dist/MongoDBProvider-KC3GF3FH.mjs +8 -0
  4. package/dist/MultiTablePostgresProvider-6LJBFZL2.mjs +9 -0
  5. package/dist/PineconeProvider-22RF2QPF.mjs +10 -0
  6. package/dist/PineconeProvider-HBBIXLT3.mjs +10 -0
  7. package/dist/PostgreSQLProvider-VWFL4OIP.mjs +8 -0
  8. package/dist/QdrantProvider-UU7RGXBI.mjs +8 -0
  9. package/dist/RedisProvider-MIIPSAAE.mjs +8 -0
  10. package/dist/SimpleGraphProvider-HJIS4S7Y.mjs +70 -0
  11. package/dist/UniversalVectorProvider-NO3L255G.mjs +9 -0
  12. package/dist/WeaviateProvider-YRZDZFAC.mjs +8 -0
  13. package/dist/chunk-23PFNEBF.mjs +107 -0
  14. package/dist/chunk-3E4GZGDX.mjs +10851 -0
  15. package/dist/chunk-3SQ4DODU.mjs +238 -0
  16. package/dist/chunk-AHMMUZ4W.mjs +152 -0
  17. package/dist/chunk-ASBNNEVI.mjs +81 -0
  18. package/dist/chunk-AT4TFUQN.mjs +219 -0
  19. package/dist/chunk-BEPLYQBS.mjs +89 -0
  20. package/dist/chunk-G7MJRFCO.mjs +340 -0
  21. package/dist/chunk-IHWKVAUR.mjs +112 -0
  22. package/dist/chunk-IMP6FUCY.mjs +30 -0
  23. package/dist/chunk-LFNV6DEL.mjs +281 -0
  24. package/dist/chunk-MAXMVO7B.mjs +211 -0
  25. package/dist/chunk-MGJ6V2IT.mjs +203 -0
  26. package/dist/chunk-N3TI27LG.mjs +334 -0
  27. package/dist/chunk-NWYE4Q7B.mjs +334 -0
  28. package/dist/chunk-OJMAT4EG.mjs +219 -0
  29. package/dist/chunk-QKZM3RSJ.mjs +10851 -0
  30. package/dist/chunk-QUY3E6HJ.mjs +168 -0
  31. package/dist/chunk-SG6XYLQE.mjs +53 -0
  32. package/dist/chunk-UT6SZZEC.mjs +69 -0
  33. package/dist/chunk-VW3U4MMX.mjs +157 -0
  34. package/dist/chunk-WOJCOTXI.mjs +281 -0
  35. package/dist/chunk-XP6NJMX4.mjs +168 -0
  36. package/dist/chunk-XYBKDJDW.mjs +696 -0
  37. package/dist/handlers/index.d.mts +1 -1
  38. package/dist/handlers/index.d.ts +1 -1
  39. package/dist/handlers/index.js +56 -23
  40. package/dist/handlers/index.mjs +24 -14027
  41. package/dist/{index-D7FuQRSb.d.mts → index-BBbt5A2y.d.mts} +3 -1
  42. package/dist/{index-CFl4KrKq.d.ts → index-BZ_rR6V8.d.ts} +3 -1
  43. package/dist/index.js +12 -4
  44. package/dist/index.mjs +46 -1461
  45. package/dist/server.d.mts +2 -2
  46. package/dist/server.d.ts +2 -2
  47. package/dist/server.js +56 -23
  48. package/dist/server.mjs +377 -14573
  49. package/package.json +1 -1
@@ -0,0 +1,8 @@
1
+ import {
2
+ ChromaDBProvider
3
+ } from "./chunk-23PFNEBF.mjs";
4
+ import "./chunk-IMP6FUCY.mjs";
5
+ import "./chunk-UT6SZZEC.mjs";
6
+ export {
7
+ ChromaDBProvider
8
+ };
@@ -0,0 +1,8 @@
1
+ import {
2
+ MilvusProvider
3
+ } from "./chunk-IHWKVAUR.mjs";
4
+ import "./chunk-IMP6FUCY.mjs";
5
+ import "./chunk-UT6SZZEC.mjs";
6
+ export {
7
+ MilvusProvider
8
+ };
@@ -0,0 +1,8 @@
1
+ import {
2
+ MongoDBProvider
3
+ } from "./chunk-MAXMVO7B.mjs";
4
+ import "./chunk-IMP6FUCY.mjs";
5
+ import "./chunk-UT6SZZEC.mjs";
6
+ export {
7
+ MongoDBProvider
8
+ };
@@ -0,0 +1,9 @@
1
+ import {
2
+ MultiTablePostgresProvider
3
+ } from "./chunk-G7MJRFCO.mjs";
4
+ import "./chunk-BEPLYQBS.mjs";
5
+ import "./chunk-IMP6FUCY.mjs";
6
+ import "./chunk-UT6SZZEC.mjs";
7
+ export {
8
+ MultiTablePostgresProvider
9
+ };
@@ -0,0 +1,10 @@
1
+ import {
2
+ PineconeProvider
3
+ } from "./chunk-LFNV6DEL.mjs";
4
+ import "./chunk-N3TI27LG.mjs";
5
+ import "./chunk-XP6NJMX4.mjs";
6
+ import "./chunk-IMP6FUCY.mjs";
7
+ import "./chunk-UT6SZZEC.mjs";
8
+ export {
9
+ PineconeProvider
10
+ };
@@ -0,0 +1,10 @@
1
+ import {
2
+ PineconeProvider
3
+ } from "./chunk-WOJCOTXI.mjs";
4
+ import "./chunk-NWYE4Q7B.mjs";
5
+ import "./chunk-QUY3E6HJ.mjs";
6
+ import "./chunk-IMP6FUCY.mjs";
7
+ import "./chunk-UT6SZZEC.mjs";
8
+ export {
9
+ PineconeProvider
10
+ };
@@ -0,0 +1,8 @@
1
+ import {
2
+ PostgreSQLProvider
3
+ } from "./chunk-MGJ6V2IT.mjs";
4
+ import "./chunk-IMP6FUCY.mjs";
5
+ import "./chunk-UT6SZZEC.mjs";
6
+ export {
7
+ PostgreSQLProvider
8
+ };
@@ -0,0 +1,8 @@
1
+ import {
2
+ QdrantProvider
3
+ } from "./chunk-3SQ4DODU.mjs";
4
+ import "./chunk-IMP6FUCY.mjs";
5
+ import "./chunk-UT6SZZEC.mjs";
6
+ export {
7
+ QdrantProvider
8
+ };
@@ -0,0 +1,8 @@
1
+ import {
2
+ RedisProvider
3
+ } from "./chunk-ASBNNEVI.mjs";
4
+ import "./chunk-IMP6FUCY.mjs";
5
+ import "./chunk-UT6SZZEC.mjs";
6
+ export {
7
+ RedisProvider
8
+ };
@@ -0,0 +1,70 @@
1
+ import "./chunk-UT6SZZEC.mjs";
2
+
3
+ // src/providers/graphdb/BaseGraphProvider.ts
4
+ var BaseGraphProvider = class {
5
+ constructor(config) {
6
+ this.config = config;
7
+ }
8
+ };
9
+
10
+ // src/providers/graphdb/SimpleGraphProvider.ts
11
+ var SimpleGraphProvider = class extends BaseGraphProvider {
12
+ constructor() {
13
+ super(...arguments);
14
+ this.nodes = /* @__PURE__ */ new Map();
15
+ this.edges = [];
16
+ }
17
+ async initialize() {
18
+ console.warn(
19
+ "[SimpleGraphProvider] Warning: SimpleGraphProvider is an in-memory database meant for demonstration and local development. Graph data is NOT persisted across restarts."
20
+ );
21
+ }
22
+ async addNodes(nodes) {
23
+ for (const node of nodes) {
24
+ this.nodes.set(node.id, node);
25
+ }
26
+ }
27
+ async addEdges(edges) {
28
+ this.edges.push(...edges);
29
+ }
30
+ async query(queryText, limit = 5) {
31
+ const q = queryText.toLowerCase();
32
+ const matchedNodes = Array.from(this.nodes.values()).filter(
33
+ (node) => node.id.toLowerCase().includes(q) || node.label.toLowerCase().includes(q) || JSON.stringify(node.properties).toLowerCase().includes(q)
34
+ ).slice(0, limit);
35
+ const matchedNodeIds = new Set(matchedNodes.map((n) => n.id));
36
+ const matchedEdges = this.edges.filter(
37
+ (edge) => matchedNodeIds.has(edge.source) || matchedNodeIds.has(edge.target)
38
+ );
39
+ for (const edge of matchedEdges) {
40
+ if (!matchedNodeIds.has(edge.source)) {
41
+ const source = this.nodes.get(edge.source);
42
+ if (source) {
43
+ matchedNodes.push(source);
44
+ matchedNodeIds.add(edge.source);
45
+ }
46
+ }
47
+ if (!matchedNodeIds.has(edge.target)) {
48
+ const target = this.nodes.get(edge.target);
49
+ if (target) {
50
+ matchedNodes.push(target);
51
+ matchedNodeIds.add(edge.target);
52
+ }
53
+ }
54
+ }
55
+ return {
56
+ nodes: matchedNodes,
57
+ edges: matchedEdges
58
+ };
59
+ }
60
+ async ping() {
61
+ return true;
62
+ }
63
+ async disconnect() {
64
+ this.nodes.clear();
65
+ this.edges = [];
66
+ }
67
+ };
68
+ export {
69
+ SimpleGraphProvider
70
+ };
@@ -0,0 +1,9 @@
1
+ import {
2
+ UniversalVectorProvider
3
+ } from "./chunk-VW3U4MMX.mjs";
4
+ import "./chunk-SG6XYLQE.mjs";
5
+ import "./chunk-IMP6FUCY.mjs";
6
+ import "./chunk-UT6SZZEC.mjs";
7
+ export {
8
+ UniversalVectorProvider
9
+ };
@@ -0,0 +1,8 @@
1
+ import {
2
+ WeaviateProvider
3
+ } from "./chunk-AHMMUZ4W.mjs";
4
+ import "./chunk-IMP6FUCY.mjs";
5
+ import "./chunk-UT6SZZEC.mjs";
6
+ export {
7
+ WeaviateProvider
8
+ };
@@ -0,0 +1,107 @@
1
+ import {
2
+ BaseVectorProvider
3
+ } from "./chunk-IMP6FUCY.mjs";
4
+ import {
5
+ __spreadValues
6
+ } from "./chunk-UT6SZZEC.mjs";
7
+
8
+ // src/providers/vectordb/ChromaDBProvider.ts
9
+ import axios from "axios";
10
+ var ChromaDBProvider = class extends BaseVectorProvider {
11
+ constructor(config) {
12
+ super(config);
13
+ this.collectionId = "";
14
+ const opts = config.options;
15
+ const baseUrl = opts.baseUrl || (opts.host ? `http://${opts.host}:${opts.port || 8e3}` : void 0);
16
+ if (!baseUrl) throw new Error("[ChromaDBProvider] options.baseUrl is required");
17
+ this.http = axios.create({
18
+ baseURL: baseUrl,
19
+ headers: { "Content-Type": "application/json" }
20
+ });
21
+ }
22
+ /**
23
+ * Get or create the ChromaDB collection.
24
+ */
25
+ async initialize() {
26
+ var _a;
27
+ try {
28
+ const { data } = await this.http.get(`/api/v1/collections/${this.indexName}`);
29
+ this.collectionId = data.id;
30
+ } catch (err) {
31
+ if (axios.isAxiosError(err) && ((_a = err.response) == null ? void 0 : _a.status) === 404) {
32
+ const { data } = await this.http.post("/api/v1/collections", {
33
+ name: this.indexName
34
+ });
35
+ this.collectionId = data.id;
36
+ } else {
37
+ throw err;
38
+ }
39
+ }
40
+ }
41
+ async upsert(doc, namespace) {
42
+ await this.batchUpsert([doc], namespace);
43
+ }
44
+ async batchUpsert(docs, namespace) {
45
+ const payload = {
46
+ ids: docs.map((d) => String(d.id)),
47
+ embeddings: docs.map((d) => d.vector),
48
+ documents: docs.map((d) => d.content),
49
+ metadatas: docs.map((d) => __spreadValues(__spreadValues({}, d.metadata || {}), namespace ? { namespace } : {}))
50
+ };
51
+ await this.http.post(`/api/v1/collections/${this.collectionId}/upsert`, payload);
52
+ }
53
+ async query(vector, topK, namespace, _filter) {
54
+ const sanitizedFilter = this.sanitizeFilter(_filter);
55
+ const whereClauses = [];
56
+ if (namespace) whereClauses.push({ namespace: { $eq: namespace } });
57
+ Object.entries(sanitizedFilter).forEach(([key, value]) => {
58
+ if (key === "namespace") return;
59
+ if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") {
60
+ whereClauses.push({ [key]: { $eq: value } });
61
+ }
62
+ });
63
+ const payload = {
64
+ query_embeddings: [vector],
65
+ n_results: topK,
66
+ where: whereClauses.length > 1 ? { $and: whereClauses } : whereClauses[0]
67
+ };
68
+ const { data } = await this.http.post(`/api/v1/collections/${this.collectionId}/query`, payload);
69
+ const matches = [];
70
+ if (data.ids && data.ids[0]) {
71
+ for (let i = 0; i < data.ids[0].length; i++) {
72
+ matches.push({
73
+ id: data.ids[0][i],
74
+ score: data.distances ? 1 - data.distances[0][i] : 0,
75
+ content: data.documents ? data.documents[0][i] : "",
76
+ metadata: data.metadatas ? data.metadatas[0][i] : {}
77
+ });
78
+ }
79
+ }
80
+ return matches;
81
+ }
82
+ async delete(id, namespace) {
83
+ await this.http.post(`/api/v1/collections/${this.collectionId}/delete`, {
84
+ ids: [id],
85
+ where: namespace ? { namespace: { $eq: namespace } } : void 0
86
+ });
87
+ }
88
+ async deleteNamespace(namespace) {
89
+ await this.http.post(`/api/v1/collections/${this.collectionId}/delete`, {
90
+ where: { namespace: { $eq: namespace } }
91
+ });
92
+ }
93
+ async ping() {
94
+ try {
95
+ await this.http.get("/api/v1/heartbeat");
96
+ return true;
97
+ } catch (e) {
98
+ return false;
99
+ }
100
+ }
101
+ async disconnect() {
102
+ }
103
+ };
104
+
105
+ export {
106
+ ChromaDBProvider
107
+ };