@retrivora-ai/rag-engine 0.3.5 → 0.3.7

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 (38) hide show
  1. package/dist/{ChromaDBProvider-6JWXHZAE.mjs → ChromaDBProvider-GI7TB7GJ.mjs} +2 -2
  2. package/dist/{MilvusProvider-MJQVHU4B.mjs → MilvusProvider-WDVTFB7D.mjs} +2 -2
  3. package/dist/{MongoDBProvider-XS3QR47H.mjs → MongoDBProvider-6X5F5YZS.mjs} +2 -2
  4. package/dist/{PineconeProvider-QZTC7QAP.mjs → PineconeProvider-BE2JWSPD.mjs} +2 -2
  5. package/dist/{PostgreSQLProvider-CNO72UP6.mjs → PostgreSQLProvider-5HHTK4SU.mjs} +2 -2
  6. package/dist/{QdrantProvider-6OBJKUIP.mjs → QdrantProvider-XVDVBNIG.mjs} +2 -2
  7. package/dist/{RagConfig-Bpp39-um.d.mts → RagConfig-CVt24lbC.d.mts} +1 -1
  8. package/dist/{RagConfig-Bpp39-um.d.ts → RagConfig-CVt24lbC.d.ts} +1 -1
  9. package/dist/{RedisProvider-FF5BNQPB.mjs → RedisProvider-EK2R2PQH.mjs} +2 -2
  10. package/dist/{UniversalVectorProvider-CAVX5VSQ.mjs → UniversalVectorProvider-YIDRX6VT.mjs} +2 -2
  11. package/dist/{WeaviateProvider-DIYYBTEF.mjs → WeaviateProvider-4CAPQ7UY.mjs} +2 -2
  12. package/dist/{chunk-ENEUABSO.mjs → chunk-3QWAK3RZ.mjs} +1 -1
  13. package/dist/{chunk-ULX4EF74.mjs → chunk-5KNBWQM6.mjs} +1 -1
  14. package/dist/{chunk-KGW2YHV2.mjs → chunk-DESUAKF3.mjs} +18 -1
  15. package/dist/{chunk-R3GPRETL.mjs → chunk-GQT5LF4G.mjs} +1 -1
  16. package/dist/{chunk-N2L5CFGM.mjs → chunk-H6RKMU7W.mjs} +1 -1
  17. package/dist/{chunk-YVTGOFNV.mjs → chunk-IMP6FUCY.mjs} +12 -5
  18. package/dist/{chunk-7XL3QSQ7.mjs → chunk-KTS3LLHY.mjs} +1 -1
  19. package/dist/{chunk-L54WODRW.mjs → chunk-LJWWPTWE.mjs} +1 -1
  20. package/dist/{chunk-Q2QDQ5SQ.mjs → chunk-RK2UDJA2.mjs} +1 -1
  21. package/dist/{chunk-TOKEXP3M.mjs → chunk-TYZC74CO.mjs} +9 -9
  22. package/dist/{chunk-M3AZTD7F.mjs → chunk-XCNXPECE.mjs} +1 -1
  23. package/dist/handlers/index.d.mts +2 -2
  24. package/dist/handlers/index.d.ts +2 -2
  25. package/dist/handlers/index.js +29 -5
  26. package/dist/handlers/index.mjs +1 -1
  27. package/dist/{index-DSaQwkKA.d.ts → index-D1hoNXMT.d.ts} +1 -1
  28. package/dist/{index-CZE72wnV.d.mts → index-OI2--lvT.d.mts} +1 -1
  29. package/dist/index.d.mts +2 -2
  30. package/dist/index.d.ts +2 -2
  31. package/dist/server.d.mts +9 -4
  32. package/dist/server.d.ts +9 -4
  33. package/dist/server.js +29 -5
  34. package/dist/server.mjs +11 -11
  35. package/package.json +1 -1
  36. package/src/index.ts +1 -1
  37. package/src/providers/vectordb/BaseVectorProvider.ts +17 -5
  38. package/src/providers/vectordb/MongoDBProvider.ts +21 -0
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  ChromaDBProvider
3
- } from "./chunk-Q2QDQ5SQ.mjs";
4
- import "./chunk-YVTGOFNV.mjs";
3
+ } from "./chunk-RK2UDJA2.mjs";
4
+ import "./chunk-IMP6FUCY.mjs";
5
5
  import "./chunk-FWCSY2DS.mjs";
6
6
  export {
7
7
  ChromaDBProvider
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  MilvusProvider
3
- } from "./chunk-ENEUABSO.mjs";
4
- import "./chunk-YVTGOFNV.mjs";
3
+ } from "./chunk-3QWAK3RZ.mjs";
4
+ import "./chunk-IMP6FUCY.mjs";
5
5
  import "./chunk-FWCSY2DS.mjs";
