@retrivora-ai/rag-engine 1.9.6 → 1.9.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 (44) hide show
  1. package/README.md +32 -7
  2. package/dist/{ILLMProvider-DNhyOYoK.d.mts → ILLMProvider-Bhk6zJOK.d.mts} +2 -6
  3. package/dist/{ILLMProvider-DNhyOYoK.d.ts → ILLMProvider-Bhk6zJOK.d.ts} +2 -6
  4. package/dist/handlers/index.d.mts +2 -2
  5. package/dist/handlers/index.d.ts +2 -2
  6. package/dist/handlers/index.js +213 -67
  7. package/dist/handlers/index.mjs +212 -67
  8. package/dist/{index-CjQdL0cX.d.ts → index-B9J_XEh0.d.ts} +6 -2
  9. package/dist/{index-C9v7-tWd.d.mts → index-BJ4cd-t5.d.mts} +6 -2
  10. package/dist/{index-Hgbwl9X4.d.ts → index-Bu7T6xgr.d.ts} +20 -3
  11. package/dist/{index-CHL1jdYm.d.mts → index-C3SVtPYg.d.mts} +20 -3
  12. package/dist/index.css +197 -10
  13. package/dist/index.d.mts +13 -5
  14. package/dist/index.d.ts +13 -5
  15. package/dist/index.js +39 -6
  16. package/dist/index.mjs +38 -7
  17. package/dist/server.d.mts +5 -5
  18. package/dist/server.d.ts +5 -5
  19. package/dist/server.js +310 -113
  20. package/dist/server.mjs +307 -112
  21. package/package.json +2 -4
  22. package/src/app/constants.tsx +183 -218
  23. package/src/app/layout.tsx +4 -28
  24. package/src/app/types.ts +17 -17
  25. package/src/components/ChatWidget.tsx +3 -1
  26. package/src/components/ChatWindow.tsx +5 -1
  27. package/src/components/DocViewer.tsx +71 -5
  28. package/src/components/Documentation.tsx +74 -11
  29. package/src/components/constants.tsx +275 -0
  30. package/src/config/RagConfig.ts +10 -10
  31. package/src/config/constants.ts +1 -0
  32. package/src/core/ConfigResolver.ts +24 -25
  33. package/src/core/Pipeline.ts +2 -1
  34. package/src/core/ProviderRegistry.ts +5 -5
  35. package/src/core/Retrivora.ts +46 -6
  36. package/src/core/VectorPlugin.ts +62 -8
  37. package/src/exceptions/index.ts +52 -0
  38. package/src/handlers/index.ts +71 -0
  39. package/src/hooks/useRagChat.ts +4 -1
  40. package/src/index.ts +2 -0
  41. package/src/llm/LLMFactory.ts +6 -5
  42. package/src/server.ts +16 -13
  43. package/src/types/chat.ts +2 -0
  44. package/src/types/props.ts +38 -1
@@ -4,8 +4,28 @@ import React from 'react';
4
4
  import { Snippet } from '@/app/types';
5
5
  import { SNIPPETS } from '@/app/constants';
6
6
  import { CodeViewer } from './CodeViewer';
7
+ import { ArrowLeft, ArrowRight } from 'lucide-react';
7
8
 
