@retrivora-ai/rag-engine 1.9.3 → 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 (69) hide show
  1. package/README.md +59 -7
  2. package/dist/{ILLMProvider-Bw2A28nU.d.mts → ILLMProvider-Bhk6zJOK.d.mts} +43 -7
  3. package/dist/{ILLMProvider-Bw2A28nU.d.ts → ILLMProvider-Bhk6zJOK.d.ts} +43 -7
  4. package/dist/handlers/index.d.mts +2 -2
  5. package/dist/handlers/index.d.ts +2 -2
  6. package/dist/handlers/index.js +737 -237
  7. package/dist/handlers/index.mjs +736 -237
  8. package/dist/index-B9J_XEh0.d.ts +187 -0
  9. package/dist/index-BJ4cd-t5.d.mts +187 -0
  10. package/dist/{index-B70ZLkfG.d.mts → index-Bu7T6xgr.d.ts} +20 -3
  11. package/dist/{index-DVu-mkAM.d.ts → index-C3SVtPYg.d.mts} +20 -3
  12. package/dist/index.css +237 -10
  13. package/dist/index.d.mts +13 -5
  14. package/dist/index.d.ts +13 -5
  15. package/dist/index.js +365 -164
  16. package/dist/index.mjs +350 -158
  17. package/dist/server.d.mts +15 -94
  18. package/dist/server.d.ts +15 -94
  19. package/dist/server.js +850 -239
  20. package/dist/server.mjs +839 -238
  21. package/package.json +2 -4
  22. package/src/app/api/chat/route.ts +2 -2
  23. package/src/app/api/health/route.ts +3 -2
  24. package/src/app/api/ingest/route.ts +3 -2
  25. package/src/app/api/suggestions/route.ts +3 -2
  26. package/src/app/api/upload/route.ts +3 -2
  27. package/src/app/constants.tsx +168 -148
  28. package/src/app/layout.tsx +5 -18
  29. package/src/app/types.ts +17 -17
  30. package/src/components/ChatWidget.tsx +3 -1
  31. package/src/components/ChatWindow.tsx +5 -1
  32. package/src/components/DocViewer.tsx +71 -5
  33. package/src/components/Documentation.tsx +74 -11
  34. package/src/components/MessageBubble.tsx +39 -2
  35. package/src/components/ThinkingBlock.tsx +75 -0
  36. package/src/components/VisualizationRenderer.tsx +27 -1
  37. package/src/components/constants.tsx +275 -0
  38. package/src/config/RagConfig.ts +47 -0
  39. package/src/config/constants.ts +1 -0
  40. package/src/config/serverConfig.ts +25 -0
  41. package/src/core/ConfigResolver.ts +73 -22
  42. package/src/core/ConfigValidator.ts +2 -1
  43. package/src/core/Pipeline.ts +226 -68
  44. package/src/core/ProviderRegistry.ts +16 -7
  45. package/src/core/QueryProcessor.ts +38 -4
  46. package/src/core/Retrivora.ts +91 -0
  47. package/src/core/VectorPlugin.ts +62 -8
  48. package/src/exceptions/index.ts +111 -0
  49. package/src/handlers/index.ts +73 -0
  50. package/src/hooks/useRagChat.ts +30 -5
  51. package/src/index.ts +27 -1
  52. package/src/lib/plugin.ts +24 -0
  53. package/src/llm/LLMFactory.ts +8 -4
  54. package/src/llm/providers/AnthropicProvider.ts +70 -20
  55. package/src/llm/providers/GeminiProvider.ts +14 -15
  56. package/src/llm/providers/OllamaProvider.ts +13 -16
  57. package/src/llm/providers/OpenAIProvider.ts +9 -14
  58. package/src/llm/providers/UniversalLLMAdapter.ts +5 -5
  59. package/src/llm/utils.ts +46 -0
  60. package/src/providers/vectordb/MongoDBProvider.ts +9 -4
  61. package/src/providers/vectordb/MultiTablePostgresProvider.ts +45 -13
  62. package/src/rag/EntityExtractor.ts +2 -2
  63. package/src/rag/Reranker.ts +9 -16
  64. package/src/server.ts +30 -1
  65. package/src/types/chat.ts +9 -0
  66. package/src/types/props.ts +38 -1
  67. package/src/utils/UITransformer.ts +73 -4
  68. package/dist/DocumentChunker-Dh9TvmGG.d.mts +0 -45
  69. package/dist/DocumentChunker-Dh9TvmGG.d.ts +0 -45
