@retrivora-ai/rag-engine 2.4.3 → 2.4.5

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 (139) hide show
  1. package/dist/{BatchProcessor-zbQMaZHm.d.mts → BatchProcessor-Csy_K1qQ.d.mts} +2 -0
  2. package/dist/{BatchProcessor-D42E706a.d.ts → BatchProcessor-Dg18zZGk.d.ts} +2 -0
  3. package/dist/handlers/index.js +27 -4
  4. package/dist/handlers/index.mjs +27 -4
  5. package/dist/index.d.mts +3 -3
  6. package/dist/index.d.ts +3 -3
  7. package/dist/index.js +12 -10
  8. package/dist/index.mjs +12 -10
  9. package/dist/server.d.mts +2 -2
  10. package/dist/server.d.ts +2 -2
  11. package/dist/server.js +28 -4
  12. package/dist/server.mjs +28 -4
  13. package/package.json +1 -3
  14. package/src/LicensedRetrivora.ts +0 -278
  15. package/src/app/api/chat/route.ts +0 -4
  16. package/src/app/api/health/route.ts +0 -5
  17. package/src/app/api/ingest/route.ts +0 -27
  18. package/src/app/api/suggestions/route.ts +0 -5
  19. package/src/app/api/upload/route.ts +0 -5
  20. package/src/app/constants.tsx +0 -270
  21. package/src/app/favicon.ico +0 -0
  22. package/src/app/globals.css +0 -449
  23. package/src/app/layout.tsx +0 -22
  24. package/src/app/page.tsx +0 -64
  25. package/src/app/types.ts +0 -30
  26. package/src/browser.tsx +0 -127
  27. package/src/components/ChatWidget.tsx +0 -393
  28. package/src/components/ChatWindow.tsx +0 -952
  29. package/src/components/CodeViewer.tsx +0 -56
  30. package/src/components/ConfigProvider.tsx +0 -141
  31. package/src/components/DocumentUpload.tsx +0 -354
  32. package/src/components/DynamicChart.tsx +0 -297
  33. package/src/components/HourglassLoader.tsx +0 -87
  34. package/src/components/MarkdownComponents.tsx +0 -186
  35. package/src/components/MessageBubble.tsx +0 -498
  36. package/src/components/ObservabilityPanel.tsx +0 -374
  37. package/src/components/ProductCard.tsx +0 -107
  38. package/src/components/ProductCarousel.tsx +0 -97
  39. package/src/components/SourceCard.tsx +0 -61
  40. package/src/components/ThemeProvider.tsx +0 -8
  41. package/src/components/ThemeToggle.tsx +0 -29
  42. package/src/components/ThinkingBlock.tsx +0 -75
  43. package/src/components/UIDispatcher.tsx +0 -342
  44. package/src/components/VisualizationRenderer.tsx +0 -621
  45. package/src/components/constants.tsx +0 -503
  46. package/src/config/ConfigBuilder.ts +0 -285
  47. package/src/config/EmbeddingStrategy.ts +0 -148
  48. package/src/config/LicenseConfigResolver.ts +0 -298
  49. package/src/config/RagConfig.ts +0 -328
  50. package/src/config/UniversalProfiles.ts +0 -82
  51. package/src/config/constants.ts +0 -64
  52. package/src/config/serverConfig.ts +0 -378
  53. package/src/config/uiConstants.ts +0 -47
  54. package/src/core/BatchProcessor.ts +0 -385
  55. package/src/core/CircuitBreaker.ts +0 -118
  56. package/src/core/ConfigFetcher.ts +0 -220
  57. package/src/core/ConfigResolver.ts +0 -165
  58. package/src/core/ConfigValidator.ts +0 -197
  59. package/src/core/DatabaseStorage.ts +0 -526
  60. package/src/core/FreeTierLimitsGuard.ts +0 -281
  61. package/src/core/LLMRouter.ts +0 -79
  62. package/src/core/LangChainAgent.ts +0 -132
  63. package/src/core/LicenseValidator.ts +0 -284
  64. package/src/core/LicenseVerifier.ts +0 -261
  65. package/src/core/MultiAgentCoordinator.ts +0 -239
  66. package/src/core/Pipeline.ts +0 -1279
  67. package/src/core/PluginManager.ts +0 -277
  68. package/src/core/ProjectSettings.ts +0 -247
  69. package/src/core/ProviderHealthCheck.ts +0 -133
  70. package/src/core/ProviderInterfaces.ts +0 -37
  71. package/src/core/ProviderRegistry.ts +0 -156
  72. package/src/core/QueryProcessor.ts +0 -399
  73. package/src/core/Retrivora.ts +0 -98
  74. package/src/core/VectorPlugin.ts +0 -193
  75. package/src/core/mcp.ts +0 -261
  76. package/src/exceptions/index.ts +0 -131
  77. package/src/handlers/index.ts +0 -1625
  78. package/src/hooks/useHydrated.ts +0 -13
  79. package/src/hooks/useProjectSettings.ts +0 -105
  80. package/src/hooks/useRagChat.ts +0 -436
  81. package/src/hooks/useStoredMessages.ts +0 -64
  82. package/src/index.css +0 -4269
  83. package/src/index.ts +0 -137
  84. package/src/lib/plugin.ts +0 -24
  85. package/src/llm/ILLMProvider.ts +0 -60
  86. package/src/llm/LLMFactory.ts +0 -141
  87. package/src/llm/providers/AnthropicProvider.ts +0 -215
  88. package/src/llm/providers/GeminiProvider.ts +0 -311
  89. package/src/llm/providers/GroqProvider.ts +0 -184
  90. package/src/llm/providers/OllamaProvider.ts +0 -232
  91. package/src/llm/providers/OpenAIProvider.ts +0 -188
  92. package/src/llm/providers/QwenProvider.ts +0 -199
  93. package/src/llm/providers/UniversalLLMAdapter.ts +0 -422
  94. package/src/llm/utils.ts +0 -46
  95. package/src/providers/graphdb/BaseGraphProvider.ts +0 -43
  96. package/src/providers/graphdb/SimpleGraphProvider.ts +0 -66
  97. package/src/providers/vectordb/BaseVectorProvider.ts +0 -98
  98. package/src/providers/vectordb/ChromaDBProvider.ts +0 -130
  99. package/src/providers/vectordb/MilvusProvider.ts +0 -134
  100. package/src/providers/vectordb/MongoDBProvider.ts +0 -250
  101. package/src/providers/vectordb/MultiTablePostgresProvider.ts +0 -461
  102. package/src/providers/vectordb/PineconeProvider.ts +0 -295
  103. package/src/providers/vectordb/PostgreSQLProvider.ts +0 -227
  104. package/src/providers/vectordb/QdrantProvider.ts +0 -294
  105. package/src/providers/vectordb/RedisProvider.ts +0 -105
  106. package/src/providers/vectordb/UniversalVectorProvider.ts +0 -221
  107. package/src/providers/vectordb/WeaviateProvider.ts +0 -172
  108. package/src/rag/DocumentChunker.ts +0 -144
  109. package/src/rag/EntityExtractor.ts +0 -90
  110. package/src/rag/LlamaIndexIngestor.ts +0 -60
  111. package/src/rag/Reranker.ts +0 -106
  112. package/src/rendering/IntentClassifier.ts +0 -167
  113. package/src/rendering/RendererRegistry.ts +0 -164
  114. package/src/rendering/RuleEngine.ts +0 -67
  115. package/src/rendering/VisualizationDecisionEngine.ts +0 -164
  116. package/src/rendering/__tests__/VisualizationDecisionEngine.test.ts +0 -237
  117. package/src/rendering/index.ts +0 -12
  118. package/src/rendering/rules/Rule1SpecificInfoRule.ts +0 -28
  119. package/src/rendering/rules/Rule2ComparisonRule.ts +0 -24
  120. package/src/rendering/rules/Rule3ProductDiscoveryRule.ts +0 -28
  121. package/src/rendering/rules/Rule4AnalyticalRule.ts +0 -38
  122. package/src/rendering/rules/Rule5MixedResponseRule.ts +0 -29
  123. package/src/rendering/rules/Rule6SmallResultSetRule.ts +0 -24
  124. package/src/rendering/rules/Rule7LargeTableRule.ts +0 -35
  125. package/src/rendering/types.ts +0 -96
  126. package/src/server.ts +0 -156
  127. package/src/tailwind.css +0 -194
  128. package/src/telemetry/TelemetryService.ts +0 -330
  129. package/src/types/chat.ts +0 -89
  130. package/src/types/index.ts +0 -278
  131. package/src/types/pdf-parse.d.ts +0 -13
  132. package/src/types/props.ts +0 -169
  133. package/src/utils/DocumentParser.ts +0 -111
  134. package/src/utils/ProductExtractor.ts +0 -350
  135. package/src/utils/SchemaMapper.ts +0 -176
  136. package/src/utils/UITransformer.ts +0 -1812
  137. package/src/utils/synonyms.ts +0 -80
  138. package/src/utils/templateUtils.ts +0 -78
  139. package/src/version.ts +0 -6
