@retrivora-ai/rag-engine 1.8.1 → 1.8.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{ILLMProvider-BfRgI1Xh.d.mts → ILLMProvider-BOJFz3Na.d.mts} +47 -1
- package/dist/{ILLMProvider-BfRgI1Xh.d.ts → ILLMProvider-BOJFz3Na.d.ts} +47 -1
- package/dist/handlers/index.d.mts +2 -2
- package/dist/handlers/index.d.ts +2 -2
- package/dist/handlers/index.js +509 -162
- package/dist/handlers/index.mjs +5849 -15
- package/dist/{index-1Z4GuYBi.d.ts → index-BwpcaziY.d.ts} +4 -2
- package/dist/{index-BV0z5mb6.d.mts → index-D3V9Et2M.d.mts} +4 -2
- package/dist/index.d.mts +30 -16
- package/dist/index.d.ts +30 -16
- package/dist/index.js +1999 -1210
- package/dist/index.mjs +2041 -1205
- package/dist/server.d.mts +21 -25
- package/dist/server.d.ts +21 -25
- package/dist/server.js +536 -163
- package/dist/server.mjs +5923 -67
- package/package.json +9 -7
- package/src/app/api/upload/route.ts +4 -0
- package/src/app/constants.tsx +2 -2
- package/src/app/globals.css +35 -11
- package/src/app/page.tsx +12 -321
- package/src/components/AmbientBackground.tsx +29 -0
- package/src/components/ArchitectureCard.tsx +17 -0
- package/src/components/ArchitectureCardsSection.tsx +15 -0
- package/src/components/ChatWidget.tsx +0 -1
- package/src/components/ChatWindow.tsx +32 -0
- package/src/components/CodeViewer.tsx +51 -0
- package/src/components/ConfigProvider.tsx +1 -0
- package/src/components/DocViewer.tsx +37 -0
- package/src/components/DocumentUpload.tsx +44 -1
- package/src/components/Documentation.tsx +58 -0
- package/src/components/DynamicChart.tsx +27 -2
- package/src/components/Hero.tsx +59 -0
- package/src/components/HourglassLoader.tsx +87 -0
- package/src/components/Lifecycle.tsx +37 -0
- package/src/components/MarkdownComponents.tsx +143 -0
- package/src/components/MessageBubble.tsx +91 -1012
- package/src/components/Navbar.tsx +55 -0
- package/src/components/ObservabilityPanel.tsx +374 -0
- package/src/components/ProductCard.tsx +3 -1
- package/src/components/UIDispatcher.tsx +341 -0
- package/src/components/VisualizationRenderer.tsx +48 -26
- package/src/config/ConfigBuilder.ts +38 -1
- package/src/core/LangChainAgent.ts +1 -4
- package/src/core/Pipeline.ts +209 -86
- package/src/core/QueryProcessor.ts +65 -0
- package/src/handlers/index.ts +72 -12
- package/src/hooks/useRagChat.ts +19 -9
- package/src/index.ts +9 -1
- package/src/providers/vectordb/MultiTablePostgresProvider.ts +150 -64
- package/src/rag/Reranker.ts +99 -6
- package/src/types/chat.ts +2 -0
- package/src/types/index.ts +52 -0
- package/src/types/props.ts +9 -1
- package/src/utils/ProductExtractor.ts +347 -0
- package/src/utils/UITransformer.ts +4 -53
- package/src/utils/synonyms.ts +78 -0
- package/dist/ChromaDBProvider-MIDOR4FW.mjs +0 -8
- package/dist/MilvusProvider-U7SKC27V.mjs +0 -8
- package/dist/MongoDBProvider-YNKC7EJ6.mjs +0 -8
- package/dist/MultiTablePostgresProvider-YY7LPNJK.mjs +0 -8
- package/dist/PineconeProvider-QZNRKTN2.mjs +0 -8
- package/dist/QdrantProvider-RLJTNGPY.mjs +0 -8
- package/dist/RedisProvider-SR65SCKV.mjs +0 -8
- package/dist/SimpleGraphProvider-SLOXO4M7.mjs +0 -62
- package/dist/UniversalVectorProvider-IN67OS56.mjs +0 -9
- package/dist/WeaviateProvider-5FWDFITI.mjs +0 -8
- package/dist/chunk-5AJ4XHLW.mjs +0 -201
- package/dist/chunk-5YGUXK7Z.mjs +0 -80
- package/dist/chunk-BFYLQYQU.mjs +0 -3985
- package/dist/chunk-CFVEZTBJ.mjs +0 -102
- package/dist/chunk-IMP6FUCY.mjs +0 -30
- package/dist/chunk-LR3VMDVK.mjs +0 -157
- package/dist/chunk-M6JSPGAR.mjs +0 -117
- package/dist/chunk-PSFPZXHX.mjs +0 -245
- package/dist/chunk-R3RGUMHE.mjs +0 -218
- package/dist/chunk-U55XRW3U.mjs +0 -96
- package/dist/chunk-VUQJVIJT.mjs +0 -148
- package/dist/chunk-X4TOT24V.mjs +0 -89
- package/dist/chunk-YLTMFW4M.mjs +0 -49
package/dist/server.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { n as VectorDBConfig, L as LLMConfig, e as EmbeddingConfig, k as RagConfig, I as ILLMProvider, g as IngestDocument, C as ChatMessage, d as ChatResponse, p as RetrievalResult, m as UpsertDocument, V as VectorMatch, G as GraphDBConfig, q as GraphNode, r as Edge, s as GraphSearchResult, o as VectorDBProvider, h as LLMProvider, f as EmbeddingProvider, j as RAGConfig, U as UIConfig, c as ChatOptions, E as EmbedOptions } from './ILLMProvider-BOJFz3Na.mjs';
|
|
2
2
|
export { C as Chunk, a as ChunkOptions, D as DocumentChunker } from './DocumentChunker-Dh9TvmGG.mjs';
|
|
3
|
-
import { H as HealthCheckResult, I as IProviderValidator, a as IProviderHealthChecker } from './index-
|
|
4
|
-
export { C as ConfigValidator, V as ValidationError, b as VectorPlugin, c as createChatHandler, d as createHealthHandler, e as createIngestHandler, f as createStreamHandler, g as createUploadHandler, s as sseErrorFrame, h as sseFrame, i as sseMetaFrame, j as sseTextFrame } from './index-
|
|
3
|
+
import { H as HealthCheckResult, I as IProviderValidator, a as IProviderHealthChecker } from './index-D3V9Et2M.mjs';
|
|
4
|
+
export { C as ConfigValidator, V as ValidationError, b as VectorPlugin, c as createChatHandler, d as createHealthHandler, e as createIngestHandler, f as createStreamHandler, g as createUploadHandler, s as sseErrorFrame, h as sseFrame, i as sseMetaFrame, j as sseTextFrame } from './index-D3V9Et2M.mjs';
|
|
5
5
|
import 'next/server';
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -105,6 +105,7 @@ declare class ProviderHealthCheck {
|
|
|
105
105
|
* - Error recovery for transient failures
|
|
106
106
|
* - Multi-tenancy support via namespacing
|
|
107
107
|
* - LRU-bounded embedding cache (max 500 entries, prevents memory leaks)
|
|
108
|
+
* - Full observability tracing (latency, tokens, hallucination scoring)
|
|
108
109
|
*/
|
|
109
110
|
declare class Pipeline {
|
|
110
111
|
private config;
|
|
@@ -129,33 +130,26 @@ declare class Pipeline {
|
|
|
129
130
|
initialize(): Promise<void>;
|
|
130
131
|
/**
|
|
131
132
|
* Ingest documents with automatic chunking, embedding, and batch upsert.
|
|
132
|
-
* Handles retries for transient failures.
|
|
133
133
|
*/
|
|
134
134
|
ingest(documents: IngestDocument[], namespace?: string): Promise<Array<{
|
|
135
135
|
docId: string | number;
|
|
136
136
|
chunksIngested: number;
|
|
137
137
|
}>>;
|
|
138
|
-
/**
|
|
139
|
-
* Step 1: Chunk the document content.
|
|
140
|
-
*/
|
|
138
|
+
/** Step 1: Chunk the document content. */
|
|
141
139
|
private prepareChunks;
|
|
142
140
|
/**
|
|
143
141
|
* Step 2: Generate embeddings for chunks with retry logic.
|
|
144
142
|
* Uses batchEmbed when available for efficiency; falls back to sequential embedding.
|
|
145
143
|
*/
|
|
146
144
|
private processEmbeddings;
|
|
147
|
-
/**
|
|
148
|
-
* Step 3: Upsert chunks to vector database with retry logic.
|
|
149
|
-
*/
|
|
145
|
+
/** Step 3: Upsert chunks to vector database with retry logic. */
|
|
150
146
|
private processUpserts;
|
|
151
|
-
/**
|
|
152
|
-
* Step 4: Optional graph-based entity extraction and ingestion.
|
|
153
|
-
*/
|
|
147
|
+
/** Step 4: Optional graph-based entity extraction and ingestion. */
|
|
154
148
|
private processGraphIngestion;
|
|
155
149
|
ask(question: string, history?: ChatMessage[], namespace?: string): Promise<ChatResponse>;
|
|
156
150
|
/**
|
|
157
151
|
* High-performance streaming RAG flow.
|
|
158
|
-
* Yields text chunks first, then the retrieval metadata at the end.
|
|
152
|
+
* Yields text chunks first, then the retrieval metadata + observability trace at the end.
|
|
159
153
|
*/
|
|
160
154
|
askStream(question: string, history?: ChatMessage[], namespace?: string): AsyncIterable<string | ChatResponse>;
|
|
161
155
|
/**
|
|
@@ -168,13 +162,9 @@ declare class Pipeline {
|
|
|
168
162
|
topK?: number;
|
|
169
163
|
filter?: Record<string, unknown>;
|
|
170
164
|
}): Promise<RetrievalResult>;
|
|
171
|
-
/**
|
|
172
|
-
* Rewrite the user query for better retrieval performance.
|
|
173
|
-
*/
|
|
165
|
+
/** Rewrite the user query for better retrieval performance. */
|
|
174
166
|
private rewriteQuery;
|
|
175
|
-
/**
|
|
176
|
-
* Generate 3-5 short, relevant questions based on the vector database content.
|
|
177
|
-
*/
|
|
167
|
+
/** Generate 3-5 short, relevant questions based on the vector database content. */
|
|
178
168
|
getSuggestions(query: string, namespace?: string): Promise<string[]>;
|
|
179
169
|
}
|
|
180
170
|
|
|
@@ -363,6 +353,7 @@ declare class ConfigBuilder {
|
|
|
363
353
|
private _embedding?;
|
|
364
354
|
private _ui?;
|
|
365
355
|
private _rag?;
|
|
356
|
+
private _graphDb?;
|
|
366
357
|
/**
|
|
367
358
|
* Set the project/application ID for namespacing
|
|
368
359
|
*/
|
|
@@ -379,6 +370,10 @@ declare class ConfigBuilder {
|
|
|
379
370
|
* Configure the embedding provider
|
|
380
371
|
*/
|
|
381
372
|
embedding(provider: EmbeddingProvider | 'auto', model?: string, apiKey?: string, options?: Record<string, unknown>): this;
|
|
373
|
+
/**
|
|
374
|
+
* Configure the graph database provider
|
|
375
|
+
*/
|
|
376
|
+
graphDb(provider: string | 'auto', options?: Record<string, unknown>): this;
|
|
382
377
|
/**
|
|
383
378
|
* Set RAG-specific pipeline parameters
|
|
384
379
|
*/
|
|
@@ -400,6 +395,7 @@ declare class ConfigBuilder {
|
|
|
400
395
|
private _autoDetectVectorDb;
|
|
401
396
|
private _autoDetectLLM;
|
|
402
397
|
private _autoDetectEmbedding;
|
|
398
|
+
private _autoDetectGraphDb;
|
|
403
399
|
}
|
|
404
400
|
/**
|
|
405
401
|
* Preset configurations for common provider combinations
|
|
@@ -664,17 +660,17 @@ declare class MultiTablePostgresProvider extends BaseVectorProvider {
|
|
|
664
660
|
private readonly connectionString;
|
|
665
661
|
private tables;
|
|
666
662
|
private searchFields;
|
|
663
|
+
private readonly uploadTable;
|
|
667
664
|
constructor(config: VectorDBConfig);
|
|
668
665
|
initialize(): Promise<void>;
|
|
669
666
|
/**
|
|
670
|
-
* Upsert
|
|
671
|
-
* searching across pre-existing tables with varying schemas.
|
|
667
|
+
* Upsert a document by dynamically provisioning a table and columns.
|
|
672
668
|
*/
|
|
673
|
-
upsert(
|
|
669
|
+
upsert(doc: UpsertDocument, namespace?: string): Promise<void>;
|
|
674
670
|
/**
|
|
675
|
-
* Batch upsert
|
|
671
|
+
* Batch upsert documents by dynamically provisioning tables and columns based on CSV headers.
|
|
676
672
|
*/
|
|
677
|
-
batchUpsert(
|
|
673
|
+
batchUpsert(docs: UpsertDocument[], namespace?: string): Promise<void>;
|
|
678
674
|
/**
|
|
679
675
|
* Query all configured tables and merge results, sorted by cosine similarity score.
|
|
680
676
|
*/
|
package/dist/server.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { n as VectorDBConfig, L as LLMConfig, e as EmbeddingConfig, k as RagConfig, I as ILLMProvider, g as IngestDocument, C as ChatMessage, d as ChatResponse, p as RetrievalResult, m as UpsertDocument, V as VectorMatch, G as GraphDBConfig, q as GraphNode, r as Edge, s as GraphSearchResult, o as VectorDBProvider, h as LLMProvider, f as EmbeddingProvider, j as RAGConfig, U as UIConfig, c as ChatOptions, E as EmbedOptions } from './ILLMProvider-BOJFz3Na.js';
|
|
2
2
|
export { C as Chunk, a as ChunkOptions, D as DocumentChunker } from './DocumentChunker-Dh9TvmGG.js';
|
|
3
|
-
import { H as HealthCheckResult, I as IProviderValidator, a as IProviderHealthChecker } from './index-
|
|
4
|
-
export { C as ConfigValidator, V as ValidationError, b as VectorPlugin, c as createChatHandler, d as createHealthHandler, e as createIngestHandler, f as createStreamHandler, g as createUploadHandler, s as sseErrorFrame, h as sseFrame, i as sseMetaFrame, j as sseTextFrame } from './index-
|
|
3
|
+
import { H as HealthCheckResult, I as IProviderValidator, a as IProviderHealthChecker } from './index-BwpcaziY.js';
|
|
4
|
+
export { C as ConfigValidator, V as ValidationError, b as VectorPlugin, c as createChatHandler, d as createHealthHandler, e as createIngestHandler, f as createStreamHandler, g as createUploadHandler, s as sseErrorFrame, h as sseFrame, i as sseMetaFrame, j as sseTextFrame } from './index-BwpcaziY.js';
|
|
5
5
|
import 'next/server';
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -105,6 +105,7 @@ declare class ProviderHealthCheck {
|
|
|
105
105
|
* - Error recovery for transient failures
|
|
106
106
|
* - Multi-tenancy support via namespacing
|
|
107
107
|
* - LRU-bounded embedding cache (max 500 entries, prevents memory leaks)
|
|
108
|
+
* - Full observability tracing (latency, tokens, hallucination scoring)
|
|
108
109
|
*/
|
|
109
110
|
declare class Pipeline {
|
|
110
111
|
private config;
|
|
@@ -129,33 +130,26 @@ declare class Pipeline {
|
|
|
129
130
|
initialize(): Promise<void>;
|
|
130
131
|
/**
|
|
131
132
|
* Ingest documents with automatic chunking, embedding, and batch upsert.
|
|
132
|
-
* Handles retries for transient failures.
|
|
133
133
|
*/
|
|
134
134
|
ingest(documents: IngestDocument[], namespace?: string): Promise<Array<{
|
|
135
135
|
docId: string | number;
|
|
136
136
|
chunksIngested: number;
|
|
137
137
|
}>>;
|
|
138
|
-
/**
|
|
139
|
-
* Step 1: Chunk the document content.
|
|
140
|
-
*/
|
|
138
|
+
/** Step 1: Chunk the document content. */
|
|
141
139
|
private prepareChunks;
|
|
142
140
|
/**
|
|
143
141
|
* Step 2: Generate embeddings for chunks with retry logic.
|
|
144
142
|
* Uses batchEmbed when available for efficiency; falls back to sequential embedding.
|
|
145
143
|
*/
|
|
146
144
|
private processEmbeddings;
|
|
147
|
-
/**
|
|
148
|
-
* Step 3: Upsert chunks to vector database with retry logic.
|
|
149
|
-
*/
|
|
145
|
+
/** Step 3: Upsert chunks to vector database with retry logic. */
|
|
150
146
|
private processUpserts;
|
|
151
|
-
/**
|
|
152
|
-
* Step 4: Optional graph-based entity extraction and ingestion.
|
|
153
|
-
*/
|
|
147
|
+
/** Step 4: Optional graph-based entity extraction and ingestion. */
|
|
154
148
|
private processGraphIngestion;
|
|
155
149
|
ask(question: string, history?: ChatMessage[], namespace?: string): Promise<ChatResponse>;
|
|
156
150
|
/**
|
|
157
151
|
* High-performance streaming RAG flow.
|
|
158
|
-
* Yields text chunks first, then the retrieval metadata at the end.
|
|
152
|
+
* Yields text chunks first, then the retrieval metadata + observability trace at the end.
|
|
159
153
|
*/
|
|
160
154
|
askStream(question: string, history?: ChatMessage[], namespace?: string): AsyncIterable<string | ChatResponse>;
|
|
161
155
|
/**
|
|
@@ -168,13 +162,9 @@ declare class Pipeline {
|
|
|
168
162
|
topK?: number;
|
|
169
163
|
filter?: Record<string, unknown>;
|
|
170
164
|
}): Promise<RetrievalResult>;
|
|
171
|
-
/**
|
|
172
|
-
* Rewrite the user query for better retrieval performance.
|
|
173
|
-
*/
|
|
165
|
+
/** Rewrite the user query for better retrieval performance. */
|
|
174
166
|
private rewriteQuery;
|
|
175
|
-
/**
|
|
176
|
-
* Generate 3-5 short, relevant questions based on the vector database content.
|
|
177
|
-
*/
|
|
167
|
+
/** Generate 3-5 short, relevant questions based on the vector database content. */
|
|
178
168
|
getSuggestions(query: string, namespace?: string): Promise<string[]>;
|
|
179
169
|
}
|
|
180
170
|
|
|
@@ -363,6 +353,7 @@ declare class ConfigBuilder {
|
|
|
363
353
|
private _embedding?;
|
|
364
354
|
private _ui?;
|
|
365
355
|
private _rag?;
|
|
356
|
+
private _graphDb?;
|
|
366
357
|
/**
|
|
367
358
|
* Set the project/application ID for namespacing
|
|
368
359
|
*/
|
|
@@ -379,6 +370,10 @@ declare class ConfigBuilder {
|
|
|
379
370
|
* Configure the embedding provider
|
|
380
371
|
*/
|
|
381
372
|
embedding(provider: EmbeddingProvider | 'auto', model?: string, apiKey?: string, options?: Record<string, unknown>): this;
|
|
373
|
+
/**
|
|
374
|
+
* Configure the graph database provider
|
|
375
|
+
*/
|
|
376
|
+
graphDb(provider: string | 'auto', options?: Record<string, unknown>): this;
|
|
382
377
|
/**
|
|
383
378
|
* Set RAG-specific pipeline parameters
|
|
384
379
|
*/
|
|
@@ -400,6 +395,7 @@ declare class ConfigBuilder {
|
|
|
400
395
|
private _autoDetectVectorDb;
|
|
401
396
|
private _autoDetectLLM;
|
|
402
397
|
private _autoDetectEmbedding;
|
|
398
|
+
private _autoDetectGraphDb;
|
|
403
399
|
}
|
|
404
400
|
/**
|
|
405
401
|
* Preset configurations for common provider combinations
|
|
@@ -664,17 +660,17 @@ declare class MultiTablePostgresProvider extends BaseVectorProvider {
|
|
|
664
660
|
private readonly connectionString;
|
|
665
661
|
private tables;
|
|
666
662
|
private searchFields;
|
|
663
|
+
private readonly uploadTable;
|
|
667
664
|
constructor(config: VectorDBConfig);
|
|
668
665
|
initialize(): Promise<void>;
|
|
669
666
|
/**
|
|
670
|
-
* Upsert
|
|
671
|
-
* searching across pre-existing tables with varying schemas.
|
|
667
|
+
* Upsert a document by dynamically provisioning a table and columns.
|
|
672
668
|
*/
|
|
673
|
-
upsert(
|
|
669
|
+
upsert(doc: UpsertDocument, namespace?: string): Promise<void>;
|
|
674
670
|
/**
|
|
675
|
-
* Batch upsert
|
|
671
|
+
* Batch upsert documents by dynamically provisioning tables and columns based on CSV headers.
|
|
676
672
|
*/
|
|
677
|
-
batchUpsert(
|
|
673
|
+
batchUpsert(docs: UpsertDocument[], namespace?: string): Promise<void>;
|
|
678
674
|
/**
|
|
679
675
|
* Query all configured tables and merge results, sorted by cosine similarity score.
|
|
680
676
|
*/
|