@retrivora-ai/rag-engine 1.8.1 → 1.8.2
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/{MultiTablePostgresProvider-YY7LPNJK.mjs → MultiTablePostgresProvider-ZLGSKTJR.mjs} +1 -1
- package/dist/chunk-ICKRMZQK.mjs +76 -0
- package/dist/{chunk-BFYLQYQU.mjs → chunk-LZVVLSDN.mjs} +192 -100
- package/dist/{chunk-R3RGUMHE.mjs → chunk-OZFBG4BA.mjs} +121 -48
- package/dist/handlers/index.d.mts +2 -2
- package/dist/handlers/index.d.ts +2 -2
- package/dist/handlers/index.js +368 -147
- package/dist/handlers/index.mjs +4 -1
- package/dist/{index-BV0z5mb6.d.mts → index-BwpcaziY.d.ts} +4 -2
- package/dist/{index-1Z4GuYBi.d.ts → index-D3V9Et2M.d.mts} +4 -2
- package/dist/index.d.mts +23 -3
- package/dist/index.d.ts +23 -3
- package/dist/index.js +1143 -790
- package/dist/index.mjs +1065 -770
- package/dist/server.d.mts +15 -25
- package/dist/server.d.ts +15 -25
- package/dist/server.js +366 -147
- package/dist/server.mjs +3 -2
- package/package.json +4 -2
- package/src/app/api/upload/route.ts +4 -0
- package/src/app/constants.tsx +2 -2
- 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/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 +140 -0
- package/src/components/MessageBubble.tsx +88 -1010
- 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 +344 -0
- package/src/components/VisualizationRenderer.tsx +48 -26
- package/src/core/Pipeline.ts +186 -76
- 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/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/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
|
|
|
@@ -664,17 +654,17 @@ declare class MultiTablePostgresProvider extends BaseVectorProvider {
|
|
|
664
654
|
private readonly connectionString;
|
|
665
655
|
private tables;
|
|
666
656
|
private searchFields;
|
|
657
|
+
private readonly uploadTable;
|
|
667
658
|
constructor(config: VectorDBConfig);
|
|
668
659
|
initialize(): Promise<void>;
|
|
669
660
|
/**
|
|
670
|
-
* Upsert
|
|
671
|
-
* searching across pre-existing tables with varying schemas.
|
|
661
|
+
* Upsert a document by dynamically provisioning a table and columns.
|
|
672
662
|
*/
|
|
673
|
-
upsert(
|
|
663
|
+
upsert(doc: UpsertDocument, namespace?: string): Promise<void>;
|
|
674
664
|
/**
|
|
675
|
-
* Batch upsert
|
|
665
|
+
* Batch upsert documents by dynamically provisioning tables and columns based on CSV headers.
|
|
676
666
|
*/
|
|
677
|
-
batchUpsert(
|
|
667
|
+
batchUpsert(docs: UpsertDocument[], namespace?: string): Promise<void>;
|
|
678
668
|
/**
|
|
679
669
|
* Query all configured tables and merge results, sorted by cosine similarity score.
|
|
680
670
|
*/
|
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
|
|
|
@@ -664,17 +654,17 @@ declare class MultiTablePostgresProvider extends BaseVectorProvider {
|
|
|
664
654
|
private readonly connectionString;
|
|
665
655
|
private tables;
|
|
666
656
|
private searchFields;
|
|
657
|
+
private readonly uploadTable;
|
|
667
658
|
constructor(config: VectorDBConfig);
|
|
668
659
|
initialize(): Promise<void>;
|
|
669
660
|
/**
|
|
670
|
-
* Upsert
|
|
671
|
-
* searching across pre-existing tables with varying schemas.
|
|
661
|
+
* Upsert a document by dynamically provisioning a table and columns.
|
|
672
662
|
*/
|
|
673
|
-
upsert(
|
|
663
|
+
upsert(doc: UpsertDocument, namespace?: string): Promise<void>;
|
|
674
664
|
/**
|
|
675
|
-
* Batch upsert
|
|
665
|
+
* Batch upsert documents by dynamically provisioning tables and columns based on CSV headers.
|
|
676
666
|
*/
|
|
677
|
-
batchUpsert(
|
|
667
|
+
batchUpsert(docs: UpsertDocument[], namespace?: string): Promise<void>;
|
|
678
668
|
/**
|
|
679
669
|
* Query all configured tables and merge results, sorted by cosine similarity score.
|
|
680
670
|
*/
|