6
6
  export {
7
7
  MilvusProvider
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  MongoDBProvider
3
- } from "./chunk-KGW2YHV2.mjs";
4
- import "./chunk-YVTGOFNV.mjs";
3
+ } from "./chunk-DESUAKF3.mjs";
4
+ import "./chunk-IMP6FUCY.mjs";
5
5
  import "./chunk-FWCSY2DS.mjs";
6
6
  export {
7
7
  MongoDBProvider
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  PineconeProvider
3
- } from "./chunk-M3AZTD7F.mjs";
4
- import "./chunk-YVTGOFNV.mjs";
3
+ } from "./chunk-XCNXPECE.mjs";
4
+ import "./chunk-IMP6FUCY.mjs";
5
5
  import "./chunk-FWCSY2DS.mjs";
6
6
  export {
7
7
  PineconeProvider
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  PostgreSQLProvider
3
- } from "./chunk-L54WODRW.mjs";
4
- import "./chunk-YVTGOFNV.mjs";
3
+ } from "./chunk-LJWWPTWE.mjs";
4
+ import "./chunk-IMP6FUCY.mjs";
5
5
  import "./chunk-FWCSY2DS.mjs";
6
6
  export {
7
7
  PostgreSQLProvider
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  QdrantProvider
3
- } from "./chunk-ULX4EF74.mjs";
4
- import "./chunk-YVTGOFNV.mjs";
3
+ } from "./chunk-5KNBWQM6.mjs";
4
+ import "./chunk-IMP6FUCY.mjs";
5
5
  import "./chunk-FWCSY2DS.mjs";
6
6
  export {
7
7
  QdrantProvider
@@ -161,4 +161,4 @@ interface RagConfig {
161
161
  rag?: RAGConfig;
162
162
  }
163
163
 
164
- export type { ChatResponse as C, EmbeddingConfig as E, IngestDocument as I, LLMConfig as L, RAGConfig as R, UIConfig as U, VectorMatch as V, RagConfig as a, UpsertDocument as b, VectorDBConfig as c, VectorDBProvider as d, LLMProvider as e, EmbeddingProvider as f };
164
+ export type { ChatResponse as C, EmbeddingConfig as E, IngestDocument as I, LLMConfig as L, RAGConfig as R, UIConfig as U, VectorMatch as V, EmbeddingProvider as a, LLMProvider as b, RagConfig as c, UpsertDocument as d, VectorDBConfig as e, VectorDBProvider as f };
@@ -161,4 +161,4 @@ interface RagConfig {
161
161
  rag?: RAGConfig;
162
162
  }
163
163
 
164
- export type { ChatResponse as C, EmbeddingConfig as E, IngestDocument as I, LLMConfig as L, RAGConfig as R, UIConfig as U, VectorMatch as V, RagConfig as a, UpsertDocument as b, VectorDBConfig as c, VectorDBProvider as d, LLMProvider as e, EmbeddingProvider as f };
164
+ export type { ChatResponse as C, EmbeddingConfig as E, IngestDocument as I, LLMConfig as L, RAGConfig as R, UIConfig as U, VectorMatch as V, EmbeddingProvider as a, LLMProvider as b, RagConfig as c, UpsertDocument as d, VectorDBConfig as e, VectorDBProvider as f };
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  RedisProvider
3
- } from "./chunk-N2L5CFGM.mjs";
4
- import "./chunk-YVTGOFNV.mjs";
3
+ } from "./chunk-H6RKMU7W.mjs";
4
+ import "./chunk-IMP6FUCY.mjs";
5
5
  import "./chunk-FWCSY2DS.mjs";
6
6
  export {
7
7
  RedisProvider
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  UniversalVectorProvider
3
- } from "./chunk-R3GPRETL.mjs";
3
+ } from "./chunk-GQT5LF4G.mjs";
4
4
  import "./chunk-EDLTMSNY.mjs";
5
- import "./chunk-YVTGOFNV.mjs";
5
+ import "./chunk-IMP6FUCY.mjs";
6
6
  import "./chunk-FWCSY2DS.mjs";
7
7
  export {
8
8
  UniversalVectorProvider
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  WeaviateProvider
3
- } from "./chunk-7XL3QSQ7.mjs";
4
- import "./chunk-YVTGOFNV.mjs";
3
+ } from "./chunk-KTS3LLHY.mjs";
4
+ import "./chunk-IMP6FUCY.mjs";
5
5
  import "./chunk-FWCSY2DS.mjs";