@@ -1,503 +0,0 @@
1
- import React from 'react';
2
- import {
3
- Zap,
4
- Database,
5
- Layers,
6
- Search,
7
- Box,
8
- Package,
9
- Activity,
10
- Hexagon,
11
- Sparkles,
12
- Bot,
13
- Brain,
14
- Rabbit,
15
- Code,
16
- Terminal,
17
- FileText,
18
- Puzzle,
19
- MessageSquare,
20
- Cpu,
21
- Cloud,
22
- } from 'lucide-react';
23
- import { ArchitectureCardProps, Snippet, PipelineStep, ProviderPill } from '../types';
24
-
25
- export const LANDING_PAGE_CONTENT = {
26
- hero: {
27
- badge: 'Dynamic & Universal Retrivora AI',
28
- title: 'The Universal Bridge for Generative AI',
29
- subtitle: 'Retrivora AI is a vendor-agnostic RAG engine that connects any Document to any LLM and Vector Database in minutes.',
30
- },
31
- lifecycle: {
32
- title: 'The RAG Lifecycle',
33
- },
34
- guide: {
35
- title: 'Interactive Guide',
36
- subtitle: 'Universal RAG integration for your Next.js applications in minutes.',
37
- }
38
- };
39
-
40
- export const VECTOR_DATABASES: ProviderPill[] = [
41
- { Icon: Zap, label: 'Pinecone' },
42
- { Icon: Database, label: 'PostgreSQL' },
43
- { Icon: Layers, label: 'MongoDB' },
44
- { Icon: Box, label: 'Qdrant' },
45
- { Icon: Search, label: 'Milvus' },
46
- { Icon: Package, label: 'ChromaDB' },
47
- { Icon: Activity, label: 'Redis' },
48
- { Icon: Hexagon, label: 'Weaviate' },
49
- ];
50
-
51
- export const AI_MODELS: ProviderPill[] = [
52
- { Icon: Rabbit, label: 'Ollama' },
53
- { Icon: Sparkles, label: 'OpenAI' },
54
- { Icon: Bot, label: 'Anthropic' },
55
- { Icon: Brain, label: 'Gemini' },
56
- { Icon: Cpu, label: 'Groq' },
57
- { Icon: Cloud, label: 'Qwen' },
58
- { Icon: Code, label: 'Copilot' },
59
- { Icon: Terminal, label: 'LiteLLM' },
60
- ];
61
-
62
- export const PIPELINE_STEPS: PipelineStep[] = [
63
- {
64
- step: '01',
65
- Icon: FileText,
66
- title: 'Ingest',
67
- desc: 'Universal support for PDF, DOCX, CSV, and JSON. Documents are parsed, chunked, and embedded.',
68
- colors: { from: '#10b981', to: '#14b8a6' },
69
- },
70
- {
71
- step: '02',
72
- Icon: Search,
73
- title: 'Retrieve',
74
- desc: 'Queries are converted to vectors. Semantic search finds context across any configured Vector DB.',
75
- colors: { from: '#14b8a6', to: '#06b6d4' },
76
- },
77
- {
78
- step: '03',
79
- Icon: Puzzle,
80
- title: 'Augment',
81
- desc: 'Retrieved context is injected into the LLM prompt with namespaced project isolation.',
82
- colors: { from: '#06b6d4', to: '#3b82f6' },
83
- },
84
- {
85
- step: '04',
86
- Icon: MessageSquare,
87
- title: 'Generate',
88
- desc: 'Providers like OpenAI, Anthropic, or Gemini produce grounded, source-cited responses.',
89
- colors: { from: '#3b82f6', to: '#6366f1' },
90
- },
91
- ];
92
-
93
- export const SNIPPETS: Snippet[] = [
94
- {
95
- id: 'pipeline',
96
- title: 'Retrivora SDK',
97
- language: 'typescript',
98
- description: 'Create one server-side SDK instance from config; clients never know which providers are used.',
99
- code: `import { Retrivora } from '@retrivora-ai/rag-engine/server';
100
-
101
- const ai = new Retrivora({
102
- projectId: 'support-app',
103
- llm: {
104
- provider: 'openai',
105
- model: 'gpt-5',
106
- apiKey: process.env.OPENAI_API_KEY,
107
- },
108
- embedding: {
109
- provider: 'openai',
110
- model: 'text-embedding-3-small',
111
- apiKey: process.env.OPENAI_API_KEY,
112
- },
113
- vectorDatabase: {
114
- provider: 'pinecone',
115
- indexName: 'support-docs',
116
- options: { apiKey: process.env.PINECONE_API_KEY },
117
- },
118
- retrieval: { strategy: 'hybrid', topK: 5 },
119
- workflow: { type: 'agentic-rag' },
120
- });
121
-
122
- await ai.ingest([{
123
- docId: 'doc-1',
124
- content: 'Retrivora AI simplifies RAG...',
125
- metadata: { source: 'docs' }
126
- }]);
127
-
128
- const { reply, sources } = await ai.ask('How does Retrivora work?');`,
129
- },
130
- {
131
- id: 'handlers',
132
- title: 'Next.js Routes',
133
- language: 'typescript',
134
- description: 'Keep secrets and provider code in App Router handlers, then expose simple API endpoints to React.',
135
- code: `// app/api/chat/route.ts
136
- import { Retrivora, createStreamHandler } from '@retrivora-ai/rag-engine/server';
137
-
138
- const ai = new Retrivora({
139
- projectId: 'support-app',
140
- llm: { provider: 'openai', model: 'gpt-5', apiKey: process.env.OPENAI_API_KEY },
141
- embedding: { provider: 'openai', model: 'text-embedding-3-small', apiKey: process.env.OPENAI_API_KEY },
142
- vectorDatabase: {
143
- provider: 'pinecone',
144
- indexName: 'support-docs',
145
- options: { apiKey: process.env.PINECONE_API_KEY },
146
- },
147
- });
148
-
149
- export const POST = createStreamHandler(ai.config);
150
-
151
- // app/api/upload/route.ts
152
- // export const POST = createUploadHandler(ai.config);`,
153
- },
154
- {
155
- id: 'ui',
156
- title: 'React Client UI',
157
- language: 'typescript',
158
- description: 'Import browser-safe components in Client Components; API keys stay on the server.',
159
- code: `'use client';
160
-
161
- import { ConfigProvider, ChatWidget } from '@retrivora-ai/rag-engine';
162
-
163
- export default function Layout({ children }) {
164
- return (
165
- <ConfigProvider
166
- config={{
167
- projectId: 'support-app',
168
- ui: {
169
- title: 'AI Assistant',
170
- showSources: true,
171
- allowUpload: true,
172
- },
173
- }}
174
- >
175
- {children}
176
- <ChatWidget position="bottom-right" />
177
- </ConfigProvider>
178
- );
179
- }`,
180
- },
181
- {
182
- id: 'config',
183
- title: 'Headless Hook',
184
- language: 'typescript',
185
- description: 'Build your own chat surface with the same server-backed route.',
186
- code: `'use client';
187
-
188
- import React from 'react';
189
- import { useRagChat } from '@retrivora-ai/rag-engine';
190
-
191
- export function AskBox() {
192
- const [input, setInput] = React.useState('');
193
- const { messages, send, isLoading } = useRagChat('support-app', {
194
- apiUrl: '/api/chat',
195
- });
196
-
197
- return (
198
- <form onSubmit={(event) => {
199
- event.preventDefault();
200
- send(input);
201
- setInput('');
202
- }}>
203
- <input value={input} onChange={(event) => setInput(event.target.value)} />
204
- <button disabled={isLoading}>Ask</button>
205
-
206
- {messages.map((message) => (
207
- <p key={message.id}>{message.content}</p>
208
- ))}
209
- </form>
210
- );
211
- }`,
212
- },
213
- {
214
- id: 'env',
215
- title: 'Environment',
216
- language: 'bash',
217
- description: 'The exact environment variable structure required for auto-configuration.',
218
- code: `# Project Identity
219
- RAG_PROJECT_ID=my-project
220
-
221
- # Vector DB
222
- VECTOR_DB_PROVIDER=pinecone
223
- PINECONE_API_KEY=pcsk_...
224
- VECTOR_DB_INDEX=products
225
-
226
- # AI Services
227
- LLM_PROVIDER=openai
228
- LLM_MODEL=gpt-4o
229
- OPENAI_API_KEY=sk-...`,
230
- },
231
- ];
232
-
233
- export const ARCHITECTURE_CARDS: ArchitectureCardProps[] = [
234
- {
235
- icon: <Database className="text-indigo-600" />,
236
- title: 'Vector Store',
237
- description: 'Universal support for Pinecone, PGVector, MongoDB, Milvus, Qdrant, and more.',
238
- badge: 'Vector DB',
239
- badgeColor: 'bg-indigo-50 dark:bg-indigo-500/10 text-indigo-600 dark:text-indigo-400 border-indigo-200 dark:border-indigo-500/20',
240
- },
241
- {
242
- icon: <Zap className="text-amber-500" />,
243
- title: 'Embeddings',
244
- description: 'Seamlessly switch between OpenAI, Ollama, or custom embedding providers.',
245
- badge: 'Models',
246
- badgeColor: 'bg-amber-50 dark:bg-amber-500/10 text-amber-600 dark:text-amber-400 border-amber-200 dark:border-amber-500/20',
247
- },
248
- {
249
- icon: <Bot className="text-emerald-500" />,
250
- title: 'LLM Orchestration',
251
- description: 'Optimized inference across OpenAI, Anthropic, Gemini, and local LLMs.',
252
- badge: 'Inference',
253
- badgeColor: 'bg-emerald-50 dark:bg-emerald-500/10 text-emerald-600 dark:text-emerald-400 border-emerald-200 dark:border-emerald-500/20',
254
- },
255
- ];
256
-
257
- export const QUICK_START_STEPS = [
258
- 'Install @retrivora-ai/rag-engine',
259
- 'Configure your .env.local',
260
- 'Mount the API handlers',
261
- 'Drop the ChatWidget'
262
- ];
263
-
264
- export const API_ENDPOINTS = ['chat', 'health', 'ingest', 'upload'];
265
-
266
- export const CHAT_SUGGESTIONS = [
267
- 'What can you help me with?',
268
- 'Summarise the key topics',
269
- 'Show me an example'
270
- ];
271
-
272
- export const BORDER_RADIUS_MAP: Record<string, string> = {
273
- none: 'rounded-none',
274
- sm: 'rounded-sm',
275
- md: 'rounded-md',
276
- lg: 'rounded-lg',
277
- xl: 'rounded-xl',
278
- full: 'rounded-3xl',
279
- };
280
-
281
- export interface RagPatternStep {
282
- label: string;
283
- type: 'input' | 'process' | 'database' | 'model' | 'output';
284
- color: string;
285
- }
286
-
287
- export interface RagPattern {
288
- id: string;
289
- name: string;
290
- tagline: string;
291
- description: string;
292
- pros: string[];
293
- cons: string[];
294
- snippet: string;
295
- color: string;
296
- flowSteps: RagPatternStep[];
297
- }
298
-
299
- export const RAG_PATTERNS: RagPattern[] = [
300
- {
301
- id: 'naive',
302
- name: 'Naive RAG',
303
- tagline: 'Standard semantic search pipeline',
304
- description: 'The foundation pattern: splits documents into text chunks, embeddings are stored in a vector database, and relevant context is fetched via direct query similarity to augment the model prompt.',
305
- pros: ['Very low latency', 'Low resource cost', 'Simple implementation'],
306
- cons: ['Struggles with complex multi-hop queries', 'No ranking optimization', 'Can return irrelevant context chunks'],
307
- color: '#d97706', // Amber/Brown
308
- snippet: `import { Retrivora } from '@retrivora-ai/rag-engine/server';
309
-
310
- const ai = new Retrivora({
311
- projectId: 'naive-rag-demo',
312
- vectorDatabase: {
313
- provider: 'pinecone',
314
- indexName: 'knowledge-base',
315
- },
316
- workflow: {
317
- type: 'simple-rag'
318
- }
319
- });`,
320
- flowSteps: [
321
- { label: 'Documents', type: 'input', color: 'bg-amber-100 text-amber-800 dark:bg-amber-950/40 dark:text-amber-300' },
322
- { label: 'Chunking', type: 'process', color: 'bg-amber-50 text-amber-700 dark:bg-amber-900/20 dark:text-amber-400' },
323
- { label: 'Embedding Model', type: 'model', color: 'bg-amber-100 text-amber-900 dark:bg-amber-800/30 dark:text-amber-200' },
324
- { label: 'Vector Store', type: 'database', color: 'bg-amber-200 text-amber-950 dark:bg-amber-700/40 dark:text-amber-100' },
325
- { label: 'Context Prompt', type: 'process', color: 'bg-amber-50 text-amber-700 dark:bg-amber-900/20 dark:text-amber-400' },
326
- { label: 'LLM Generator', type: 'model', color: 'bg-indigo-100 text-indigo-900 dark:bg-indigo-800/30 dark:text-indigo-200' },
327
- ]
328
- },
329
- {
330
- id: 'retrieve-and-rerank',
331
- name: 'Retrieve-and-rerank',
332
- tagline: 'High-precision contextual relevance',
333
- description: 'Enhances standard RAG by fetching a larger pool of vector candidates and feeding them through a cross-encoder Reranker model. The reranker scores context chunks dynamically relative to query intent, filtering noise.',
334
- pros: ['Extremely high context precision', 'Better generation accuracy', 'Mitigates hallucination rates'],
335
- cons: ['Adds slight latency bottleneck (~100-300ms)', 'Higher computational requirements'],
336
- color: '#2563eb', // Blue
337
- snippet: `import { Retrivora } from '@retrivora-ai/rag-engine/server';
338
-
339
- const ai = new Retrivora({
340
- projectId: 'rerank-rag-demo',
341
- vectorDatabase: {
342
- provider: 'pinecone',
343
- indexName: 'knowledge-base',
344
- },
345
- retrieval: {
346
- strategy: 'contextual-compression',
347
- useReranking: true, // Enables cross-encoder re-evaluation
348
- topK: 5,
349
- }
350
- });`,
351
- flowSteps: [
352
- { label: 'Query Input', type: 'input', color: 'bg-blue-100 text-blue-800 dark:bg-blue-950/40 dark:text-blue-300' },
353
- { label: 'Vector Retrieval', type: 'database', color: 'bg-blue-200 text-blue-950 dark:bg-blue-700/40 dark:text-blue-100' },
354
- { label: 'Reranker Model', type: 'model', color: 'bg-indigo-100 text-indigo-950 dark:bg-indigo-700/40 dark:text-indigo-100' },
355
- { label: 'Filtered Context', type: 'process', color: 'bg-blue-50 text-blue-700 dark:bg-blue-900/20 dark:text-blue-400' },
356
- { label: 'Generative Model', type: 'model', color: 'bg-violet-100 text-violet-900 dark:bg-violet-800/30 dark:text-violet-200' },
357
- ]
358
- },
359
- {
360
- id: 'multimodal',
361
- name: 'Multimodal RAG',
362
- tagline: 'Search and reason across text and media',
363
- description: 'Ingests both unstructured text documents and visual/audio/structured assets. It queries multi-modal embeddings, feeding retrieved visuals and matched context fragments to multimodal LLMs (like Gemini or Claude) to support diagrams, tables, and media outputs.',
364
- pros: ['Handles images, PDFs, charts, audio', 'Deeper context retrieval', 'Generates visual answers'],
365
- cons: ['Multimodal embeddings are computationally expensive', 'Higher token payload sizes'],
366
- color: '#7c3aed', // Purple
367
- snippet: `import { Retrivora } from '@retrivora-ai/rag-engine/server';
368
-
369
- const ai = new Retrivora({
370
- projectId: 'multimodal-rag-demo',
371
- llm: {
372
- provider: 'gemini',
373
- model: 'gemini-2.5-flash', // Multimodal reasoning model
374
- },
375
- embedding: {
376
- provider: 'gemini',
377
- model: 'text-embedding-004',
378
- },
379
- workflow: {
380
- type: 'multimodal-rag'
381
- }
382
- });`,
383
- flowSteps: [
384
- { label: 'Multi-modal Docs', type: 'input', color: 'bg-purple-100 text-purple-800 dark:bg-purple-950/40 dark:text-purple-300' },
385
- { label: 'Multi-modal Embed', type: 'model', color: 'bg-purple-50 text-purple-700 dark:bg-purple-900/20 dark:text-purple-400' },
386
- { label: 'Vector Store', type: 'database', color: 'bg-purple-200 text-purple-950 dark:bg-purple-700/40 dark:text-purple-100' },
387
- { label: 'Media Context', type: 'process', color: 'bg-purple-100 text-purple-950 dark:bg-purple-800/40 dark:text-purple-100' },
388
- { label: 'Multimodal LLM', type: 'model', color: 'bg-violet-100 text-violet-900 dark:bg-violet-800/30 dark:text-violet-200' },
389
- ]
390
- },
391
- {
392
- id: 'graph',
393
- name: 'Graph RAG',
394
- tagline: 'Entity-relationship semantic reasoning',
395
- description: 'Builds a knowledge graph structure from raw documents using an LLM extractor. Entity-to-entity and entity-to-document relationships are resolved, allowing queries to retrieve structured semantic contexts (nodes & relationships) to resolve structural, relational, and hierarchy-based questions.',
396
- pros: ['Excellent for tracing connections', 'Resolves hierarchy and relationships', 'Grounded fact validation'],
397
- cons: ['Heavy write-time pipeline ingestion cost', 'Requires graph database setup'],
398
- color: '#059669', // Emerald
399
- snippet: `import { Retrivora } from '@retrivora-ai/rag-engine/server';
400
-
401
- const ai = new Retrivora({
402
- projectId: 'graph-rag-demo',
403
- graphDb: {
404
- provider: 'neo4j',
405
- options: { uri: 'neo4j://localhost:7687' },
406
- },
407
- workflow: {
408
- type: 'graph-rag'
409
- }
410
- });`,
411
- flowSteps: [
412
- { label: 'Documents', type: 'input', color: 'bg-emerald-100 text-emerald-800 dark:bg-emerald-950/40 dark:text-emerald-300' },
413
- { label: 'LLM Extractor', type: 'model', color: 'bg-emerald-50 text-emerald-700 dark:bg-emerald-900/20 dark:text-emerald-400' },
414
- { label: 'Graph Database', type: 'database', color: 'bg-emerald-200 text-emerald-950 dark:bg-emerald-700/40 dark:text-emerald-100' },
415
- { label: 'Relation Search', type: 'process', color: 'bg-emerald-100 text-emerald-950 dark:bg-emerald-800/40 dark:text-emerald-100' },
416
- { label: 'LLM Reasoner', type: 'model', color: 'bg-indigo-100 text-indigo-900 dark:bg-indigo-800/30 dark:text-indigo-200' },
417
- ]
418
- },
419
- {
420
- id: 'hybrid',
421
- name: 'Hybrid RAG',
422
- tagline: 'Best of both worlds: Vector + Graph',
423
- description: 'Queries both a vector database for semantic match proximity and a graph database for topological linkages. It joins vector search results and sub-graph entity contexts into a unified prompt, resolving complex interconnected schemas.',
424
- pros: ['Unparalleled query coverage', 'Combines semantic proximity and graph relationships', 'Robust grounding'],
425
- cons: ['Most complex RAG configuration', 'Double database query overhead'],
426
- color: '#d97706', // Orange
427
- snippet: `import { Retrivora } from '@retrivora-ai/rag-engine/server';
428
-
429
- const ai = new Retrivora({
430
- projectId: 'hybrid-rag-demo',
431
- vectorDatabase: { provider: 'mongodb', indexName: 'default' },
432
- graphDb: { provider: 'neo4j', options: { uri: 'neo4j://...' } },
433
- workflow: {
434
- type: 'hybrid-rag'
435
- }
436
- });`,
437
- flowSteps: [
438
- { label: 'Query', type: 'input', color: 'bg-amber-100 text-amber-800 dark:bg-amber-950/40 dark:text-amber-300' },
439
- { label: 'Vector Store', type: 'database', color: 'bg-orange-100 text-orange-950 dark:bg-orange-700/40 dark:text-orange-100' },
440
- { label: 'Graph Database', type: 'database', color: 'bg-emerald-100 text-emerald-950 dark:bg-emerald-700/40 dark:text-emerald-100' },
441
- { label: 'Unified Context', type: 'process', color: 'bg-amber-50 text-amber-700 dark:bg-amber-900/20 dark:text-amber-400' },
442
- { label: 'LLM Reasoner', type: 'model', color: 'bg-indigo-100 text-indigo-900 dark:bg-indigo-800/30 dark:text-indigo-200' },
443
- ]
444
- },
445
- {
446
- id: 'agentic-router',
447
- name: 'Agentic RAG (Router)',
448
- tagline: 'Dynamic intent-based query routing',
449
- description: 'Uses an intelligent fast router agent to analyze the intent of the incoming query. The router dynamically decides whether to fetch data from the Vector DB, query a Graph DB, fallback to web search, or trigger external API tools.',
450
- pros: ['Highly adaptive workflow', 'Saves tokens on simple queries', 'Automatically invokes external API tools'],
451
- cons: ['Adds slight routing classification latency', 'Dependent on router accuracy'],
452
- color: '#0891b2', // Cyan
453
- snippet: `import { Retrivora } from '@retrivora-ai/rag-engine/server';
454
-
455
- const ai = new Retrivora({
456
- projectId: 'agentic-router-demo',
457
- workflow: {
458
- type: 'agentic-router'
459
- }
460
- });`,
461
- flowSteps: [
462
- { label: 'User Query', type: 'input', color: 'bg-cyan-100 text-cyan-800 dark:bg-cyan-950/40 dark:text-cyan-300' },
463
- { label: 'Router Agent', type: 'model', color: 'bg-indigo-100 text-indigo-900 dark:bg-indigo-800/30 dark:text-indigo-200' },
464
- { label: 'Vector / Graph / Tools', type: 'database', color: 'bg-cyan-200 text-cyan-950 dark:bg-cyan-700/40 dark:text-cyan-100' },
465
- { label: 'Selected Context', type: 'process', color: 'bg-cyan-50 text-cyan-700 dark:bg-cyan-900/20 dark:text-cyan-400' },
466
- { label: 'LLM Generator', type: 'model', color: 'bg-violet-100 text-violet-900 dark:bg-violet-800/30 dark:text-violet-200' },
467
- ]
468
- },
469
- {
470
- id: 'multi-agent',
471
- name: 'Agent RAG (Multi-Agent)',
472
- tagline: 'Collaborative swarm-based problem solving',
473
- description: 'Deploys a supervisor agent that coordinates a group of specialized worker agents (e.g., search agent, tool executor agent, web crawler agent). Agents collaborate, pass information, check each other\'s facts, and compile a final answer.',
474
- pros: ['Excellent for complex research tasks', 'Self-correcting query pipelines', 'Multi-step action sequences'],
475
- cons: ['High latency (requires multiple LLM cycles)', 'Higher cost per query', 'Complex state synchronization'],
476
- color: '#ec4899', // Pink
477
- snippet: `import { Retrivora } from '@retrivora-ai/rag-engine/server';
478
-
479
- const ai = new Retrivora({
480
- projectId: 'multi-agent-demo',
481
- workflow: {
482
- type: 'multi-agent'
483
- },
484
- mcpServers: [
485
- {
486
- name: 'search-engine',
487
- transport: 'stdio',
488
- command: 'npx',
489
- args: ['-y', '@modelcontextprotocol/server-web-search']
490
- }
491
- ]
492
- });`,
493
- flowSteps: [
494
- { label: 'Goal Query', type: 'input', color: 'bg-pink-100 text-pink-800 dark:bg-pink-950/40 dark:text-pink-300' },
495
- { label: 'Supervisor Agent', type: 'model', color: 'bg-pink-200 text-pink-950 dark:bg-pink-800/30 dark:text-pink-100' },
496
- { label: 'Specialist Agents', type: 'model', color: 'bg-indigo-100 text-indigo-900 dark:bg-indigo-900/30 dark:text-indigo-200' },
497
- { label: 'Tools / Vector DBs', type: 'database', color: 'bg-pink-200 text-pink-950 dark:bg-pink-700/40 dark:text-pink-100' },
498
- { label: 'Consensus Context', type: 'process', color: 'bg-pink-50 text-pink-700 dark:bg-pink-900/20 dark:text-pink-400' },
499
- { label: 'Final Output', type: 'output', color: 'bg-indigo-600 text-white shadow-sm' },
500
- ]
501
- }
502
- ];
503
-