8
9
  export function DocViewer({ activeSnippet, setActiveSnippet }: { activeSnippet: Snippet, setActiveSnippet: (s: Snippet) => void }) {
10
+ const currentIndex = SNIPPETS.findIndex((s) => s.id === activeSnippet.id);
11
+ const totalSteps = SNIPPETS.length;
12
+ const isFirst = currentIndex === 0;
13
+ const isLast = currentIndex === totalSteps - 1;
14
+
15
+ const handlePrev = () => {
16
+ if (!isFirst) {
17
+ setActiveSnippet(SNIPPETS[currentIndex - 1]);
18
+ }
19
+ };
20
+
21
+ const handleNext = () => {
22
+ if (!isLast) {
23
+ setActiveSnippet(SNIPPETS[currentIndex + 1]);
24
+ }
25
+ };
26
+
27
+ const progressPercent = Math.round(((currentIndex + 1) / totalSteps) * 100);
28
+
9
29
  return (
10
30
  <>
11
31
  <div className="mb-6 flex flex-wrap gap-2 border-b border-slate-100 dark:border-white/5 pb-6">
@@ -23,14 +43,60 @@ export function DocViewer({ activeSnippet, setActiveSnippet }: { activeSnippet:
23
43
  ))}
24
44
  </div>
25
45
 
46
+ {/* Visual Progress Bar */}
47
+ <div className="mb-6 bg-slate-100 dark:bg-white/5 rounded-full h-2.5 overflow-hidden border border-slate-200/50 dark:border-white/5 relative">
48
+ <div
49
+ className="h-full bg-gradient-to-r from-indigo-500 via-indigo-600 to-violet-600 transition-all duration-500 rounded-full shadow-[0_0_8px_rgba(99,102,241,0.5)]"
50
+ style={{ width: `${progressPercent}%` }}
51
+ />
52
+ </div>
53
+
26
54
  <div className="flex-grow flex flex-col gap-6 animate-in fade-in slide-in-from-bottom-2 duration-500">
27
- <div className="max-w-2xl">
28
- <h3 className="text-xl font-bold text-slate-900 dark:text-white mb-2">{activeSnippet.title}</h3>
29
- <p className="text-sm text-slate-500 dark:text-white/40 leading-relaxed font-medium italic">
30
- {activeSnippet.description}
31
- </p>
55
+ <div className="max-w-2xl flex items-start justify-between gap-4 flex-wrap sm:flex-nowrap">
56
+ <div>
57
+ <h3 className="text-xl font-bold text-slate-900 dark:text-white mb-2 flex items-center gap-3">
58
+ {activeSnippet.title}
59
+ <span className="text-[10px] font-extrabold uppercase px-2 py-0.5 rounded bg-indigo-50 dark:bg-indigo-500/10 border border-indigo-100 dark:border-indigo-500/20 text-indigo-600 dark:text-indigo-400">
60
+ Step {currentIndex + 1} of {totalSteps}
61
+ </span>
62
+ </h3>
63
+ <p className="text-sm text-slate-500 dark:text-white/40 leading-relaxed font-medium italic">
64
+ {activeSnippet.description}
65
+ </p>
66
+ </div>
67
+ <span className="text-xs font-mono font-bold text-indigo-600 dark:text-indigo-400 self-center shrink-0">
68
+ {progressPercent}% Complete
69
+ </span>
32
70
  </div>
71
+
33
72
  <CodeViewer snippet={activeSnippet} />
73
+
74
+ {/* Next/Prev Navigation */}
75
+ <div className="flex items-center justify-between border-t border-slate-200 dark:border-white/10 pt-6 mt-4">
76
+ <button
77
+ onClick={handlePrev}
78
+ disabled={isFirst}
79
+ className={`flex items-center gap-2 px-5 py-2.5 rounded-xl text-xs font-bold transition-all border ${
80
+ isFirst
81
+ ? 'opacity-40 cursor-not-allowed border-slate-200 dark:border-white/5 text-slate-400 dark:text-white/20 bg-slate-50 dark:bg-transparent'
82
+ : 'bg-white dark:bg-white/5 border-slate-200 dark:border-white/10 text-slate-700 dark:text-white/70 hover:border-slate-300 dark:hover:border-white/20 active:scale-95'
83
+ }`}
84
+ >
85
+ <ArrowLeft size={14} /> Previous Step
86
+ </button>
87
+
88
+ <button
89
+ onClick={handleNext}
90
+ disabled={isLast}
91
+ className={`flex items-center gap-2 px-6 py-2.5 rounded-xl text-xs font-bold transition-all border ${
92
+ isLast
93
+ ? 'opacity-40 cursor-not-allowed border-slate-200 dark:border-white/5 text-slate-400 dark:text-white/20 bg-slate-50 dark:bg-transparent'
94
+ : 'bg-indigo-600 text-white border-indigo-600 hover:bg-indigo-700 hover:border-indigo-700 active:scale-95 shadow-md shadow-indigo-500/10'
95
+ }`}
96
+ >
97
+ {isLast ? 'Complete!' : 'Next Step'} <ArrowRight size={14} />
98
+ </button>
99
+ </div>
34
100
  </div>
35
101
  </>
36
102
  );