6
6
  export {
7
7
  WeaviateProvider
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  BaseVectorProvider
3
- } from "./chunk-YVTGOFNV.mjs";
3
+ } from "./chunk-IMP6FUCY.mjs";
4
4
  import {
5
5
  __spreadValues
6
6
  } from "./chunk-FWCSY2DS.mjs";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  BaseVectorProvider
3
- } from "./chunk-YVTGOFNV.mjs";
3
+ } from "./chunk-IMP6FUCY.mjs";
4
4
  import {
5
5
  __spreadValues
6
6
  } from "./chunk-FWCSY2DS.mjs";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  BaseVectorProvider
3
- } from "./chunk-YVTGOFNV.mjs";
3
+ } from "./chunk-IMP6FUCY.mjs";
4
4
  import {
5
5
  __spreadValues
6
6
  } from "./chunk-FWCSY2DS.mjs";
@@ -85,6 +85,23 @@ var MongoDBProvider = class extends BaseVectorProvider {
85
85
  async deleteNamespace(namespace) {
86
86
  await this.collection.deleteMany({ namespace });
87
87
  }
88
+ /**
89
+ * MongoDB Atlas Vector Search requires specific filter syntax.
90
+ * Metadata fields must be prefixed with the metadata key (e.g. metadata.field).
91
+ */
92
+ sanitizeFilter(filter) {
93
+ if (!filter) return {};
94
+ const sanitized = super.sanitizeFilter(filter);
95
+ const mongoFilter = {};
96
+ for (const [key, value] of Object.entries(sanitized)) {
97
+ if (key === "namespace") {
98
+ mongoFilter[key] = value;
99
+ } else {
100
+ mongoFilter[`${this.metadataKey}.${key}`] = value;
101
+ }
102
+ }
103
+ return mongoFilter;
104
+ }
88
105
  async ping() {
89
106
  try {
90
107
  await this.db.command({ ping: 1 });
@@ -4,7 +4,7 @@ import {
4
4
  } from "./chunk-EDLTMSNY.mjs";
5
5
  import {
6
6
  BaseVectorProvider
7
- } from "./chunk-YVTGOFNV.mjs";
7
+ } from "./chunk-IMP6FUCY.mjs";
8
8
  import {
9
9
  __spreadValues
10
10
  } from "./chunk-FWCSY2DS.mjs";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  BaseVectorProvider
3
- } from "./chunk-YVTGOFNV.mjs";
3
+ } from "./chunk-IMP6FUCY.mjs";
4
4
  import {
5
5
  __spreadValues
6
6
  } from "./chunk-FWCSY2DS.mjs";
@@ -10,11 +10,18 @@ var BaseVectorProvider = class {
10
10
  */
11
11
  sanitizeFilter(filter) {
12
12
  if (!filter) return {};
13
- return Object.fromEntries(
14
- Object.entries(filter).filter(
15
- ([key]) => !key.startsWith("__") && key !== "queryText"
16
- )
17
- );
13
+ const result = {};
14
+ for (const [key, value] of Object.entries(filter)) {
15
+ if (key.startsWith("__") || key === "queryText" || key === "keywords") {
16
+ continue;
17
+ }
18
+ if (key === "metadata" && typeof value === "object" && value !== null) {
19
+ Object.assign(result, value);
20
+ } else {
21
+ result[key] = value;
22
+ }
23
+ }
24
+ return result;
18
25
  }
19
26
  };
20
27
 
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  BaseVectorProvider
3
- } from "./chunk-YVTGOFNV.mjs";
3
+ } from "./chunk-IMP6FUCY.mjs";
4
4
  import {
5
5
  __spreadValues
6
6
  } from "./chunk-FWCSY2DS.mjs";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  BaseVectorProvider
3
- } from "./chunk-YVTGOFNV.mjs";
3
+ } from "./chunk-IMP6FUCY.mjs";
4
4
 
5
5
  // src/providers/vectordb/PostgreSQLProvider.ts
6
6
  import { Pool } from "pg";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  BaseVectorProvider
3
- } from "./chunk-YVTGOFNV.mjs";
3
+ } from "./chunk-IMP6FUCY.mjs";
4
4
  import {
5
5
  __spreadValues
6
6
  } from "./chunk-FWCSY2DS.mjs";
@@ -1370,41 +1370,41 @@ var ProviderRegistry = class {
1370
1370
  }