@@ -0,0 +1,187 @@
1
+ import { k as RagConfig, I as ILLMProvider, g as IngestDocument, C as ChatMessage, d as ChatResponse, u as RetrievalResult, n as UniversalRagConfig } from './ILLMProvider-Bhk6zJOK.js';
2
+
3
+ /**
4
+ * DocumentChunker — splits long text into overlapping chunks
5
+ * suitable for vector embedding and retrieval.
6
+ *
7
+ * Strategy: sentence-aware sliding window
8
+ * 1. Split on sentence boundaries
9
+ * 2. Accumulate sentences into chunks up to `chunkSize` characters
10
+ * 3. Carry over `chunkOverlap` characters from the previous chunk
11
+ */
12
+ interface Chunk {
13
+ id: string;
14
+ content: string;
15
+ metadata?: Record<string, unknown>;
16
+ }
17
+ interface ChunkOptions {
18
+ /** Target chunk size in characters (default 1000) */
19
+ chunkSize?: number;
20
+ /** Overlap between consecutive chunks in characters (default 200) */
21
+ chunkOverlap?: number;
22
+ /** Source document identifier used as ID prefix */
23
+ docId?: string | number;
24
+ /** Extra metadata to attach to every chunk */
25
+ metadata?: Record<string, unknown>;
26
+ /** Characters used to split text, in order of priority */
27
+ separators?: string[];
28
+ }
29
+ declare class DocumentChunker {
30
+ private readonly chunkSize;
31
+ private readonly chunkOverlap;
32
+ private readonly separators;
33
+ constructor(chunkSize?: number, chunkOverlap?: number, separators?: string[]);
34
+ /**
35
+ * Split a single text string into overlapping chunks using a recursive strategy.
36
+ * Preserves structural boundaries (Markdown headers) where possible.
37
+ */
38
+ chunk(text: string, options?: ChunkOptions): Chunk[];
39
+ private recursiveSplit;
40
+ chunkMany(documents: Array<{
41
+ content: string;
42
+ docId?: string | number;
43
+ metadata?: Record<string, unknown>;
44
+ }>): Chunk[];
45
+ }
46
+
47
+ /**
48
+ * Pipeline — orchestrates the RAG flow: Embed → Search → Augment → Generate.
49
+ *
50
+ * Features:
51
+ * - Lazy initialization of providers
52
+ * - Batch processing with retry logic
53
+ * - Smart embedding strategy (integrated / separate / external)
54
+ * - Error recovery for transient failures
55
+ * - Multi-tenancy support via namespacing
56
+ * - LRU-bounded embedding cache (max 500 entries, prevents memory leaks)
57
+ * - Full observability tracing (latency, tokens, hallucination scoring)
58
+ */
59
+ declare class Pipeline {
60
+ private config;
61
+ private vectorDB;
62
+ private graphDB?;
63
+ private llmProvider;
64
+ private embeddingProvider;
65
+ private llmRouter;
66
+ private chunker;
67
+ private llamaIngestor?;
68
+ private entityExtractor?;
69
+ private reranker;
70
+ private agent?;
71
+ /** LRU-bounded cache: avoids re-embedding identical queries within the same process. */
72
+ private embeddingCache;
73
+ private initialised;
74
+ constructor(config: RagConfig);
75
+ /**
76
+ * Expose the underlying LLM provider (set after initialize()).
77
+ * Used by the stream handler to pass to UITransformer.analyzeAndDecide().
78
+ */
79
+ getLLMProvider(): ILLMProvider | undefined;
80
+ initialize(): Promise<void>;
81
+ /**
82
+ * Ingest documents with automatic chunking, embedding, and batch upsert.
83
+ */
84
+ ingest(documents: IngestDocument[], namespace?: string): Promise<Array<{
85
+ docId: string | number;
86
+ chunksIngested: number;
87
+ }>>;
88
+ /** Step 1: Chunk the document content. */
89
+ private prepareChunks;
90
+ /**
91
+ * Step 2: Generate embeddings for chunks with retry logic.
92
+ * Uses batchEmbed when available for efficiency; falls back to sequential embedding.
93
+ */
94
+ private processEmbeddings;
95
+ /** Step 3: Upsert chunks to vector database with retry logic. */
96
+ private processUpserts;
97
+ /** Step 4: Optional graph-based entity extraction and ingestion. */
98
+ private processGraphIngestion;
99
+ ask(question: string, history?: ChatMessage[], namespace?: string): Promise<ChatResponse>;
100
+ /**
101
+ * High-performance streaming RAG flow.
102
+ * Yields text chunks first, then the retrieval metadata + observability trace at the end.
103
+ *
104
+ * Latency optimizations:
105
+ * - Strategy classification runs in parallel with query embedding (saves ~400ms)
106
+ * - Hallucination scoring is fire-and-forget (doesn't block metadata yield)
107
+ * - UITransformation is computed after text streaming and emitted with metadata
108
+ * - SchemaMapper.train runs while answer generation streams
109
+ */
110
+ askStream(question: string, history?: ChatMessage[], namespace?: string): AsyncIterable<string | ChatResponse>;
111
+ /**
112
+ * Universal retrieval method combining all enabled providers.
113
+ * Uses an LRU-bounded embedding cache to avoid re-embedding the same query.
114
+ */
115
+ private generateUiTransformation;
116
+ private applyStructuredFilters;
117
+ private resolveNumericPredicateValue;
118
+ private extractNumericValueFromContent;
119
+ private matchesNumericPredicate;
120
+ private normalizeComparableField;
121
+ private fieldSimilarityScore;
122
+ private fieldTokens;
123
+ private toFiniteNumber;
124
+ retrieve(query: string, options: {
125
+ namespace?: string;
126
+ topK?: number;
127
+ filter?: Record<string, unknown>;
128
+ }): Promise<RetrievalResult>;
129
+ /** Rewrite the user query for better retrieval performance. */
130
+ private rewriteQuery;
131
+ /** Generate 3-5 short, relevant questions based on the vector database content. */
132
+ getSuggestions(query: string, namespace?: string): Promise<string[]>;
133
+ }
134
+
135
+ /**
136
+ * Public SDK facade matching the prompt-level Retrivora API.
137
+ *
138
+ * It keeps provider details behind configuration and delegates execution to the
139
+ * existing Pipeline implementation.
140
+ */
141
+ declare class Retrivora {
142
+ private readonly pipeline;
143
+ readonly config: RagConfig;
144
+ constructor(config?: UniversalRagConfig);
145
+ initialize(): Promise<void>;
146
+ ingest(documents: IngestDocument[], namespace?: string): Promise<Array<{
147
+ docId: string | number;
148
+ chunksIngested: number;
149
+ }>>;
150
+ ask(question: string, history?: ChatMessage[], namespace?: string): Promise<ChatResponse>;
151
+ askStream(question: string, history?: ChatMessage[], namespace?: string): AsyncIterable<string | ChatResponse>;
152
+ getPipeline(): Pipeline;
153
+ }
154
+
155
+ /**
156
+ * Named SDK exceptions make failures machine-readable for host applications.
157
+ */
158
+ type RetrivoraErrorCode = 'PROVIDER_NOT_FOUND' | 'EMBEDDING_FAILED' | 'RETRIEVAL_FAILED' | 'RATE_LIMITED' | 'CONFIGURATION_ERROR' | 'AUTHENTICATION_ERROR';
159
+ declare class RetrivoraError extends Error {
160
+ readonly code: RetrivoraErrorCode;
161
+ readonly details?: unknown;
162
+ constructor(message: string, code: RetrivoraErrorCode, details?: unknown);
163
+ }
164
+ declare class ProviderNotFoundException extends RetrivoraError {
165
+ constructor(providerType: string, provider: string, details?: unknown);
166
+ }
167
+ declare class EmbeddingFailedException extends RetrivoraError {
168
+ constructor(message?: string, details?: unknown);
169
+ }
170
+ declare class RetrievalException extends RetrivoraError {
171
+ constructor(message?: string, details?: unknown);
172
+ }
173
+ declare class RateLimitException extends RetrivoraError {
174
+ constructor(message?: string, details?: unknown);
175
+ }
176
+ declare class ConfigurationException extends RetrivoraError {
177
+ constructor(message: string, details?: unknown);
178
+ }
179
+ declare class AuthenticationException extends RetrivoraError {
180
+ constructor(message?: string, details?: unknown);
181
+ }
182
+ /**
183
+ * Wraps any unknown error into an appropriate RetrivoraError subclass.
184
+ */
185
+ declare function wrapError(err: unknown, defaultCode: RetrivoraErrorCode, defaultMessage?: string): RetrivoraError;
186
+
187
+ export { AuthenticationException as A, type Chunk as C, DocumentChunker as D, EmbeddingFailedException as E, ProviderNotFoundException as P, RateLimitException as R, type ChunkOptions as a, ConfigurationException as b, RetrievalException as c, Retrivora as d, RetrivoraError as e, type RetrivoraErrorCode as f, Pipeline as g, wrapError as w };
@@ -0,0 +1,187 @@
1
+ import { k as RagConfig, I as ILLMProvider, g as IngestDocument, C as ChatMessage, d as ChatResponse, u as RetrievalResult, n as UniversalRagConfig } from './ILLMProvider-Bhk6zJOK.mjs';
2
+
3
+ /**
4
+ * DocumentChunker — splits long text into overlapping chunks
5
+ * suitable for vector embedding and retrieval.
6
+ *
7
+ * Strategy: sentence-aware sliding window
8
+ * 1. Split on sentence boundaries
9
+ * 2. Accumulate sentences into chunks up to `chunkSize` characters
10
+ * 3. Carry over `chunkOverlap` characters from the previous chunk
11
+ */
12
+ interface Chunk {
13
+ id: string;
14
+ content: string;
15
+ metadata?: Record<string, unknown>;
16
+ }
17
+ interface ChunkOptions {
18
+ /** Target chunk size in characters (default 1000) */
19
+ chunkSize?: number;
20
+ /** Overlap between consecutive chunks in characters (default 200) */
21
+ chunkOverlap?: number;
22
+ /** Source document identifier used as ID prefix */
23
+ docId?: string | number;
24
+ /** Extra metadata to attach to every chunk */
25
+ metadata?: Record<string, unknown>;
26
+ /** Characters used to split text, in order of priority */
27
+ separators?: string[];
28
+ }
29
+ declare class DocumentChunker {
30
+ private readonly chunkSize;
31
+ private readonly chunkOverlap;
32
+ private readonly separators;
33
+ constructor(chunkSize?: number, chunkOverlap?: number, separators?: string[]);
34
+ /**
35
+ * Split a single text string into overlapping chunks using a recursive strategy.
36
+ * Preserves structural boundaries (Markdown headers) where possible.
37
+ */
38
+ chunk(text: string, options?: ChunkOptions): Chunk[];
39
+ private recursiveSplit;
40
+ chunkMany(documents: Array<{
41
+ content: string;
42
+ docId?: string | number;
43
+ metadata?: Record<string, unknown>;
44
+ }>): Chunk[];
45
+ }
46
+
47
+ /**
48
+ * Pipeline — orchestrates the RAG flow: Embed → Search → Augment → Generate.
49
+ *
50
+ * Features:
51
+ * - Lazy initialization of providers
52
+ * - Batch processing with retry logic
53
+ * - Smart embedding strategy (integrated / separate / external)
54
+ * - Error recovery for transient failures
55
+ * - Multi-tenancy support via namespacing
56
+ * - LRU-bounded embedding cache (max 500 entries, prevents memory leaks)
57
+ * - Full observability tracing (latency, tokens, hallucination scoring)
58
+ */
59
+ declare class Pipeline {
60
+ private config;
61
+ private vectorDB;
62
+ private graphDB?;
63
+ private llmProvider;
64
+ private embeddingProvider;
65
+ private llmRouter;
66
+ private chunker;
67
+ private llamaIngestor?;
68
+ private entityExtractor?;
69
+ private reranker;
70
+ private agent?;
71
+ /** LRU-bounded cache: avoids re-embedding identical queries within the same process. */
72
+ private embeddingCache;
73
+ private initialised;
74
+ constructor(config: RagConfig);
75
+ /**
76
+ * Expose the underlying LLM provider (set after initialize()).
77
+ * Used by the stream handler to pass to UITransformer.analyzeAndDecide().
78
+ */
79
+ getLLMProvider(): ILLMProvider | undefined;
80
+ initialize(): Promise<void>;
81
+ /**
82
+ * Ingest documents with automatic chunking, embedding, and batch upsert.
83
+ */
84
+ ingest(documents: IngestDocument[], namespace?: string): Promise<Array<{
85
+ docId: string | number;
86
+ chunksIngested: number;
87
+ }>>;
88
+ /** Step 1: Chunk the document content. */
89
+ private prepareChunks;
90
+ /**
91
+ * Step 2: Generate embeddings for chunks with retry logic.
92
+ * Uses batchEmbed when available for efficiency; falls back to sequential embedding.
93
+ */
94
+ private processEmbeddings;
95
+ /** Step 3: Upsert chunks to vector database with retry logic. */
96
+ private processUpserts;
97
+ /** Step 4: Optional graph-based entity extraction and ingestion. */
98
+ private processGraphIngestion;
99
+ ask(question: string, history?: ChatMessage[], namespace?: string): Promise<ChatResponse>;
100
+ /**
101
+ * High-performance streaming RAG flow.
102
+ * Yields text chunks first, then the retrieval metadata + observability trace at the end.
103
+ *
104
+ * Latency optimizations:
105
+ * - Strategy classification runs in parallel with query embedding (saves ~400ms)
106
+ * - Hallucination scoring is fire-and-forget (doesn't block metadata yield)
107
+ * - UITransformation is computed after text streaming and emitted with metadata
108
+ * - SchemaMapper.train runs while answer generation streams
109
+ */
110
+ askStream(question: string, history?: ChatMessage[], namespace?: string): AsyncIterable<string | ChatResponse>;
111
+ /**
112
+ * Universal retrieval method combining all enabled providers.
113
+ * Uses an LRU-bounded embedding cache to avoid re-embedding the same query.
114
+ */
115
+ private generateUiTransformation;
116
+ private applyStructuredFilters;
117
+ private resolveNumericPredicateValue;
118
+ private extractNumericValueFromContent;
119
+ private matchesNumericPredicate;
120
+ private normalizeComparableField;
121
+ private fieldSimilarityScore;
122
+ private fieldTokens;
123
+ private toFiniteNumber;
124
+ retrieve(query: string, options: {
125
+ namespace?: string;
126
+ topK?: number;
127
+ filter?: Record<string, unknown>;
128
+ }): Promise<RetrievalResult>;
129
+ /** Rewrite the user query for better retrieval performance. */
130
+ private rewriteQuery;
131
+ /** Generate 3-5 short, relevant questions based on the vector database content. */
132
+ getSuggestions(query: string, namespace?: string): Promise<string[]>;
133
+ }
134
+
135
+ /**
136
+ * Public SDK facade matching the prompt-level Retrivora API.
137
+ *
138
+ * It keeps provider details behind configuration and delegates execution to the
139
+ * existing Pipeline implementation.
140
+ */
141
+ declare class Retrivora {
142
+ private readonly pipeline;
143
+ readonly config: RagConfig;
144
+ constructor(config?: UniversalRagConfig);
145
+ initialize(): Promise<void>;
146
+ ingest(documents: IngestDocument[], namespace?: string): Promise<Array<{
147
+ docId: string | number;
148
+ chunksIngested: number;
149
+ }>>;
150
+ ask(question: string, history?: ChatMessage[], namespace?: string): Promise<ChatResponse>;
151
+ askStream(question: string, history?: ChatMessage[], namespace?: string): AsyncIterable<string | ChatResponse>;
152
+ getPipeline(): Pipeline;
153
+ }
154
+
155
+ /**
156
+ * Named SDK exceptions make failures machine-readable for host applications.
157
+ */
158
+ type RetrivoraErrorCode = 'PROVIDER_NOT_FOUND' | 'EMBEDDING_FAILED' | 'RETRIEVAL_FAILED' | 'RATE_LIMITED' | 'CONFIGURATION_ERROR' | 'AUTHENTICATION_ERROR';
159
+ declare class RetrivoraError extends Error {
160
+ readonly code: RetrivoraErrorCode;
161
+ readonly details?: unknown;
162
+ constructor(message: string, code: RetrivoraErrorCode, details?: unknown);
163
+ }
164
+ declare class ProviderNotFoundException extends RetrivoraError {
165
+ constructor(providerType: string, provider: string, details?: unknown);
166
+ }
167
+ declare class EmbeddingFailedException extends RetrivoraError {
168
+ constructor(message?: string, details?: unknown);
169
+ }
170
+ declare class RetrievalException extends RetrivoraError {
171
+ constructor(message?: string, details?: unknown);
172
+ }
173
+ declare class RateLimitException extends RetrivoraError {
174
+ constructor(message?: string, details?: unknown);
175
+ }
176
+ declare class ConfigurationException extends RetrivoraError {
177
+ constructor(message: string, details?: unknown);
178
+ }
179
+ declare class AuthenticationException extends RetrivoraError {
180
+ constructor(message?: string, details?: unknown);
181
+ }
182
+ /**
183
+ * Wraps any unknown error into an appropriate RetrivoraError subclass.
184
+ */
185
+ declare function wrapError(err: unknown, defaultCode: RetrivoraErrorCode, defaultMessage?: string): RetrivoraError;
186
+
187
+ export { AuthenticationException as A, type Chunk as C, DocumentChunker as D, EmbeddingFailedException as E, ProviderNotFoundException as P, RateLimitException as R, type ChunkOptions as a, ConfigurationException as b, RetrievalException as c, Retrivora as d, RetrivoraError as e, type RetrivoraErrorCode as f, Pipeline as g, wrapError as w };
@@ -1,4 +1,4 @@
1
- import { k as RagConfig, I as ILLMProvider, C as ChatMessage, d as ChatResponse, g as IngestDocument } from './ILLMProvider-Bw2A28nU.mjs';
1
+ import { k as RagConfig, I as ILLMProvider, C as ChatMessage, d as ChatResponse, g as IngestDocument } from './ILLMProvider-Bhk6zJOK.js';
2
2
  import { NextRequest, NextResponse } from 'next/server';
