@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
|
@@ -7,6 +7,8 @@ interface RagMessage extends ChatMessage {
|
|
|
7
7
|
id: string;
|
|
8
8
|
sources?: VectorMatch[];
|
|
9
9
|
uiTransformation?: unknown;
|
|
10
|
+
/** Full observability trace emitted by the backend. Only present on assistant messages. */
|
|
11
|
+
trace?: ObservabilityTrace;
|
|
10
12
|
createdAt: string;
|
|
11
13
|
}
|
|
12
14
|
interface ChatOptions {
|
|
@@ -233,6 +235,48 @@ interface RagConfig {
|
|
|
233
235
|
graphDb?: GraphDBConfig;
|
|
234
236
|
}
|
|
235
237
|
|
|
238
|
+
/** Per-stage latency breakdown for a single RAG request. */
|
|
239
|
+
interface LatencyBreakdown {
|
|
240
|
+
embedMs: number;
|
|
241
|
+
retrieveMs: number;
|
|
242
|
+
rerankMs?: number;
|
|
243
|
+
generateMs: number;
|
|
244
|
+
totalMs: number;
|
|
245
|
+
}
|
|
246
|
+
/** Token usage reported by the LLM (or estimated when the provider doesn't expose it). */
|
|
247
|
+
interface TokenUsage {
|
|
248
|
+
promptTokens: number;
|
|
249
|
+
completionTokens: number;
|
|
250
|
+
totalTokens: number;
|
|
251
|
+
/** Rough cost in USD — estimated from token counts and model pricing. */
|
|
252
|
+
estimatedCostUsd?: number;
|
|
253
|
+
}
|
|
254
|
+
/** A single retrieved chunk annotated with its retrieval context. */
|
|
255
|
+
interface RetrievedChunk {
|
|
256
|
+
id: string | number;
|
|
257
|
+
score: number;
|
|
258
|
+
content: string;
|
|
259
|
+
metadata: Record<string, unknown>;
|
|
260
|
+
namespace: string;
|
|
261
|
+
}
|
|
262
|
+
/**
|
|
263
|
+
* Full observability trace for one RAG request.
|
|
264
|
+
* Emitted by the backend as an SSE frame and stored on each RagMessage.
|
|
265
|
+
*/
|
|
266
|
+
interface ObservabilityTrace {
|
|
267
|
+
requestId: string;
|
|
268
|
+
query: string;
|
|
269
|
+
rewrittenQuery?: string;
|
|
270
|
+
systemPrompt: string;
|
|
271
|
+
userPrompt: string;
|
|
272
|
+
chunks: RetrievedChunk[];
|
|
273
|
+
latency: LatencyBreakdown;
|
|
274
|
+
tokens?: TokenUsage;
|
|
275
|
+
/** 0 = fully grounded, 1 = likely hallucinated. */
|
|
276
|
+
hallucinationScore?: number;
|
|
277
|
+
hallucinationReason?: string;
|
|
278
|
+
timestamp: string;
|
|
279
|
+
}
|
|
236
280
|
interface VectorMatch {
|
|
237
281
|
id: string | number;
|
|
238
282
|
score: number;
|
|
@@ -255,6 +299,8 @@ interface ChatResponse {
|
|
|
255
299
|
sources: VectorMatch[];
|
|
256
300
|
graphData?: GraphSearchResult;
|
|
257
301
|
ui_transformation?: unknown;
|
|
302
|
+
/** Observability trace — populated by the instrumented Pipeline. */
|
|
303
|
+
trace?: ObservabilityTrace;
|
|
258
304
|
}
|
|
259
305
|
interface GraphNode {
|
|
260
306
|
id: string;
|
|
@@ -331,4 +377,4 @@ interface ILLMProvider {
|
|
|
331
377
|
ping(): Promise<boolean>;
|
|
332
378
|
}
|
|
333
379
|
|
|
334
|
-
export type { ChatMessage as C, EmbedOptions as E, GraphDBConfig as G, ILLMProvider as I, LLMConfig as L, Product as P, RagMessage as R, UIConfig as U, VectorMatch as V, UseRagChatOptions as a, UseRagChatReturn as b, ChatOptions as c, ChatResponse as d, EmbeddingConfig as e, EmbeddingProvider as f, IngestDocument as g, LLMProvider as h,
|
|
380
|
+
export type { ChatMessage as C, EmbedOptions as E, GraphDBConfig as G, ILLMProvider as I, LLMConfig as L, ObservabilityTrace as O, Product as P, RagMessage as R, TokenUsage as T, UIConfig as U, VectorMatch as V, UseRagChatOptions as a, UseRagChatReturn as b, ChatOptions as c, ChatResponse as d, EmbeddingConfig as e, EmbeddingProvider as f, IngestDocument as g, LLMProvider as h, LatencyBreakdown as i, RAGConfig as j, RagConfig as k, RetrievedChunk as l, UpsertDocument as m, VectorDBConfig as n, VectorDBProvider as o, RetrievalResult as p, GraphNode as q, Edge as r, GraphSearchResult as s };
|
|
@@ -7,6 +7,8 @@ interface RagMessage extends ChatMessage {
|
|
|
7
7
|
id: string;
|
|
8
8
|
sources?: VectorMatch[];
|
|
9
9
|
uiTransformation?: unknown;
|
|
10
|
+
/** Full observability trace emitted by the backend. Only present on assistant messages. */
|
|
11
|
+
trace?: ObservabilityTrace;
|
|
10
12
|
createdAt: string;
|
|
11
13
|
}
|
|
12
14
|
interface ChatOptions {
|
|
@@ -233,6 +235,48 @@ interface RagConfig {
|
|
|
233
235
|
graphDb?: GraphDBConfig;
|
|
234
236
|
}
|
|
235
237
|
|
|
238
|
+
/** Per-stage latency breakdown for a single RAG request. */
|
|
239
|
+
interface LatencyBreakdown {
|
|
240
|
+
embedMs: number;
|
|
241
|
+
retrieveMs: number;
|
|
242
|
+
rerankMs?: number;
|
|
243
|
+
generateMs: number;
|
|
244
|
+
totalMs: number;
|
|
245
|
+
}
|
|
246
|
+
/** Token usage reported by the LLM (or estimated when the provider doesn't expose it). */
|
|
247
|
+
interface TokenUsage {
|
|
248
|
+
promptTokens: number;
|
|
249
|
+
completionTokens: number;
|
|
250
|
+
totalTokens: number;
|
|
251
|
+
/** Rough cost in USD — estimated from token counts and model pricing. */
|
|
252
|
+
estimatedCostUsd?: number;
|
|
253
|
+
}
|
|
254
|
+
/** A single retrieved chunk annotated with its retrieval context. */
|
|
255
|
+
interface RetrievedChunk {
|
|
256
|
+
id: string | number;
|
|
257
|
+
score: number;
|
|
258
|
+
content: string;
|
|
259
|
+
metadata: Record<string, unknown>;
|
|
260
|
+
namespace: string;
|
|
261
|
+
}
|
|
262
|
+
/**
|
|
263
|
+
* Full observability trace for one RAG request.
|
|
264
|
+
* Emitted by the backend as an SSE frame and stored on each RagMessage.
|
|
265
|
+
*/
|
|
266
|
+
interface ObservabilityTrace {
|
|
267
|
+
requestId: string;
|
|
268
|
+
query: string;
|
|
269
|
+
rewrittenQuery?: string;
|
|
270
|
+
systemPrompt: string;
|
|
271
|
+
userPrompt: string;
|
|
272
|
+
chunks: RetrievedChunk[];
|
|
273
|
+
latency: LatencyBreakdown;
|
|
274
|
+
tokens?: TokenUsage;
|
|
275
|
+
/** 0 = fully grounded, 1 = likely hallucinated. */
|
|
276
|
+
hallucinationScore?: number;
|
|
277
|
+
hallucinationReason?: string;
|
|
278
|
+
timestamp: string;
|
|
279
|
+
}
|
|
236
280
|
interface VectorMatch {
|
|
237
281
|
id: string | number;
|
|
238
282
|
score: number;
|
|
@@ -255,6 +299,8 @@ interface ChatResponse {
|
|
|
255
299
|
sources: VectorMatch[];
|
|
256
300
|
graphData?: GraphSearchResult;
|
|
257
301
|
ui_transformation?: unknown;
|
|
302
|
+
/** Observability trace — populated by the instrumented Pipeline. */
|
|
303
|
+
trace?: ObservabilityTrace;
|
|
258
304
|
}
|
|
259
305
|
interface GraphNode {
|
|
260
306
|
id: string;
|
|
@@ -331,4 +377,4 @@ interface ILLMProvider {
|
|
|
331
377
|
ping(): Promise<boolean>;
|
|
332
378
|
}
|
|
333
379
|
|
|
334
|
-
export type { ChatMessage as C, EmbedOptions as E, GraphDBConfig as G, ILLMProvider as I, LLMConfig as L, Product as P, RagMessage as R, UIConfig as U, VectorMatch as V, UseRagChatOptions as a, UseRagChatReturn as b, ChatOptions as c, ChatResponse as d, EmbeddingConfig as e, EmbeddingProvider as f, IngestDocument as g, LLMProvider as h,
|
|
380
|
+
export type { ChatMessage as C, EmbedOptions as E, GraphDBConfig as G, ILLMProvider as I, LLMConfig as L, ObservabilityTrace as O, Product as P, RagMessage as R, TokenUsage as T, UIConfig as U, VectorMatch as V, UseRagChatOptions as a, UseRagChatReturn as b, ChatOptions as c, ChatResponse as d, EmbeddingConfig as e, EmbeddingProvider as f, IngestDocument as g, LLMProvider as h, LatencyBreakdown as i, RAGConfig as j, RagConfig as k, RetrievedChunk as l, UpsertDocument as m, VectorDBConfig as n, VectorDBProvider as o, RetrievalResult as p, GraphNode as q, Edge as r, GraphSearchResult as s };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import '../ILLMProvider-
|
|
2
|
-
export { c as createChatHandler, d as createHealthHandler, e as createIngestHandler, f as createStreamHandler, k as createSuggestionsHandler, g as createUploadHandler, s as sseErrorFrame, h as sseFrame, i as sseMetaFrame, j as sseTextFrame,
|
|
1
|
+
import '../ILLMProvider-BOJFz3Na.mjs';
|
|
2
|
+
export { c as createChatHandler, d as createHealthHandler, e as createIngestHandler, f as createStreamHandler, k as createSuggestionsHandler, g as createUploadHandler, s as sseErrorFrame, h as sseFrame, i as sseMetaFrame, l as sseObservabilityFrame, j as sseTextFrame, m as sseUIFrame } from '../index-D3V9Et2M.mjs';
|
|
3
3
|
import 'next/server';
|
package/dist/handlers/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import '../ILLMProvider-
|
|
2
|
-
export { c as createChatHandler, d as createHealthHandler, e as createIngestHandler, f as createStreamHandler, k as createSuggestionsHandler, g as createUploadHandler, s as sseErrorFrame, h as sseFrame, i as sseMetaFrame, j as sseTextFrame,
|
|
1
|
+
import '../ILLMProvider-BOJFz3Na.js';
|
|
2
|
+
export { c as createChatHandler, d as createHealthHandler, e as createIngestHandler, f as createStreamHandler, k as createSuggestionsHandler, g as createUploadHandler, s as sseErrorFrame, h as sseFrame, i as sseMetaFrame, l as sseObservabilityFrame, j as sseTextFrame, m as sseUIFrame } from '../index-BwpcaziY.js';
|
|
3
3
|
import 'next/server';
|