1371
1371
  switch (provider) {
1372
1372
  case "pinecone": {
1373
- const { PineconeProvider } = await import("./PineconeProvider-QZTC7QAP.mjs");
1373
+ const { PineconeProvider } = await import("./PineconeProvider-BE2JWSPD.mjs");
1374
1374
  return new PineconeProvider(config);
1375
1375
  }
1376
1376
  case "pgvector":
1377
1377
  case "postgresql": {
1378
- const { PostgreSQLProvider } = await import("./PostgreSQLProvider-CNO72UP6.mjs");
1378
+ const { PostgreSQLProvider } = await import("./PostgreSQLProvider-5HHTK4SU.mjs");
1379
1379
  return new PostgreSQLProvider(config);
1380
1380
  }
1381
1381
  case "mongodb": {
1382
- const { MongoDBProvider } = await import("./MongoDBProvider-XS3QR47H.mjs");
1382
+ const { MongoDBProvider } = await import("./MongoDBProvider-6X5F5YZS.mjs");
1383
1383
  return new MongoDBProvider(config);
1384
1384
  }
1385
1385
  case "milvus": {
1386
- const { MilvusProvider } = await import("./MilvusProvider-MJQVHU4B.mjs");
1386
+ const { MilvusProvider } = await import("./MilvusProvider-WDVTFB7D.mjs");
1387
1387
  return new MilvusProvider(config);
1388
1388
  }
1389
1389
  case "qdrant": {
1390
- const { QdrantProvider } = await import("./QdrantProvider-6OBJKUIP.mjs");
1390
+ const { QdrantProvider } = await import("./QdrantProvider-XVDVBNIG.mjs");
1391
1391
  return new QdrantProvider(config);
1392
1392
  }
1393
1393
  case "chromadb": {
1394
- const { ChromaDBProvider } = await import("./ChromaDBProvider-6JWXHZAE.mjs");
1394
+ const { ChromaDBProvider } = await import("./ChromaDBProvider-GI7TB7GJ.mjs");
1395
1395
  return new ChromaDBProvider(config);
1396
1396
  }
1397
1397
  case "redis": {
1398
- const { RedisProvider } = await import("./RedisProvider-FF5BNQPB.mjs");
1398
+ const { RedisProvider } = await import("./RedisProvider-EK2R2PQH.mjs");
1399
1399
  return new RedisProvider(config);
1400
1400
  }
1401
1401
  case "weaviate": {
1402
- const { WeaviateProvider } = await import("./WeaviateProvider-DIYYBTEF.mjs");
1402
+ const { WeaviateProvider } = await import("./WeaviateProvider-4CAPQ7UY.mjs");
1403
1403
  return new WeaviateProvider(config);
1404
1404
  }
1405
1405
  case "universal_rest":
1406
1406
  case "rest": {
1407
- const { UniversalVectorProvider } = await import("./UniversalVectorProvider-CAVX5VSQ.mjs");
1407
+ const { UniversalVectorProvider } = await import("./UniversalVectorProvider-YIDRX6VT.mjs");
1408
1408
  return new UniversalVectorProvider(config);
1409
1409
  }
1410
1410
  default:
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  BaseVectorProvider
3
- } from "./chunk-YVTGOFNV.mjs";
3
+ } from "./chunk-IMP6FUCY.mjs";
4
4
  import {
5
5
  __spreadValues
6
6
  } from "./chunk-FWCSY2DS.mjs";
@@ -1,3 +1,3 @@
1
- import '../RagConfig-Bpp39-um.mjs';
2
- export { c as createChatHandler, a as createHealthHandler, b as createIngestHandler, d as createUploadHandler } from '../index-CZE72wnV.mjs';
1
+ import '../RagConfig-CVt24lbC.mjs';
2
+ export { c as createChatHandler, a as createHealthHandler, b as createIngestHandler, d as createUploadHandler } from '../index-OI2--lvT.mjs';
3
3
  import 'next/server';
@@ -1,3 +1,3 @@
1
- import '../RagConfig-Bpp39-um.js';
2
- export { c as createChatHandler, a as createHealthHandler, b as createIngestHandler, d as createUploadHandler } from '../index-DSaQwkKA.js';
1
+ import '../RagConfig-CVt24lbC.js';
2
+ export { c as createChatHandler, a as createHealthHandler, b as createIngestHandler, d as createUploadHandler } from '../index-D1hoNXMT.js';
3
3
  import 'next/server';
@@ -108,11 +108,18 @@ var init_BaseVectorProvider = __esm({
108
108
  */
109
109
  sanitizeFilter(filter) {
110
110
  if (!filter) return {};
111
- return Object.fromEntries(
112
- Object.entries(filter).filter(
113
- ([key]) => !key.startsWith("__") && key !== "queryText"
114
- )
115
- );
111
+ const result = {};
112
+ for (const [key, value] of Object.entries(filter)) {
113
+ if (key.startsWith("__") || key === "queryText" || key === "keywords") {
114
+ continue;
115
+ }
116
+ if (key === "metadata" && typeof value === "object" && value !== null) {
117
+ Object.assign(result, value);
118
+ } else {
119
+ result[key] = value;
120
+ }
121
+ }
122
+ return result;
116
123
  }
117
124
  };
118
125
  }