3
3
 
4
4
  interface ValidationError {
@@ -110,7 +110,7 @@ declare class VectorPlugin {
110
110
  /**
111
111
  * Run a streaming chat query.
112
112
  */
113
- chatStream(message: string, history?: ChatMessage[], namespace?: string): AsyncGenerator<string | ChatResponse, void, any>;
113
+ chatStream(message: string, history?: ChatMessage[], namespace?: string): AsyncGenerator<string | ChatResponse, void, unknown>;
114
114
  /**
115
115
  * Ingest documents into the vector database.
116
116
  */
@@ -224,5 +224,22 @@ declare function createSuggestionsHandler(configOrPlugin?: Partial<RagConfig> |
224
224
  }> | NextResponse<{
225
225
  suggestions: string[];
226
226
  }>>;
227
+ /**
228
+ * createRagHandler — factory that returns GET and POST handlers for a catch-all route
229
+ * (e.g. `src/app/api/retrivora/[[...retrivora]]/route.ts`).
230
+ */
231
+ declare function createRagHandler(configOrPlugin?: Partial<RagConfig> | VectorPlugin): {
232
+ GET: (req: NextRequest, context: any) => Promise<NextResponse<{
233
+ timestamp: string;
234
+ vectorDb: HealthCheckResult;
235
+ llm: HealthCheckResult;
236
+ embedding?: HealthCheckResult;
237
+ allHealthy: boolean;
238
+ status: string;
239
+ }> | NextResponse<{
240
+ error: string;
241
+ }>>;
242
+ POST: (req: NextRequest, context: any) => Promise<Response>;
243
+ };
227
244
 
228
- export { ConfigValidator as C, type HealthCheckResult as H, type IProviderValidator as I, type ValidationError as V, type IProviderHealthChecker as a, VectorPlugin as b, createChatHandler as c, createHealthHandler as d, createIngestHandler as e, createStreamHandler as f, createUploadHandler as g, sseFrame as h, sseMetaFrame as i, sseTextFrame as j, createSuggestionsHandler as k, sseObservabilityFrame as l, sseUIFrame as m, sseErrorFrame as s };
245
+ export { ConfigValidator as C, type HealthCheckResult as H, type IProviderValidator as I, type ValidationError as V, type IProviderHealthChecker as a, VectorPlugin as b, createChatHandler as c, createHealthHandler as d, createIngestHandler as e, createRagHandler as f, createStreamHandler as g, createUploadHandler as h, sseFrame as i, sseMetaFrame as j, sseTextFrame as k, createSuggestionsHandler as l, sseObservabilityFrame as m, sseUIFrame as n, sseErrorFrame as s };
@@ -1,4 +1,4 @@
1
- import { k as RagConfig, I as ILLMProvider, C as ChatMessage, d as ChatResponse, g as IngestDocument } from './ILLMProvider-Bw2A28nU.js';
1
+ import { k as RagConfig, I as ILLMProvider, C as ChatMessage, d as ChatResponse, g as IngestDocument } from './ILLMProvider-Bhk6zJOK.mjs';
2
2
  import { NextRequest, NextResponse } from 'next/server';
3
3
 
4
4
  interface ValidationError {
@@ -110,7 +110,7 @@ declare class VectorPlugin {
110
110
  /**
111
111
  * Run a streaming chat query.
112
112
  */
113
- chatStream(message: string, history?: ChatMessage[], namespace?: string): AsyncGenerator<string | ChatResponse, void, any>;
113
+ chatStream(message: string, history?: ChatMessage[], namespace?: string): AsyncGenerator<string | ChatResponse, void, unknown>;
114
114
  /**
115
115
  * Ingest documents into the vector database.
116
116
  */
@@ -224,5 +224,22 @@ declare function createSuggestionsHandler(configOrPlugin?: Partial<RagConfig> |
224
224
  }> | NextResponse<{
225
225
  suggestions: string[];
226
226
  }>>;
227
+ /**
228
+ * createRagHandler — factory that returns GET and POST handlers for a catch-all route
229
+ * (e.g. `src/app/api/retrivora/[[...retrivora]]/route.ts`).
230
+ */
231
+ declare function createRagHandler(configOrPlugin?: Partial<RagConfig> | VectorPlugin): {
232
+ GET: (req: NextRequest, context: any) => Promise<NextResponse<{
233
+ timestamp: string;
234
+ vectorDb: HealthCheckResult;
235
+ llm: HealthCheckResult;
236
+ embedding?: HealthCheckResult;
237
+ allHealthy: boolean;
238
+ status: string;
239
+ }> | NextResponse<{
240
+ error: string;
241
+ }>>;
242
+ POST: (req: NextRequest, context: any) => Promise<Response>;
243
+ };
227
244
 
228
- export { ConfigValidator as C, type HealthCheckResult as H, type IProviderValidator as I, type ValidationError as V, type IProviderHealthChecker as a, VectorPlugin as b, createChatHandler as c, createHealthHandler as d, createIngestHandler as e, createStreamHandler as f, createUploadHandler as g, sseFrame as h, sseMetaFrame as i, sseTextFrame as j, createSuggestionsHandler as k, sseObservabilityFrame as l, sseUIFrame as m, sseErrorFrame as s };
245
+ export { ConfigValidator as C, type HealthCheckResult as H, type IProviderValidator as I, type ValidationError as V, type IProviderHealthChecker as a, VectorPlugin as b, createChatHandler as c, createHealthHandler as d, createIngestHandler as e, createRagHandler as f, createStreamHandler as g, createUploadHandler as h, sseFrame as i, sseMetaFrame as j, sseTextFrame as k, createSuggestionsHandler as l, sseObservabilityFrame as m, sseUIFrame as n, sseErrorFrame as s };