@retrivora-ai/rag-engine 0.3.6 → 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.
- package/dist/{MongoDBProvider-NWAOHQAY.mjs → MongoDBProvider-6X5F5YZS.mjs} +1 -1
- package/dist/{RagConfig-Bpp39-um.d.mts → RagConfig-CVt24lbC.d.mts} +1 -1
- package/dist/{RagConfig-Bpp39-um.d.ts → RagConfig-CVt24lbC.d.ts} +1 -1
- package/dist/{chunk-2L2NC64R.mjs → chunk-DESUAKF3.mjs} +17 -0
- package/dist/{chunk-BJGFKDYF.mjs → chunk-TYZC74CO.mjs} +1 -1
- package/dist/handlers/index.d.mts +2 -2
- package/dist/handlers/index.d.ts +2 -2
- package/dist/handlers/index.js +17 -0
- package/dist/handlers/index.mjs +1 -1
- package/dist/{index-DSaQwkKA.d.ts → index-D1hoNXMT.d.ts} +1 -1
- package/dist/{index-CZE72wnV.d.mts → index-OI2--lvT.d.mts} +1 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/server.d.mts +9 -4
- package/dist/server.d.ts +9 -4
- package/dist/server.js +17 -0
- package/dist/server.mjs +2 -2
- package/package.json +1 -1
- package/src/index.ts +1 -1
- package/src/providers/vectordb/MongoDBProvider.ts +21 -0
|
@@ -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,
|
|
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,
|
|
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 };
|
|
@@ -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 });
|
|
@@ -1379,7 +1379,7 @@ var ProviderRegistry = class {
|
|
|
1379
1379
|
return new PostgreSQLProvider(config);
|
|
1380
1380
|
}
|
|
1381
1381
|
case "mongodb": {
|
|
1382
|
-
const { MongoDBProvider } = await import("./MongoDBProvider-
|
|
1382
|
+
const { MongoDBProvider } = await import("./MongoDBProvider-6X5F5YZS.mjs");
|
|
1383
1383
|
return new MongoDBProvider(config);
|
|
1384
1384
|
}
|
|
1385
1385
|
case "milvus": {
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import '../RagConfig-
|
|
2
|
-
export { c as createChatHandler, a as createHealthHandler, b as createIngestHandler, d as createUploadHandler } from '../index-
|
|
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';
|
package/dist/handlers/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import '../RagConfig-
|
|
2
|
-
export { c as createChatHandler, a as createHealthHandler, b as createIngestHandler, d as createUploadHandler } from '../index-
|
|
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';
|
package/dist/handlers/index.js
CHANGED
|
@@ -453,6 +453,23 @@ var init_MongoDBProvider = __esm({
|
|
|
453
453
|
async deleteNamespace(namespace) {
|
|
454
454
|
await this.collection.deleteMany({ namespace });
|
|
455
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
|
+
}
|
|
456
473
|
async ping() {
|
|
457
474
|
try {
|
|
458
475
|
await this.db.command({ ping: 1 });
|
package/dist/handlers/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
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 {
|
|
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-
|
|
6
|
-
export { C as ChatResponse, E as EmbeddingConfig, I as IngestDocument, L as LLMConfig, R as RAGConfig,
|
|
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-
|
|
6
|
-
export { C as ChatResponse, E as EmbeddingConfig, I as IngestDocument, L as LLMConfig, R as RAGConfig,
|
|
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 {
|
|
2
|
-
export { R as RAGConfig, U as UIConfig } from './RagConfig-
|
|
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-
|
|
6
|
-
export { P as ProviderHealthCheck, c as createChatHandler, a as createHealthHandler, b as createIngestHandler, d as createUploadHandler } from './index-
|
|
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 {
|
|
2
|
-
export { R as RAGConfig, U as UIConfig } from './RagConfig-
|
|
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-
|
|
6
|
-
export { P as ProviderHealthCheck, c as createChatHandler, a as createHealthHandler, b as createIngestHandler, d as createUploadHandler } from './index-
|
|
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
|
@@ -465,6 +465,23 @@ var init_MongoDBProvider = __esm({
|
|
|
465
465
|
async deleteNamespace(namespace) {
|
|
466
466
|
await this.collection.deleteMany({ namespace });
|
|
467
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
|
+
}
|
|
468
485
|
async ping() {
|
|
469
486
|
try {
|
|
470
487
|
await this.db.command({ ping: 1 });
|
package/dist/server.mjs
CHANGED
|
@@ -34,7 +34,7 @@ import {
|
|
|
34
34
|
createIngestHandler,
|
|
35
35
|
createUploadHandler,
|
|
36
36
|
getRagConfig
|
|
37
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-TYZC74CO.mjs";
|
|
38
38
|
import "./chunk-EDLTMSNY.mjs";
|
|
39
39
|
import {
|
|
40
40
|
PineconeProvider
|
|
@@ -44,7 +44,7 @@ import {
|
|
|
44
44
|
} from "./chunk-LJWWPTWE.mjs";
|
|
45
45
|
import {
|
|
46
46
|
MongoDBProvider
|
|
47
|
-
} from "./chunk-
|
|
47
|
+
} from "./chunk-DESUAKF3.mjs";
|
|
48
48
|
import {
|
|
49
49
|
MilvusProvider
|
|
50
50
|
} from "./chunk-3QWAK3RZ.mjs";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@retrivora-ai/rag-engine",
|
|
3
|
-
"version": "0.3.
|
|
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';
|
|
@@ -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 });
|