@@ -446,6 +453,23 @@ var init_MongoDBProvider = __esm({
446
453
  async deleteNamespace(namespace) {
447
454
  await this.collection.deleteMany({ namespace });
448
455
  }
456
+ /**
457
+ * MongoDB Atlas Vector Search requires specific filter syntax.
458
+ * Metadata fields must be prefixed with the metadata key (e.g. metadata.field).
459
+ */
460
+ sanitizeFilter(filter) {
461
+ if (!filter) return {};
462
+ const sanitized = super.sanitizeFilter(filter);
463
+ const mongoFilter = {};
464
+ for (const [key, value] of Object.entries(sanitized)) {
465
+ if (key === "namespace") {
466
+ mongoFilter[key] = value;
467
+ } else {
468
+ mongoFilter[`${this.metadataKey}.${key}`] = value;
469
+ }
470
+ }
471
+ return mongoFilter;
472
+ }
449
473
  async ping() {
450
474
  try {
451
475
  await this.db.command({ ping: 1 });
@@ -3,7 +3,7 @@ import {
3
3
  createHealthHandler,
4
4
  createIngestHandler,
5
5
  createUploadHandler
6
- } from "../chunk-TOKEXP3M.mjs";
6
+ } from "../chunk-TYZC74CO.mjs";
7
7
  import "../chunk-EDLTMSNY.mjs";
8
8
  import "../chunk-FWCSY2DS.mjs";
9
9
  export {
@@ -1,4 +1,4 @@
1
- import { c as VectorDBConfig, L as LLMConfig, E as EmbeddingConfig, a as RagConfig, C as ChatResponse } from './RagConfig-Bpp39-um.js';
1
+ import { e as VectorDBConfig, L as LLMConfig, E as EmbeddingConfig, c as RagConfig, C as ChatResponse } from './RagConfig-CVt24lbC.js';
2
2
  import { NextRequest, NextResponse } from 'next/server';
3
3
 
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { c as VectorDBConfig, L as LLMConfig, E as EmbeddingConfig, a as RagConfig, C as ChatResponse } from './RagConfig-Bpp39-um.mjs';
1
+ import { e as VectorDBConfig, L as LLMConfig, E as EmbeddingConfig, c as RagConfig, C as ChatResponse } from './RagConfig-CVt24lbC.mjs';
2
2
  import { NextRequest, NextResponse } from 'next/server';
3
3
 
4
4
  /**
package/dist/index.d.mts CHANGED
@@ -2,8 +2,8 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import React$1, { ReactNode } from 'react';
3
3
  import { C as ChatMessage } from './DocumentChunker-BICIjSuG.mjs';
4
4
  export { a as ChatOptions, b as Chunk, c as ChunkOptions, E as EmbedOptions, I as ILLMProvider } from './DocumentChunker-BICIjSuG.mjs';
5
- import { V as VectorMatch, U as UIConfig } from './RagConfig-Bpp39-um.mjs';
6
- export { C as ChatResponse, E as EmbeddingConfig, I as IngestDocument, L as LLMConfig, R as RAGConfig, a as RagConfig, b as UpsertDocument, c as VectorDBConfig } from './RagConfig-Bpp39-um.mjs';
5
+ import { V as VectorMatch, U as UIConfig } from './RagConfig-CVt24lbC.mjs';
6
+ export { C as ChatResponse, E as EmbeddingConfig, a as EmbeddingProvider, I as IngestDocument, L as LLMConfig, b as LLMProvider, R as RAGConfig, c as RagConfig, d as UpsertDocument, e as VectorDBConfig, f as VectorDBProvider } from './RagConfig-CVt24lbC.mjs';
7
7
 
8
8
  interface ChatWidgetProps {
9
9
  /** Position of the floating button. Defaults to bottom-right. */
package/dist/index.d.ts CHANGED
@@ -2,8 +2,8 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import React$1, { ReactNode } from 'react';
3
3
  import { C as ChatMessage } from './DocumentChunker-BICIjSuG.js';
4
4
  export { a as ChatOptions, b as Chunk, c as ChunkOptions, E as EmbedOptions, I as ILLMProvider } from './DocumentChunker-BICIjSuG.js';
5
- import { V as VectorMatch, U as UIConfig } from './RagConfig-Bpp39-um.js';
6
- export { C as ChatResponse, E as EmbeddingConfig, I as IngestDocument, L as LLMConfig, R as RAGConfig, a as RagConfig, b as UpsertDocument, c as VectorDBConfig } from './RagConfig-Bpp39-um.js';
5
+ import { V as VectorMatch, U as UIConfig } from './RagConfig-CVt24lbC.js';
6
+ export { C as ChatResponse, E as EmbeddingConfig, a as EmbeddingProvider, I as IngestDocument, L as LLMConfig, b as LLMProvider, R as RAGConfig, c as RagConfig, d as UpsertDocument, e as VectorDBConfig, f as VectorDBProvider } from './RagConfig-CVt24lbC.js';
7
7
 
8
8
  interface ChatWidgetProps {
9
9
  /** Position of the floating button. Defaults to bottom-right. */
package/dist/server.d.mts CHANGED
@@ -1,9 +1,9 @@
1
- import { a as RagConfig, C as ChatResponse, I as IngestDocument, c as VectorDBConfig, b as UpsertDocument, V as VectorMatch, L as LLMConfig, E as EmbeddingConfig, d as VectorDBProvider, e as LLMProvider, f as EmbeddingProvider } from './RagConfig-Bpp39-um.mjs';
2
- export { R as RAGConfig, U as UIConfig } from './RagConfig-Bpp39-um.mjs';
1
+ import { c as RagConfig, C as ChatResponse, I as IngestDocument, e as VectorDBConfig, d as UpsertDocument, V as VectorMatch, L as LLMConfig, E as EmbeddingConfig, f as VectorDBProvider, b as LLMProvider, a as EmbeddingProvider } from './RagConfig-CVt24lbC.mjs';
2
+ export { R as RAGConfig, U as UIConfig } from './RagConfig-CVt24lbC.mjs';
3
3
  import { C as ChatMessage, I as ILLMProvider, a as ChatOptions, E as EmbedOptions } from './DocumentChunker-BICIjSuG.mjs';
4
4
  export { b as Chunk, c as ChunkOptions, D as DocumentChunker } from './DocumentChunker-BICIjSuG.mjs';
5
- import { H as HealthCheckResult } from './index-CZE72wnV.mjs';
6
- export { P as ProviderHealthCheck, c as createChatHandler, a as createHealthHandler, b as createIngestHandler, d as createUploadHandler } from './index-CZE72wnV.mjs';
5
+ import { H as HealthCheckResult } from './index-OI2--lvT.mjs';
6
+ export { P as ProviderHealthCheck, c as createChatHandler, a as createHealthHandler, b as createIngestHandler, d as createUploadHandler } from './index-OI2--lvT.mjs';
7
7
  import 'next/server';
8
8
 
9
9
  /**
@@ -752,6 +752,11 @@ declare class MongoDBProvider extends BaseVectorProvider {
752
752
  query(vector: number[], topK: number, namespace?: string, filter?: Record<string, unknown>): Promise<VectorMatch[]>;
753
753
  delete(id: string | number, namespace?: string): Promise<void>;
754
754
  deleteNamespace(namespace: string): Promise<void>;
755
+ /**
756
+ * MongoDB Atlas Vector Search requires specific filter syntax.
757
+ * Metadata fields must be prefixed with the metadata key (e.g. metadata.field).
758
+ */
759
+ protected sanitizeFilter(filter?: Record<string, unknown>): Record<string, unknown>;
755
760
  ping(): Promise<boolean>;
756
761
  disconnect(): Promise<void>;
757
762
  }
package/dist/server.d.ts CHANGED
@@ -1,9 +1,9 @@
1
- import { a as RagConfig, C as ChatResponse, I as IngestDocument, c as VectorDBConfig, b as UpsertDocument, V as VectorMatch, L as LLMConfig, E as EmbeddingConfig, d as VectorDBProvider, e as LLMProvider, f as EmbeddingProvider } from './RagConfig-Bpp39-um.js';
2
- export { R as RAGConfig, U as UIConfig } from './RagConfig-Bpp39-um.js';
1
+ import { c as RagConfig, C as ChatResponse, I as IngestDocument, e as VectorDBConfig, d as UpsertDocument, V as VectorMatch, L as LLMConfig, E as EmbeddingConfig, f as VectorDBProvider, b as LLMProvider, a as EmbeddingProvider } from './RagConfig-CVt24lbC.js';
2
+ export { R as RAGConfig, U as UIConfig } from './RagConfig-CVt24lbC.js';
3
3
  import { C as ChatMessage, I as ILLMProvider, a as ChatOptions, E as EmbedOptions } from './DocumentChunker-BICIjSuG.js';
4
4
  export { b as Chunk, c as ChunkOptions, D as DocumentChunker } from './DocumentChunker-BICIjSuG.js';
5
- import { H as HealthCheckResult } from './index-DSaQwkKA.js';
6
- export { P as ProviderHealthCheck, c as createChatHandler, a as createHealthHandler, b as createIngestHandler, d as createUploadHandler } from './index-DSaQwkKA.js';
5
+ import { H as HealthCheckResult } from './index-D1hoNXMT.js';
6
+ export { P as ProviderHealthCheck, c as createChatHandler, a as createHealthHandler, b as createIngestHandler, d as createUploadHandler } from './index-D1hoNXMT.js';
7
7
  import 'next/server';
8
8
 
9
9
  /**
@@ -752,6 +752,11 @@ declare class MongoDBProvider extends BaseVectorProvider {
752
752
  query(vector: number[], topK: number, namespace?: string, filter?: Record<string, unknown>): Promise<VectorMatch[]>;
753
753
  delete(id: string | number, namespace?: string): Promise<void>;
754
754
  deleteNamespace(namespace: string): Promise<void>;
755
+ /**
756
+ * MongoDB Atlas Vector Search requires specific filter syntax.
757
+ * Metadata fields must be prefixed with the metadata key (e.g. metadata.field).
758
+ */
759
+ protected sanitizeFilter(filter?: Record<string, unknown>): Record<string, unknown>;
755
760
  ping(): Promise<boolean>;
756
761
  disconnect(): Promise<void>;
757
762
  }
package/dist/server.js CHANGED
@@ -120,11 +120,18 @@ var init_BaseVectorProvider = __esm({
120
120
  */
121
121
  sanitizeFilter(filter) {
122
122
  if (!filter) return {};
123
- return Object.fromEntries(
124
- Object.entries(filter).filter(
125
- ([key]) => !key.startsWith("__") && key !== "queryText"
126
- )
127
- );
123
+ const result = {};
124
+ for (const [key, value] of Object.entries(filter)) {
125
+ if (key.startsWith("__") || key === "queryText" || key === "keywords") {
126
+ continue;
127
+ }
128
+ if (key === "metadata" && typeof value === "object" && value !== null) {
129
+ Object.assign(result, value);
130
+ } else {
131
+ result[key] = value;
132
+ }
133
+ }
134
+ return result;
128
135
  }
129
136
  };
130
137
  }
@@ -458,6 +465,23 @@ var init_MongoDBProvider = __esm({
458
465
  async deleteNamespace(namespace) {
459
466
  await this.collection.deleteMany({ namespace });
460
467
  }
468
+ /**
469
+ * MongoDB Atlas Vector Search requires specific filter syntax.
470
+ * Metadata fields must be prefixed with the metadata key (e.g. metadata.field).
471
+ */
472
+ sanitizeFilter(filter) {
473
+ if (!filter) return {};
474
+ const sanitized = super.sanitizeFilter(filter);
475
+ const mongoFilter = {};
476
+ for (const [key, value] of Object.entries(sanitized)) {
477
+ if (key === "namespace") {
478
+ mongoFilter[key] = value;
479
+ } else {
480
+ mongoFilter[`${this.metadataKey}.${key}`] = value;
481
+ }
482
+ }
483
+ return mongoFilter;
484
+ }
461
485
  async ping() {
462
486
  try {
463
487
  await this.db.command({ ping: 1 });
package/dist/server.mjs CHANGED
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  ChromaDBProvider
3
- } from "./chunk-Q2QDQ5SQ.mjs";
3
+ } from "./chunk-RK2UDJA2.mjs";
4
4
  import {
5
5
  RedisProvider
6
- } from "./chunk-N2L5CFGM.mjs";
6
+ } from "./chunk-H6RKMU7W.mjs";
7
7
  import {
8
8
  WeaviateProvider
9
- } from "./chunk-7XL3QSQ7.mjs";
9
+ } from "./chunk-KTS3LLHY.mjs";
10
10
  import {
11
11
  UniversalVectorProvider
12
- } from "./chunk-R3GPRETL.mjs";
12
+ } from "./chunk-GQT5LF4G.mjs";
13
13
  import {
14
14
  AnthropicProvider,
15
15
  BatchProcessor,
@@ -34,26 +34,26 @@ import {
34
34
  createIngestHandler,
35
35
  createUploadHandler,
36
36
  getRagConfig
37
- } from "./chunk-TOKEXP3M.mjs";
37
+ } from "./chunk-TYZC74CO.mjs";
38
38
  import "./chunk-EDLTMSNY.mjs";
39
39
  import {
40
40
  PineconeProvider
41
- } from "./chunk-M3AZTD7F.mjs";
41
+ } from "./chunk-XCNXPECE.mjs";
42
42
  import {
43
43
  PostgreSQLProvider
44
- } from "./chunk-L54WODRW.mjs";
44
+ } from "./chunk-LJWWPTWE.mjs";
45
45
  import {
46
46
  MongoDBProvider
47
- } from "./chunk-KGW2YHV2.mjs";
47
+ } from "./chunk-DESUAKF3.mjs";
48
48
  import {
49
49
  MilvusProvider
50
- } from "./chunk-ENEUABSO.mjs";
50
+ } from "./chunk-3QWAK3RZ.mjs";
51
51
  import {
52
52
  QdrantProvider
53
- } from "./chunk-ULX4EF74.mjs";
53
+ } from "./chunk-5KNBWQM6.mjs";
54
54
  import {
55
55
  BaseVectorProvider
56
- } from "./chunk-YVTGOFNV.mjs";
56
+ } from "./chunk-IMP6FUCY.mjs";
57
57
  import {
58
58
  __objRest,
59
59
  __spreadProps,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@retrivora-ai/rag-engine",
3
- "version": "0.3.5",
3
+ "version": "0.3.7",
4
4
  "description": "Retrivora AI is a plug-and-play AI engine for RAG chat experiences — generic vector DB + LLM provider, embeddable or standalone.",
5
5
  "author": "Abhinav Alkuchi",
6
6
  "license": "MIT",
package/src/index.ts CHANGED
@@ -14,7 +14,7 @@ export { ConfigProvider, useConfig } from './components/ConfigProvider';
14
14
  export { useRagChat } from './hooks/useRagChat';
15
15
 
16
16
  // ── Types (Interfaces/Types only, no Node.js deps) ─────────────
17
- export type { RagConfig, VectorDBConfig, LLMConfig, EmbeddingConfig, UIConfig, RAGConfig } from './config/RagConfig';
17
+ export type { RagConfig, VectorDBConfig, VectorDBProvider, LLMConfig, LLMProvider, EmbeddingConfig, EmbeddingProvider, UIConfig, RAGConfig } from './config/RagConfig';
18
18
  export type { VectorMatch, UpsertDocument } from './types';
19
19
  export type { ILLMProvider, ChatMessage, ChatOptions, EmbedOptions } from './llm/ILLMProvider';
20
20
  export type { IngestDocument, ChatResponse } from './types';
@@ -65,10 +65,22 @@ export abstract class BaseVectorProvider {
65
65
  */
66
66
  protected sanitizeFilter(filter?: Record<string, unknown>): Record<string, unknown> {
67
67
  if (!filter) return {};
68
- return Object.fromEntries(
69
- Object.entries(filter).filter(
70
- ([key]) => !key.startsWith('__') && key !== 'queryText'
71
- )
72
- );
68
+
69
+ const result: Record<string, unknown> = {};
70
+
71
+ for (const [key, value] of Object.entries(filter)) {
72
+ if (key.startsWith('__') || key === 'queryText' || key === 'keywords') {
73
+ continue;
74
+ }
75
+
76
+ if (key === 'metadata' && typeof value === 'object' && value !== null) {
77
+ // Merge metadata fields into the root for providers that expect flat filters
78
+ Object.assign(result, value);
79
+ } else {
80
+ result[key] = value;
81
+ }
82
+ }
83
+
84
+ return result;
73
85
  }
74
86
  }
@@ -106,6 +106,27 @@ export class MongoDBProvider extends BaseVectorProvider {
106
106
  await this.collection!.deleteMany({ namespace });
107
107
  }
108
108
 
109
+ /**
110
+ * MongoDB Atlas Vector Search requires specific filter syntax.
111
+ * Metadata fields must be prefixed with the metadata key (e.g. metadata.field).
112
+ */
113
+ protected override sanitizeFilter(filter?: Record<string, unknown>): Record<string, unknown> {
114
+ if (!filter) return {};
115
+ const sanitized = super.sanitizeFilter(filter);
116
+ const mongoFilter: Record<string, unknown> = {};
117
+
118
+ for (const [key, value] of Object.entries(sanitized)) {
119
+ // If the key is already a metadata field or special key, keep it (e.g. namespace)
120
+ if (key === 'namespace') {
121
+ mongoFilter[key] = value;
122
+ } else {
123
+ // Assume all other non-prefixed fields are metadata fields
124
+ mongoFilter[`${this.metadataKey}.${key}`] = value;
125
+ }
126
+ }
127
+ return mongoFilter;
128
+ }
129
+
109
130
  async ping(): Promise<boolean> {
110
131
  try {
111
132
  await this.db!.command({ ping: 1 });