@@ -1,9 +1,9 @@
1
1
  'use client';
2
2
 
3
3
  import React from 'react';
4
- import { FileText, Zap, Package, ExternalLink } from 'lucide-react';
4
+ import { FileText, Zap, Package, ExternalLink, Code } from 'lucide-react';
5
5
  import { DocViewer } from '@/components/DocViewer';
6
- import { LANDING_PAGE_CONTENT, QUICK_START_STEPS, API_ENDPOINTS, SNIPPETS } from '@/app/constants';
6
+ import { LANDING_PAGE_CONTENT, QUICK_START_STEPS, ADVANCED_STEPS, API_ENDPOINTS, SNIPPETS } from '@/app/constants';
7
7
  import { Snippet } from '@/app/types';
8
8
 
9
9
  export function Documentation() {
@@ -16,20 +16,83 @@ export function Documentation() {
16
16
  <p className="text-slate-600 dark:text-white/40 max-w-2xl mx-auto">{LANDING_PAGE_CONTENT.guide.subtitle}</p>
17
17
  </div>
18
18
  <div className="relative z-10 w-full grid gap-16 lg:grid-cols-[280px_1fr] items-start">
19
- <aside className="flex flex-col gap-10">
19
+ <aside className="flex flex-col gap-8">
20
20
  <section>
21
- <h2 className="mb-6 text-[10px] font-black text-slate-400 dark:text-white/30 uppercase tracking-[0.3em] flex items-center gap-3">
21
+ <h2 className="mb-4 text-[10px] font-black text-slate-400 dark:text-white/30 uppercase tracking-[0.3em] flex items-center gap-3">
22
22
  <FileText size={14} className="text-indigo-500" /> Quick Start
23
23
  </h2>
24
- <ol className="space-y-6">
25
- {QUICK_START_STEPS.map((step, i) => (
26
- <li key={i} className="group flex items-start gap-4">
27
- <span className="flex h-6 w-6 shrink-0 items-center justify-center rounded-lg bg-white dark:bg-white/5 text-slate-600 dark:text-white/40 font-mono text-[10px] border border-slate-200 dark:border-white/10 shadow-sm">{i + 1}</span>
28
- <span className="text-xs text-slate-500 dark:text-white/50 font-medium leading-relaxed pt-1">{step}</span>
29
- </li>
30
- ))}
24
+ <ol className="space-y-2.5">
25
+ {QUICK_START_STEPS.map((step, i) => {
26
+ const isActive = activeSnippet.id === step.id;
27
+ return (
28
+ <li key={step.id}>
29
+ <button
30
+ onClick={() => {
31
+ const snip = SNIPPETS.find((s) => s.id === step.id);
32
+ if (snip) setActiveSnippet(snip);
33
+ }}
34
+ className={`w-full flex items-start gap-4 p-3 rounded-xl border text-left transition-all active:scale-[0.98] ${
35
+ isActive
36
+ ? 'bg-indigo-500/10 dark:bg-indigo-500/10 border-indigo-200 dark:border-indigo-500/30'
37
+ : 'bg-white dark:bg-white/3 border-slate-200 dark:border-white/5 hover:border-slate-300 dark:hover:border-white/10 hover:bg-slate-50 dark:hover:bg-white/5 shadow-sm'
38
+ }`}
39
+ >
40
+ <span className={`flex h-6 w-6 shrink-0 items-center justify-center rounded-lg font-mono text-[10px] font-bold border transition-all ${
41
+ isActive
42
+ ? 'bg-indigo-600 text-white border-indigo-600 shadow-md shadow-indigo-500/20'
43
+ : 'bg-slate-100 dark:bg-white/5 text-slate-600 dark:text-white/40 border-slate-200 dark:border-white/10'
44
+ }`}>{i + 1}</span>
45
+ <div className="pt-0.5">
46
+ <span className={`text-xs font-semibold block transition-colors ${
47
+ isActive ? 'text-indigo-600 dark:text-indigo-400 font-bold' : 'text-slate-700 dark:text-white/70 font-medium'
48
+ }`}>{step.text}</span>
49
+ <span className="text-[9px] text-slate-400 dark:text-white/30 block mt-0.5">Step {i + 1}</span>
50
+ </div>
51
+ </button>
52
+ </li>
53
+ );
54
+ })}
55
+ </ol>
56
+ </section>
57
+
58
+ <section>
59
+ <h2 className="mb-4 text-[10px] font-black text-slate-400 dark:text-white/30 uppercase tracking-[0.3em] flex items-center gap-3">
60
+ <Code size={14} className="text-violet-500" /> Advanced Options
61
+ </h2>
62
+ <ol className="space-y-2.5">
63
+ {ADVANCED_STEPS.map((step, i) => {
64
+ const isActive = activeSnippet.id === step.id;
65
+ return (
66
+ <li key={step.id}>
67
+ <button
68
+ onClick={() => {
69
+ const snip = SNIPPETS.find((s) => s.id === step.id);
70
+ if (snip) setActiveSnippet(snip);
71
+ }}
72
+ className={`w-full flex items-start gap-4 p-3 rounded-xl border text-left transition-all active:scale-[0.98] ${
73
+ isActive
74
+ ? 'bg-violet-500/10 dark:bg-violet-500/10 border-violet-200 dark:border-violet-500/30'
75
+ : 'bg-white dark:bg-white/3 border-slate-200 dark:border-white/5 hover:border-slate-300 dark:hover:border-white/10 hover:bg-slate-50 dark:hover:bg-white/5 shadow-sm'
76
+ }`}
77
+ >
78
+ <span className={`flex h-6 w-6 shrink-0 items-center justify-center rounded-lg font-mono text-[10px] font-bold border transition-all ${
79
+ isActive
80
+ ? 'bg-violet-600 text-white border-violet-600 shadow-md shadow-violet-500/20'
81
+ : 'bg-slate-100 dark:bg-white/5 text-slate-600 dark:text-white/40 border-slate-200 dark:border-white/10'
82
+ }`}>{i + 5}</span>
83
+ <div className="pt-0.5">
84
+ <span className={`text-xs font-semibold block transition-colors ${
85
+ isActive ? 'text-violet-600 dark:text-violet-400 font-bold' : 'text-slate-700 dark:text-white/70 font-medium'
86
+ }`}>{step.text}</span>
87
+ <span className="text-[9px] text-slate-400 dark:text-white/30 block mt-0.5">Extension</span>
88
+ </div>
89
+ </button>
90
+ </li>
91
+ );
92
+ })}
31
93
  </ol>
32
94
  </section>
95
+
33
96
  <section className="rounded-2xl border border-slate-200 dark:border-white/10 bg-white dark:bg-white/3 p-6 shadow-sm">
34
97
  <h2 className="mb-6 text-[10px] font-black text-slate-400 dark:text-white/30 uppercase tracking-[0.3em] flex items-center gap-3">
35
98
  <Zap size={14} className="text-indigo-500" /> API Endpoints
@@ -0,0 +1,275 @@
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
+ } from 'lucide-react';
21
+ import { ArchitectureCardProps, Snippet, PipelineStep, ProviderPill } from '../types';
22
+
23
+ export const LANDING_PAGE_CONTENT = {
24
+ hero: {
25
+ badge: 'Dynamic & Universal Retrivora AI',
26
+ title: 'The Universal Bridge for Generative AI',
27
+ subtitle: 'Retrivora AI is a vendor-agnostic RAG engine that connects any Document to any LLM and Vector Database in minutes.',
28
+ },
29
+ lifecycle: {
30
+ title: 'The RAG Lifecycle',
31
+ },
32
+ guide: {
33
+ title: 'Interactive Guide',
34
+ subtitle: 'Universal RAG integration for your Next.js applications in minutes.',
35
+ }
36
+ };
37
+
38
+ export const VECTOR_DATABASES: ProviderPill[] = [
39
+ { Icon: Zap, label: 'Pinecone' },
40
+ { Icon: Database, label: 'PostgreSQL' },
41
+ { Icon: Layers, label: 'MongoDB' },
42
+ { Icon: Box, label: 'Qdrant' },
43
+ { Icon: Search, label: 'Milvus' },
44
+ { Icon: Package, label: 'ChromaDB' },
45
+ { Icon: Activity, label: 'Redis' },
46
+ { Icon: Hexagon, label: 'Weaviate' },
47
+ ];
48
+
49
+ export const AI_MODELS: ProviderPill[] = [
50
+ { Icon: Rabbit, label: 'Ollama' },
51
+ { Icon: Sparkles, label: 'OpenAI' },
52
+ { Icon: Bot, label: 'Anthropic' },
53
+ { Icon: Brain, label: 'Gemini' },
54
+ { Icon: Code, label: 'Copilot' },
55
+ { Icon: Terminal, label: 'LiteLLM' },
56
+ ];
57
+
58
+ export const PIPELINE_STEPS: PipelineStep[] = [
59
+ {
60
+ step: '01',
61
+ Icon: FileText,
62
+ title: 'Ingest',
63
+ desc: 'Universal support for PDF, DOCX, CSV, and JSON. Documents are parsed, chunked, and embedded.',
64
+ colors: { from: '#10b981', to: '#14b8a6' },
65
+ },
66
+ {
67
+ step: '02',
68
+ Icon: Search,
69
+ title: 'Retrieve',
70
+ desc: 'Queries are converted to vectors. Semantic search finds context across any configured Vector DB.',
71
+ colors: { from: '#14b8a6', to: '#06b6d4' },
72
+ },
73
+ {
74
+ step: '03',
75
+ Icon: Puzzle,
76
+ title: 'Augment',
77
+ desc: 'Retrieved context is injected into the LLM prompt with namespaced project isolation.',
78
+ colors: { from: '#06b6d4', to: '#3b82f6' },
79
+ },
80
+ {
81
+ step: '04',
82
+ Icon: MessageSquare,
83
+ title: 'Generate',
84
+ desc: 'Providers like OpenAI, Anthropic, or Gemini produce grounded, source-cited responses.',
85
+ colors: { from: '#3b82f6', to: '#6366f1' },
86
+ },
87
+ ];
88
+
89
+ export const SNIPPETS: Snippet[] = [
90
+ {
91
+ id: 'pipeline',
92
+ title: 'Retrivora SDK',
93
+ language: 'typescript',
94
+ description: 'Create one server-side SDK instance from config; clients never know which providers are used.',
95
+ code: `import { Retrivora } from '@retrivora-ai/rag-engine/server';
96
+
97
+ const ai = new Retrivora({
98
+ projectId: 'support-app',
99
+ llm: {
100
+ provider: 'openai',
101
+ model: 'gpt-5',
102
+ apiKey: process.env.OPENAI_API_KEY,
103
+ },
104
+ embedding: {
105
+ provider: 'openai',
106
+ model: 'text-embedding-3-small',
107
+ apiKey: process.env.OPENAI_API_KEY,
108
+ },
109
+ vectorDatabase: {
110
+ provider: 'pinecone',
111
+ indexName: 'support-docs',
112
+ options: { apiKey: process.env.PINECONE_API_KEY },
113
+ },
114
+ retrieval: { strategy: 'hybrid', topK: 5 },
115
+ workflow: { type: 'agentic-rag' },
116
+ });
117
+
118
+ await ai.ingest([{
119
+ docId: 'doc-1',
120
+ content: 'Retrivora AI simplifies RAG...',
121
+ metadata: { source: 'docs' }
122
+ }]);
123
+
124
+ const { reply, sources } = await ai.ask('How does Retrivora work?');`,
125
+ },
126
+ {
127
+ id: 'handlers',
128
+ title: 'Next.js Routes',
129
+ language: 'typescript',
130
+ description: 'Keep secrets and provider code in App Router handlers, then expose simple API endpoints to React.',
131
+ code: `// app/api/chat/route.ts
132
+ import { Retrivora, createStreamHandler } from '@retrivora-ai/rag-engine/server';
133
+
134
+ const ai = new Retrivora({
135
+ projectId: 'support-app',
136
+ llm: { provider: 'openai', model: 'gpt-5', apiKey: process.env.OPENAI_API_KEY },
137
+ embedding: { provider: 'openai', model: 'text-embedding-3-small', apiKey: process.env.OPENAI_API_KEY },
138
+ vectorDatabase: {
139
+ provider: 'pinecone',
140
+ indexName: 'support-docs',
141
+ options: { apiKey: process.env.PINECONE_API_KEY },
142
+ },
143
+ });
144
+
145
+ export const POST = createStreamHandler(ai.config);
146
+
147
+ // app/api/upload/route.ts
148
+ // export const POST = createUploadHandler(ai.config);`,
149
+ },
150
+ {
151
+ id: 'ui',
152
+ title: 'React Client UI',
153
+ language: 'typescript',
154
+ description: 'Import browser-safe components in Client Components; API keys stay on the server.',
155
+ code: `'use client';
156
+
157
+ import { ConfigProvider, ChatWidget } from '@retrivora-ai/rag-engine';
158
+
159
+ export default function Layout({ children }) {
160
+ return (
161
+ <ConfigProvider
162
+ config={{
163
+ projectId: 'support-app',
164
+ ui: {
165
+ title: 'AI Assistant',
166
+ showSources: true,
167
+ allowUpload: true,
168
+ },
169
+ }}
170
+ >
171
+ {children}
172
+ <ChatWidget position="bottom-right" />
173
+ </ConfigProvider>
174
+ );
175
+ }`,
176
+ },
177
+ {
178
+ id: 'config',
179
+ title: 'Headless Hook',
180
+ language: 'typescript',
181
+ description: 'Build your own chat surface with the same server-backed route.',
182
+ code: `'use client';
183
+
184
+ import React from 'react';
185
+ import { useRagChat } from '@retrivora-ai/rag-engine';
186
+
187
+ export function AskBox() {
188
+ const [input, setInput] = React.useState('');
189
+ const { messages, send, isLoading } = useRagChat('support-app', {
190
+ apiUrl: '/api/chat',
191
+ });
192
+
193
+ return (
194
+ <form onSubmit={(event) => {
195
+ event.preventDefault();
196
+ send(input);
197
+ setInput('');
198
+ }}>
199
+ <input value={input} onChange={(event) => setInput(event.target.value)} />
200
+ <button disabled={isLoading}>Ask</button>
201
+
202
+ {messages.map((message) => (
203
+ <p key={message.id}>{message.content}</p>
204
+ ))}
205
+ </form>
206
+ );
207
+ }`,
208
+ },
209
+ {
210
+ id: 'env',
211
+ title: 'Environment',
212
+ language: 'bash',
213
+ description: 'The exact environment variable structure required for auto-configuration.',
214
+ code: `# Project Identity
215
+ RAG_PROJECT_ID=my-project
216
+
217
+ # Vector DB
218
+ VECTOR_DB_PROVIDER=pinecone
219
+ PINECONE_API_KEY=pcsk_...
220
+ VECTOR_DB_INDEX=products
221
+
222
+ # AI Services
223
+ LLM_PROVIDER=openai
224
+ LLM_MODEL=gpt-4o
225
+ OPENAI_API_KEY=sk-...`,
226
+ },
227
+ ];
228
+
229
+ export const ARCHITECTURE_CARDS: ArchitectureCardProps[] = [
230
+ {
231
+ icon: <Database className="text-indigo-600" />,
232
+ title: 'Vector Store',
233
+ description: 'Universal support for Pinecone, PGVector, MongoDB, Milvus, Qdrant, and more.',
234
+ badge: 'Vector DB',
235
+ badgeColor: 'bg-indigo-50 dark:bg-indigo-500/10 text-indigo-600 dark:text-indigo-400 border-indigo-200 dark:border-indigo-500/20',
236
+ },
237
+ {
238
+ icon: <Zap className="text-amber-500" />,
239
+ title: 'Embeddings',
240
+ description: 'Seamlessly switch between OpenAI, Ollama, or custom embedding providers.',
241
+ badge: 'Models',
242
+ badgeColor: 'bg-amber-50 dark:bg-amber-500/10 text-amber-600 dark:text-amber-400 border-amber-200 dark:border-amber-500/20',
243
+ },
244
+ {
245
+ icon: <Bot className="text-emerald-500" />,
246
+ title: 'LLM Orchestration',
247
+ description: 'Optimized inference across OpenAI, Anthropic, Gemini, and local LLMs.',
248
+ badge: 'Inference',
249
+ badgeColor: 'bg-emerald-50 dark:bg-emerald-500/10 text-emerald-600 dark:text-emerald-400 border-emerald-200 dark:border-emerald-500/20',
250
+ },
251
+ ];
252
+
253
+ export const QUICK_START_STEPS = [
254
+ 'Install @retrivora-ai/rag-engine',
255
+ 'Configure your .env.local',
256
+ 'Mount the API handlers',
257
+ 'Drop the ChatWidget'
258
+ ];
259
+
260
+ export const API_ENDPOINTS = ['chat', 'health', 'ingest', 'upload'];
261
+
262
+ export const CHAT_SUGGESTIONS = [
263
+ 'What can you help me with?',
264
+ 'Summarise the key topics',
265
+ 'Show me an example'
266
+ ];
267
+
268
+ export const BORDER_RADIUS_MAP: Record<string, string> = {
269
+ none: 'rounded-none',
270
+ sm: 'rounded-sm',
271
+ md: 'rounded-md',
272
+ lg: 'rounded-lg',
273
+ xl: 'rounded-xl',
274
+ full: 'rounded-3xl',
275
+ };
@@ -202,16 +202,16 @@ export interface RAGConfig {
202
202
  export interface RetrievalConfig {
203
203
  /** Retrieval strategy selected by the host app. */
204
204
  strategy?:
205
- | 'vector'
206
- | 'keyword'
207
- | 'hybrid'
208
- | 'multi-query'
209
- | 'self-query'
210
- | 'parent-document'
211
- | 'contextual-compression'
212
- | 'ensemble'
213
- | 'recursive'
214
- | 'agentic';
205
+ | 'vector'
206
+ | 'keyword'
207
+ | 'hybrid'
208
+ | 'multi-query'
209
+ | 'self-query'
210
+ | 'parent-document'
211
+ | 'contextual-compression'
212
+ | 'ensemble'
213
+ | 'recursive'
214
+ | 'agentic';
215
215
  /** Number of documents/chunks retrieved per query. */
216
216
  topK?: number;
217
217
  /** Minimum similarity score to include a retrieved chunk. */
@@ -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',
@@ -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,33 +31,33 @@ export class ConfigResolver {
32
31
  projectId: hostConfig.projectId || envConfig.projectId,
33
32
  vectorDb: hostConfig.vectorDb
34
33
  ? {
35
- ...envConfig.vectorDb,
36
- ...hostConfig.vectorDb,
37
- options: {
38
- ...envConfig.vectorDb.options,
39
- ...(hostConfig.vectorDb.options || {}),
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
- ...envConfig.llm,
46
- ...hostConfig.llm,
47
- options: {
48
- ...(envConfig.llm.options || {}),
49
- ...(hostConfig.llm.options || {}),
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
- ...envConfig.embedding,
56
- ...hostConfig.embedding,
57
- options: {
58
- ...(envConfig.embedding.options || {}),
59
- ...(hostConfig.embedding.options || {}),
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,
@@ -87,13 +86,13 @@ export class ConfigResolver {
87
86
  */
88
87
  static validate(config: RagConfig): void {
89
88
  if (!config.projectId) {
90
- throw new ConfigurationException('[ConfigResolver] projectId is required');
89
+ throw new Error('[ConfigResolver] projectId is required');
91
90
  }
92
91
  if (!config.vectorDb.provider) {
93
- throw new ConfigurationException('[ConfigResolver] vectorDb.provider is required');
92
+ throw new Error('[ConfigResolver] vectorDb.provider is required');
94
93
  }
95
94
  if (!config.llm.provider) {
96
- throw new ConfigurationException('[ConfigResolver] llm.provider is required');
95
+ throw new Error('[ConfigResolver] llm.provider is required');
97
96
  }
98
97
  }
99
98
 
@@ -2,6 +2,7 @@ import { BaseVectorProvider } from '../providers/vectordb/BaseVectorProvider';
2
2
  import { BaseGraphProvider } from '../providers/graphdb/BaseGraphProvider';
3
3
  import { ILLMProvider } from '../llm/ILLMProvider';
4
4
  import { ChatMessage } from '../types';
5
+ import { EmbeddingFailedException } from '../exceptions';
5
6
  import { DocumentChunker, Chunk } from '../rag/DocumentChunker';
6
7
  import { EntityExtractor } from '../rag/EntityExtractor';
7
8
  import { Reranker } from '../rag/Reranker';
@@ -327,7 +328,7 @@ You are a helpful assistant. Use the provided context to answer questions accura
327
328
  );
328
329
 
329
330
  if (vectors.length !== chunks.length) {
330
- throw new Error(
331
+ throw new EmbeddingFailedException(
331
332
  `[Pipeline] Embedding mismatch: got ${vectors.length} vectors for ${chunks.length} chunks. ` +
332
333
  `Check embedding provider logs for individual chunk failures.`
333
334
  );
@@ -10,7 +10,7 @@ import { ProviderNotFoundException } from '../exceptions';
10
10
  * ProviderRegistry — dynamic provider loader for Vector DBs and LLMs.
11
11
  */
12
12
  type VectorProviderClass = {
13
- new (config: VectorDBConfig): BaseVectorProvider;
13
+ new(config: VectorDBConfig): BaseVectorProvider;
14
14
  getValidator?: () => IProviderValidator;
15
15
  getHealthChecker?: () => IProviderHealthChecker;
16
16
  };
@@ -20,10 +20,10 @@ type GraphProviderClass = new (config: GraphDBConfig) => BaseGraphProvider;
20
20
  export class ProviderRegistry {
21
21
  private static vectorProviders: Record<string, VectorProviderClass> = {};
22
22
  private static graphProviders: Record<string, GraphProviderClass> = {};
23
-
23
+
24
24
  private static vectorValidators: Record<string, IProviderValidator> = {};
25
25
  private static vectorHealthCheckers: Record<string, IProviderHealthChecker> = {};
26
-
26
+
27
27
  private static llmValidators: Record<string, IProviderValidator> = {};
28
28
  private static llmHealthCheckers: Record<string, IProviderHealthChecker> = {};
29
29
 
@@ -39,7 +39,7 @@ export class ProviderRegistry {
39
39
 
40
40
  static async getVectorValidator(provider: string): Promise<IProviderValidator | null> {
41
41
  if (this.vectorValidators[provider]) return this.vectorValidators[provider];
42
-
42
+
43
43
  // Try to load built-in validator
44
44
  try {
45
45
  const providerClass = await this.loadVectorProviderClass(provider);
@@ -55,7 +55,7 @@ export class ProviderRegistry {
55
55
 
56
56
  static async getVectorHealthChecker(provider: string): Promise<IProviderHealthChecker | null> {
57
57
  if (this.vectorHealthCheckers[provider]) return this.vectorHealthCheckers[provider];
58
-
58
+
59
59
  try {
60
60
  const providerClass = await this.loadVectorProviderClass(provider);
61
61
  if (providerClass.getHealthChecker) {