@retrivora-ai/rag-engine 1.9.6 → 1.9.8
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/README.md +130 -113
- package/dist/{ILLMProvider-DNhyOYoK.d.mts → ILLMProvider-B8ROITYK.d.mts} +59 -8
- package/dist/{ILLMProvider-DNhyOYoK.d.ts → ILLMProvider-B8ROITYK.d.ts} +59 -8
- package/dist/handlers/index.d.mts +2 -2
- package/dist/handlers/index.d.ts +2 -2
- package/dist/handlers/index.js +2376 -489
- package/dist/handlers/index.mjs +2372 -489
- package/dist/{index-CjQdL0cX.d.ts → index-B8PbEFSY.d.mts} +17 -3
- package/dist/{index-CHL1jdYm.d.mts → index-BCPKUAVL.d.ts} +33 -41
- package/dist/{index-Hgbwl9X4.d.ts → index-CrxCy36A.d.mts} +33 -41
- package/dist/{index-C9v7-tWd.d.mts → index-DNvoi-sV.d.ts} +17 -3
- package/dist/index.css +695 -203
- package/dist/index.d.mts +37 -7
- package/dist/index.d.ts +37 -7
- package/dist/index.js +1197 -286
- package/dist/index.mjs +1221 -297
- package/dist/server.d.mts +62 -6
- package/dist/server.d.ts +62 -6
- package/dist/server.js +2526 -574
- package/dist/server.mjs +2517 -573
- package/package.json +12 -10
- package/src/app/constants.tsx +207 -212
- package/src/app/layout.tsx +4 -28
- package/src/app/types.ts +17 -17
- package/src/components/AmbientBackground.tsx +10 -10
- package/src/components/ArchitectureCard.tsx +43 -7
- package/src/components/ArchitectureCardsSection.tsx +37 -4
- package/src/components/ChatWidget.tsx +4 -1
- package/src/components/ChatWindow.tsx +9 -2
- package/src/components/CodeViewer.tsx +19 -14
- package/src/components/DocViewer.tsx +75 -15
- package/src/components/Documentation.tsx +111 -28
- package/src/components/Hero.tsx +103 -20
- package/src/components/Lifecycle.tsx +65 -25
- package/src/components/MarkdownComponents.tsx +44 -1
- package/src/components/MessageBubble.tsx +162 -50
- package/src/components/constants.tsx +279 -0
- package/src/config/RagConfig.ts +56 -10
- package/src/config/constants.ts +5 -0
- package/src/config/serverConfig.ts +15 -0
- package/src/core/ConfigResolver.ts +30 -25
- package/src/core/DatabaseStorage.ts +469 -0
- package/src/core/LicenseVerifier.ts +154 -0
- package/src/core/MultiAgentCoordinator.ts +239 -0
- package/src/core/Pipeline.ts +148 -16
- package/src/core/ProviderRegistry.ts +5 -5
- package/src/core/Retrivora.ts +52 -6
- package/src/core/VectorPlugin.ts +74 -11
- package/src/core/mcp.ts +261 -0
- package/src/exceptions/index.ts +52 -0
- package/src/handlers/index.ts +504 -47
- package/src/hooks/useRagChat.ts +100 -43
- package/src/hooks/useStoredMessages.ts +15 -4
- package/src/index.ts +7 -0
- package/src/llm/LLMFactory.ts +15 -6
- package/src/llm/providers/GroqProvider.ts +176 -0
- package/src/llm/providers/QwenProvider.ts +191 -0
- package/src/server.ts +23 -13
- package/src/types/chat.ts +16 -0
- package/src/types/props.ts +50 -1
- package/.env.example +0 -80
- package/LICENSE.txt +0 -21
package/src/config/RagConfig.ts
CHANGED
|
@@ -157,6 +157,19 @@ export interface UIConfig {
|
|
|
157
157
|
// RAG Pipeline Tuning
|
|
158
158
|
// ---------------------------------------------------------------------------
|
|
159
159
|
|
|
160
|
+
export interface CAGConfig {
|
|
161
|
+
/** Enable Cold RAG (Cache Augmented Generation) */
|
|
162
|
+
enabled?: boolean;
|
|
163
|
+
/** Namespace containing the cold data (e.g., static manuals/guides) */
|
|
164
|
+
coldNamespace?: string;
|
|
165
|
+
/** Limit of cold documents to retrieve at initialization and keep in cache/context */
|
|
166
|
+
coldLimit?: number;
|
|
167
|
+
/** Specific search query to retrieve the cold documents (e.g., "manual", "documentation") */
|
|
168
|
+
coldQuery?: string;
|
|
169
|
+
/** Specific document IDs to load as cold context */
|
|
170
|
+
coldDocumentIds?: string[];
|
|
171
|
+
}
|
|
172
|
+
|
|
160
173
|
export interface RAGConfig {
|
|
161
174
|
/** Number of top-K chunks retrieved per query */
|
|
162
175
|
topK?: number;
|
|
@@ -197,21 +210,33 @@ export interface RAGConfig {
|
|
|
197
210
|
* Defaults to built-in list (find, search, tell me about, etc.).
|
|
198
211
|
*/
|
|
199
212
|
vectorKeywords?: string[];
|
|
213
|
+
/** Cold RAG (Cache Augmented Generation) configuration */
|
|
214
|
+
cag?: CAGConfig;
|
|
215
|
+
/** Chat history configuration */
|
|
216
|
+
history?: {
|
|
217
|
+
enabled?: boolean;
|
|
218
|
+
tableName?: string;
|
|
219
|
+
};
|
|
220
|
+
/** User feedback configuration */
|
|
221
|
+
feedback?: {
|
|
222
|
+
enabled?: boolean;
|
|
223
|
+
tableName?: string;
|
|
224
|
+
};
|
|
200
225
|
}
|
|
201
226
|
|
|
202
227
|
export interface RetrievalConfig {
|
|
203
228
|
/** Retrieval strategy selected by the host app. */
|
|
204
229
|
strategy?:
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
230
|
+
| 'vector'
|
|
231
|
+
| 'keyword'
|
|
232
|
+
| 'hybrid'
|
|
233
|
+
| 'multi-query'
|
|
234
|
+
| 'self-query'
|
|
235
|
+
| 'parent-document'
|
|
236
|
+
| 'contextual-compression'
|
|
237
|
+
| 'ensemble'
|
|
238
|
+
| 'recursive'
|
|
239
|
+
| 'agentic';
|
|
215
240
|
/** Number of documents/chunks retrieved per query. */
|
|
216
241
|
topK?: number;
|
|
217
242
|
/** Minimum similarity score to include a retrieved chunk. */
|
|
@@ -229,11 +254,23 @@ export interface WorkflowConfig {
|
|
|
229
254
|
options?: Record<string, unknown>;
|
|
230
255
|
}
|
|
231
256
|
|
|
257
|
+
export interface MCPServerConfig {
|
|
258
|
+
name: string;
|
|
259
|
+
transport: 'stdio' | 'sse';
|
|
260
|
+
url?: string; // Required for SSE transport
|
|
261
|
+
command?: string; // Required for Stdio transport
|
|
262
|
+
args?: string[]; // Optional for Stdio transport
|
|
263
|
+
env?: Record<string, string>; // Optional env variables for Stdio child process
|
|
264
|
+
}
|
|
265
|
+
|
|
232
266
|
// ---------------------------------------------------------------------------
|
|
233
267
|
// Root Config
|
|
234
268
|
// ---------------------------------------------------------------------------
|
|
235
269
|
|
|
236
270
|
export interface RagConfig {
|
|
271
|
+
/** License key for commercial production validation */
|
|
272
|
+
licenseKey?: string;
|
|
273
|
+
|
|
237
274
|
/**
|
|
238
275
|
* Unique identifier for the consuming project.
|
|
239
276
|
* Used as the vector DB namespace to achieve multi-tenancy.
|
|
@@ -257,6 +294,15 @@ export interface RagConfig {
|
|
|
257
294
|
|
|
258
295
|
/** Optional Graph database configuration */
|
|
259
296
|
graphDb?: GraphDBConfig;
|
|
297
|
+
|
|
298
|
+
/** Optional Telemetry configuration for observability logging */
|
|
299
|
+
telemetry?: {
|
|
300
|
+
enabled?: boolean;
|
|
301
|
+
url?: string;
|
|
302
|
+
};
|
|
303
|
+
|
|
304
|
+
/** Optional Model Context Protocol (MCP) server configurations */
|
|
305
|
+
mcpServers?: MCPServerConfig[];
|
|
260
306
|
}
|
|
261
307
|
|
|
262
308
|
/**
|
package/src/config/constants.ts
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
* This file serves as the single source of truth for all statically supported
|
|
5
5
|
* providers and stylistic options in the Retrivora AI RAG Engine.
|
|
6
6
|
*/
|
|
7
|
+
export const VERSION = '1.9.6';
|
|
7
8
|
|
|
8
9
|
export const VECTOR_DB_PROVIDERS = [
|
|
9
10
|
'pinecone',
|
|
@@ -25,6 +26,8 @@ export const LLM_PROVIDERS = [
|
|
|
25
26
|
'anthropic',
|
|
26
27
|
'ollama',
|
|
27
28
|
'gemini',
|
|
29
|
+
'groq',
|
|
30
|
+
'qwen',
|
|
28
31
|
'rest',
|
|
29
32
|
'universal_rest',
|
|
30
33
|
'custom',
|
|
@@ -34,6 +37,7 @@ export const EMBEDDING_PROVIDERS = [
|
|
|
34
37
|
'openai',
|
|
35
38
|
'ollama',
|
|
36
39
|
'gemini',
|
|
40
|
+
'qwen',
|
|
37
41
|
'rest',
|
|
38
42
|
'universal_rest',
|
|
39
43
|
'custom',
|
|
@@ -50,6 +54,7 @@ export const PROVIDERS_WITH_EMBEDDINGS = [
|
|
|
50
54
|
'openai',
|
|
51
55
|
'ollama',
|
|
52
56
|
'gemini',
|
|
57
|
+
'qwen',
|
|
53
58
|
'rest',
|
|
54
59
|
'universal_rest',
|
|
55
60
|
] as const;
|
|
@@ -149,6 +149,7 @@ export function getEnvConfig(env: Record<string, string | undefined> = process.e
|
|
|
149
149
|
|
|
150
150
|
return {
|
|
151
151
|
projectId,
|
|
152
|
+
licenseKey: readString(env, 'RETRIVORA_LICENSE_KEY') ?? readString(env, 'LICENSE_KEY') ?? base?.licenseKey,
|
|
152
153
|
vectorDb: {
|
|
153
154
|
provider: vectorProvider,
|
|
154
155
|
indexName:
|
|
@@ -217,6 +218,10 @@ export function getEnvConfig(env: Record<string, string | undefined> = process.e
|
|
|
217
218
|
try { return JSON.parse(raw) as Record<string, string>; } catch { return undefined; }
|
|
218
219
|
})(),
|
|
219
220
|
},
|
|
221
|
+
telemetry: {
|
|
222
|
+
enabled: readString(env, 'TELEMETRY_ENABLED') === 'true' || readString(env, 'NEXT_PUBLIC_TELEMETRY_ENABLED') === 'true' || base?.telemetry?.enabled || false,
|
|
223
|
+
url: readString(env, 'TELEMETRY_URL') ?? readString(env, 'NEXT_PUBLIC_TELEMETRY_URL') ?? base?.telemetry?.url ?? '/api/telemetry',
|
|
224
|
+
},
|
|
220
225
|
// Optional graph DB — driven by GRAPH_DB_PROVIDER env var
|
|
221
226
|
...(readString(env, 'GRAPH_DB_PROVIDER') ? {
|
|
222
227
|
graphDb: {
|
|
@@ -228,5 +233,15 @@ export function getEnvConfig(env: Record<string, string | undefined> = process.e
|
|
|
228
233
|
},
|
|
229
234
|
},
|
|
230
235
|
} : {}),
|
|
236
|
+
mcpServers: (() => {
|
|
237
|
+
const raw = readString(env, 'MCP_SERVERS') ?? readString(env, 'NEXT_PUBLIC_MCP_SERVERS');
|
|
238
|
+
if (!raw) return undefined;
|
|
239
|
+
try {
|
|
240
|
+
return JSON.parse(raw);
|
|
241
|
+
} catch (e) {
|
|
242
|
+
console.warn('[serverConfig] Failed to parse MCP_SERVERS env:', e);
|
|
243
|
+
return undefined;
|
|
244
|
+
}
|
|
245
|
+
})(),
|
|
231
246
|
};
|
|
232
247
|
}
|
|
@@ -9,7 +9,6 @@
|
|
|
9
9
|
import { RagConfig, UniversalRagConfig, RAGConfig, RetrievalConfig, WorkflowConfig } from '../config/RagConfig';
|
|
10
10
|
import { mergeDefined } from '../utils/templateUtils';
|
|
11
11
|
import { getEnvConfig } from '../config/serverConfig';
|
|
12
|
-
import { ConfigurationException } from '../exceptions';
|
|
13
12
|
|
|
14
13
|
|
|
15
14
|
|
|
@@ -32,36 +31,42 @@ export class ConfigResolver {
|
|
|
32
31
|
projectId: hostConfig.projectId || envConfig.projectId,
|
|
33
32
|
vectorDb: hostConfig.vectorDb
|
|
34
33
|
? {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
34
|
+
...envConfig.vectorDb,
|
|
35
|
+
...hostConfig.vectorDb,
|
|
36
|
+
options: {
|
|
37
|
+
...envConfig.vectorDb.options,
|
|
38
|
+
...(hostConfig.vectorDb.options || {}),
|
|
39
|
+
},
|
|
40
|
+
}
|
|
42
41
|
: envConfig.vectorDb,
|
|
43
42
|
llm: hostConfig.llm
|
|
44
43
|
? {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
44
|
+
...envConfig.llm,
|
|
45
|
+
...hostConfig.llm,
|
|
46
|
+
options: {
|
|
47
|
+
...(envConfig.llm.options || {}),
|
|
48
|
+
...(hostConfig.llm.options || {}),
|
|
49
|
+
},
|
|
50
|
+
}
|
|
52
51
|
: envConfig.llm,
|
|
53
52
|
embedding: hostConfig.embedding
|
|
54
53
|
? {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
54
|
+
...envConfig.embedding,
|
|
55
|
+
...hostConfig.embedding,
|
|
56
|
+
options: {
|
|
57
|
+
...(envConfig.embedding.options || {}),
|
|
58
|
+
...(hostConfig.embedding.options || {}),
|
|
59
|
+
},
|
|
60
|
+
}
|
|
62
61
|
: envConfig.embedding,
|
|
63
62
|
ui: hostConfig.ui ? mergeDefined(envConfig.ui, hostConfig.ui) : envConfig.ui,
|
|
64
63
|
rag: hostConfig.rag ? { ...envConfig.rag, ...hostConfig.rag } : envConfig.rag,
|
|
64
|
+
telemetry: hostConfig.telemetry
|
|
65
|
+
? {
|
|
66
|
+
...envConfig.telemetry,
|
|
67
|
+
...hostConfig.telemetry,
|
|
68
|
+
}
|
|
69
|
+
: envConfig.telemetry,
|
|
65
70
|
};
|
|
66
71
|
}
|
|
67
72
|
|
|
@@ -87,13 +92,13 @@ export class ConfigResolver {
|
|
|
87
92
|
*/
|
|
88
93
|
static validate(config: RagConfig): void {
|
|
89
94
|
if (!config.projectId) {
|
|
90
|
-
throw new
|
|
95
|
+
throw new Error('[ConfigResolver] projectId is required');
|
|
91
96
|
}
|
|
92
97
|
if (!config.vectorDb.provider) {
|
|
93
|
-
throw new
|
|
98
|
+
throw new Error('[ConfigResolver] vectorDb.provider is required');
|
|
94
99
|
}
|
|
95
100
|
if (!config.llm.provider) {
|
|
96
|
-
throw new
|
|
101
|
+
throw new Error('[ConfigResolver] llm.provider is required');
|
|
97
102
|
}
|
|
98
103
|
}
|
|
99
104
|
|