@retrivora-ai/rag-engine 1.8.0 → 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.
Files changed (71) hide show
  1. package/dist/DocumentChunker-Dh9TvmGG.d.mts +45 -0
  2. package/dist/DocumentChunker-Dh9TvmGG.d.ts +45 -0
  3. package/dist/{index-DPsQodME.d.mts → ILLMProvider-BOJFz3Na.d.mts} +104 -1
  4. package/dist/{index-DPsQodME.d.ts → ILLMProvider-BOJFz3Na.d.ts} +104 -1
  5. package/dist/MultiTablePostgresProvider-ZLGSKTJR.mjs +8 -0
  6. package/dist/chunk-ICKRMZQK.mjs +76 -0
  7. package/dist/{chunk-PV3MFHWU.mjs → chunk-LZVVLSDN.mjs} +977 -516
  8. package/dist/chunk-OZFBG4BA.mjs +291 -0
  9. package/dist/handlers/index.d.mts +2 -2
  10. package/dist/handlers/index.d.ts +2 -2
  11. package/dist/handlers/index.js +1269 -656
  12. package/dist/handlers/index.mjs +4 -1
  13. package/dist/{index-Bb2yEopi.d.mts → index-BwpcaziY.d.ts} +10 -2
  14. package/dist/{index-CkbTzj9J.d.ts → index-D3V9Et2M.d.mts} +10 -2
  15. package/dist/index.d.mts +24 -4
  16. package/dist/index.d.ts +24 -4
  17. package/dist/index.js +1354 -826
  18. package/dist/index.mjs +1284 -795
  19. package/dist/server.d.mts +47 -27
  20. package/dist/server.d.ts +47 -27
  21. package/dist/server.js +1417 -829
  22. package/dist/server.mjs +164 -176
  23. package/package.json +6 -2
  24. package/src/app/api/upload/route.ts +4 -0
  25. package/src/app/constants.tsx +2 -2
  26. package/src/app/page.tsx +12 -322
  27. package/src/components/AmbientBackground.tsx +29 -0
  28. package/src/components/ArchitectureCard.tsx +17 -0
  29. package/src/components/ArchitectureCardsSection.tsx +15 -0
  30. package/src/components/ChatWindow.tsx +32 -0
  31. package/src/components/CodeViewer.tsx +51 -0
  32. package/src/components/ConfigProvider.tsx +1 -0
  33. package/src/components/DocViewer.tsx +37 -0
  34. package/src/components/DocumentUpload.tsx +44 -1
  35. package/src/components/Documentation.tsx +58 -0
  36. package/src/components/DynamicChart.tsx +27 -2
  37. package/src/components/Hero.tsx +59 -0
  38. package/src/components/HourglassLoader.tsx +87 -0
  39. package/src/components/Lifecycle.tsx +37 -0
  40. package/src/components/MarkdownComponents.tsx +140 -0
  41. package/src/components/MessageBubble.tsx +124 -904
  42. package/src/components/Navbar.tsx +55 -0
  43. package/src/components/ObservabilityPanel.tsx +374 -0
  44. package/src/components/ProductCard.tsx +5 -3
  45. package/src/components/UIDispatcher.tsx +344 -0
  46. package/src/components/VisualizationRenderer.tsx +372 -250
  47. package/src/config/RagConfig.ts +5 -0
  48. package/src/config/serverConfig.ts +3 -1
  49. package/src/core/Pipeline.ts +240 -271
  50. package/src/core/ProviderRegistry.ts +2 -2
  51. package/src/core/VectorPlugin.ts +9 -0
  52. package/src/handlers/index.ts +91 -15
  53. package/src/hooks/useRagChat.ts +21 -11
  54. package/src/index.ts +9 -1
  55. package/src/llm/LLMFactory.ts +54 -2
  56. package/src/llm/providers/AnthropicProvider.ts +12 -8
  57. package/src/llm/providers/GeminiProvider.ts +188 -143
  58. package/src/llm/providers/OllamaProvider.ts +7 -3
  59. package/src/llm/providers/OpenAIProvider.ts +12 -8
  60. package/src/providers/vectordb/MultiTablePostgresProvider.ts +150 -64
  61. package/src/types/chat.ts +8 -0
  62. package/src/types/index.ts +132 -0
  63. package/src/types/props.ts +9 -1
  64. package/src/utils/ProductExtractor.ts +347 -0
  65. package/src/utils/SchemaMapper.ts +129 -0
  66. package/src/utils/UITransformer.ts +470 -209
  67. package/src/utils/synonyms.ts +78 -0
  68. package/dist/DocumentChunker-C1GEEosY.d.ts +0 -93
  69. package/dist/DocumentChunker-CFEiRopR.d.mts +0 -93
  70. package/dist/PostgreSQLProvider-BMOETDZA.mjs +0 -8
  71. package/dist/chunk-FLOSGE6A.mjs +0 -202
@@ -8,9 +8,11 @@ import {
8
8
  sseErrorFrame,
9
9
  sseFrame,
10
10
  sseMetaFrame,
11
+ sseObservabilityFrame,
11
12
  sseTextFrame,
12
13
  sseUIFrame
13
- } from "../chunk-PV3MFHWU.mjs";
14
+ } from "../chunk-LZVVLSDN.mjs";
15
+ import "../chunk-ICKRMZQK.mjs";
14
16
  import "../chunk-YLTMFW4M.mjs";
15
17
  import "../chunk-X4TOT24V.mjs";
16
18
  export {
@@ -23,6 +25,7 @@ export {
23
25
  sseErrorFrame,
24
26
  sseFrame,
25
27
  sseMetaFrame,
28
+ sseObservabilityFrame,
26
29
  sseTextFrame,
27
30
  sseUIFrame
28
31
  };
@@ -1,4 +1,4 @@
1
- import { h as RagConfig, C as ChatMessage, d as ChatResponse, I as IngestDocument } from './index-DPsQodME.mjs';
1
+ import { k as RagConfig, I as ILLMProvider, C as ChatMessage, d as ChatResponse, g as IngestDocument } from './ILLMProvider-BOJFz3Na.js';
2
2
  import { NextRequest, NextResponse } from 'next/server';
3
3
 
4
4
  interface ValidationError {
@@ -85,6 +85,12 @@ declare class VectorPlugin {
85
85
  * Get the current resolved configuration.
86
86
  */
87
87
  getConfig(): RagConfig;
88
+ /**
89
+ * Get the initialized LLM provider (available after the first request).
90
+ * Used by handlers to pass to UITransformer.analyzeAndDecide() for
91
+ * LLM-driven visualization decisions.
92
+ */
93
+ getLLMProvider(): ILLMProvider | undefined;
88
94
  /**
89
95
  * Perform pre-flight health checks on all configured providers.
90
96
  * Useful to verify connectivity before running operations.
@@ -129,6 +135,8 @@ declare function sseTextFrame(text: string): string;
129
135
  declare function sseMetaFrame(meta: unknown): string;
130
136
  /** Encode the UI transformation result as an SSE frame. */
131
137
  declare function sseUIFrame(uiTransformation: unknown): string;
138
+ /** Encode the observability trace as an SSE frame. */
139
+ declare function sseObservabilityFrame(trace: unknown): string;
132
140
  /** Encode a stream error as an SSE frame. */
133
141
  declare function sseErrorFrame(message: string): string;
134
142
  /**
@@ -217,4 +225,4 @@ declare function createSuggestionsHandler(configOrPlugin?: Partial<RagConfig> |
217
225
  suggestions: string[];
218
226
  }>>;
219
227
 
220
- 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, sseUIFrame as l, sseErrorFrame as s };
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 };
@@ -1,4 +1,4 @@
1
- import { h as RagConfig, C as ChatMessage, d as ChatResponse, I as IngestDocument } from './index-DPsQodME.js';
1
+ import { k as RagConfig, I as ILLMProvider, C as ChatMessage, d as ChatResponse, g as IngestDocument } from './ILLMProvider-BOJFz3Na.mjs';
2
2
  import { NextRequest, NextResponse } from 'next/server';
3
3
 
4
4
  interface ValidationError {
@@ -85,6 +85,12 @@ declare class VectorPlugin {
85
85
  * Get the current resolved configuration.
86
86
  */
87
87
  getConfig(): RagConfig;
88
+ /**
89
+ * Get the initialized LLM provider (available after the first request).
90
+ * Used by handlers to pass to UITransformer.analyzeAndDecide() for
91
+ * LLM-driven visualization decisions.
92
+ */
93
+ getLLMProvider(): ILLMProvider | undefined;
88
94
  /**
89
95
  * Perform pre-flight health checks on all configured providers.
90
96
  * Useful to verify connectivity before running operations.
@@ -129,6 +135,8 @@ declare function sseTextFrame(text: string): string;
129
135
  declare function sseMetaFrame(meta: unknown): string;
130
136
  /** Encode the UI transformation result as an SSE frame. */
131
137
  declare function sseUIFrame(uiTransformation: unknown): string;
138
+ /** Encode the observability trace as an SSE frame. */
139
+ declare function sseObservabilityFrame(trace: unknown): string;
132
140
  /** Encode a stream error as an SSE frame. */
133
141
  declare function sseErrorFrame(message: string): string;
134
142
  /**
@@ -217,4 +225,4 @@ declare function createSuggestionsHandler(configOrPlugin?: Partial<RagConfig> |
217
225
  suggestions: string[];
218
226
  }>>;
219
227
 
220
- 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, sseUIFrame as l, sseErrorFrame as s };
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 };
package/dist/index.d.mts CHANGED
@@ -1,7 +1,7 @@
1
1
  import React, { CSSProperties, MouseEvent, ReactNode } from 'react';
2
- import { P as Product, U as UIConfig, R as RagMessage, V as VectorMatch, a as UseRagChatOptions, b as UseRagChatReturn } from './index-DPsQodME.mjs';
3
- export { C as ChatMessage, c as ChatOptions, d as ChatResponse, E as EmbeddingConfig, e as EmbeddingProvider, I as IngestDocument, L as LLMConfig, f as LLMProvider, g as RAGConfig, h as RagConfig, i as UpsertDocument, j as VectorDBConfig, k as VectorDBProvider } from './index-DPsQodME.mjs';
4
- export { C as Chunk, a as ChunkOptions, E as EmbedOptions, I as ILLMProvider } from './DocumentChunker-CFEiRopR.mjs';
2
+ import { P as Product, U as UIConfig, R as RagMessage, V as VectorMatch, O as ObservabilityTrace, a as UseRagChatOptions, b as UseRagChatReturn } from './ILLMProvider-BOJFz3Na.mjs';
3
+ export { C as ChatMessage, c as ChatOptions, d as ChatResponse, E as EmbedOptions, e as EmbeddingConfig, f as EmbeddingProvider, I as ILLMProvider, g as IngestDocument, L as LLMConfig, h as LLMProvider, i as LatencyBreakdown, j as RAGConfig, k as RagConfig, l as RetrievedChunk, T as TokenUsage, m as UpsertDocument, n as VectorDBConfig, o as VectorDBProvider } from './ILLMProvider-BOJFz3Na.mjs';
4
+ export { C as Chunk, a as ChunkOptions } from './DocumentChunker-Dh9TvmGG.mjs';
5
5
 
6
6
  type ChatViewportSize = 'compact' | 'medium' | 'large';
7
7
  interface ChatWindowProps {
@@ -66,11 +66,19 @@ interface SourceCardProps {
66
66
  interface ClientConfig {
67
67
  projectId: string;
68
68
  ui: Required<UIConfig>;
69
+ embedding?: {
70
+ model?: string;
71
+ dimensions?: number;
72
+ };
69
73
  }
70
74
  interface ConfigProviderProps {
71
75
  config?: {
72
76
  projectId?: string;
73
77
  ui?: Partial<UIConfig>;
78
+ embedding?: {
79
+ model?: string;
80
+ dimensions?: number;
81
+ };
74
82
  };
75
83
  children: ReactNode;
76
84
  }
@@ -85,6 +93,12 @@ declare function MessageBubble({ message, sources, isStreaming, primaryColor, ac
85
93
 
86
94
  declare function SourceCard({ source, index }: SourceCardProps): React.JSX.Element;
87
95
 
96
+ interface ObservabilityPanelProps {
97
+ trace: ObservabilityTrace;
98
+ primaryColor?: string;
99
+ }
100
+ declare function ObservabilityPanel({ trace, primaryColor }: ObservabilityPanelProps): React.JSX.Element;
101
+
88
102
  /**
89
103
  * ConfigProvider — React Context that makes RagConfig (UI subset) available
90
104
  * to all child components without prop drilling.
@@ -97,4 +111,10 @@ declare function useConfig(): ClientConfig;
97
111
 
98
112
  declare function useRagChat(projectId: string, options?: UseRagChatOptions): UseRagChatReturn;
99
113
 
100
- export { ChatWidget, type ChatWidgetProps, ChatWindow, type ChatWindowProps, type ClientConfig, ConfigProvider, DocumentUpload, type DocumentUploadProps, MessageBubble, type MessageBubbleProps, type ProductCardProps, type ProductCarouselProps, RagMessage, SourceCard, type SourceCardProps, UIConfig, UseRagChatOptions, UseRagChatReturn, VectorMatch, useConfig, useRagChat };
114
+ /**
115
+ * Dynamically registers new synonyms into the global FIELD_SYNONYMS dictionary.
116
+ * You can call this during your app initialization to support custom schema fields.
117
+ */
118
+ declare function addSynonyms(customSynonyms: Record<string, string[]>): void;
119
+
120
+ export { ChatWidget, type ChatWidgetProps, ChatWindow, type ChatWindowProps, type ClientConfig, ConfigProvider, DocumentUpload, type DocumentUploadProps, MessageBubble, type MessageBubbleProps, ObservabilityPanel, ObservabilityTrace, type ProductCardProps, type ProductCarouselProps, RagMessage, SourceCard, type SourceCardProps, UIConfig, UseRagChatOptions, UseRagChatReturn, VectorMatch, addSynonyms, useConfig, useRagChat };
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import React, { CSSProperties, MouseEvent, ReactNode } from 'react';
2
- import { P as Product, U as UIConfig, R as RagMessage, V as VectorMatch, a as UseRagChatOptions, b as UseRagChatReturn } from './index-DPsQodME.js';
3
- export { C as ChatMessage, c as ChatOptions, d as ChatResponse, E as EmbeddingConfig, e as EmbeddingProvider, I as IngestDocument, L as LLMConfig, f as LLMProvider, g as RAGConfig, h as RagConfig, i as UpsertDocument, j as VectorDBConfig, k as VectorDBProvider } from './index-DPsQodME.js';
4
- export { C as Chunk, a as ChunkOptions, E as EmbedOptions, I as ILLMProvider } from './DocumentChunker-C1GEEosY.js';
2
+ import { P as Product, U as UIConfig, R as RagMessage, V as VectorMatch, O as ObservabilityTrace, a as UseRagChatOptions, b as UseRagChatReturn } from './ILLMProvider-BOJFz3Na.js';
3
+ export { C as ChatMessage, c as ChatOptions, d as ChatResponse, E as EmbedOptions, e as EmbeddingConfig, f as EmbeddingProvider, I as ILLMProvider, g as IngestDocument, L as LLMConfig, h as LLMProvider, i as LatencyBreakdown, j as RAGConfig, k as RagConfig, l as RetrievedChunk, T as TokenUsage, m as UpsertDocument, n as VectorDBConfig, o as VectorDBProvider } from './ILLMProvider-BOJFz3Na.js';
4
+ export { C as Chunk, a as ChunkOptions } from './DocumentChunker-Dh9TvmGG.js';
5
5
 
6
6
  type ChatViewportSize = 'compact' | 'medium' | 'large';
7
7
  interface ChatWindowProps {
@@ -66,11 +66,19 @@ interface SourceCardProps {
66
66
  interface ClientConfig {
67
67
  projectId: string;
68
68
  ui: Required<UIConfig>;
69
+ embedding?: {
70
+ model?: string;
71
+ dimensions?: number;
72
+ };
69
73
  }
70
74
  interface ConfigProviderProps {
71
75
  config?: {
72
76
  projectId?: string;
73
77
  ui?: Partial<UIConfig>;
78
+ embedding?: {
79
+ model?: string;
80
+ dimensions?: number;
81
+ };
74
82
  };
75
83
  children: ReactNode;
76
84
  }
@@ -85,6 +93,12 @@ declare function MessageBubble({ message, sources, isStreaming, primaryColor, ac
85
93
 
86
94
  declare function SourceCard({ source, index }: SourceCardProps): React.JSX.Element;
87
95
 
96
+ interface ObservabilityPanelProps {
97
+ trace: ObservabilityTrace;
98
+ primaryColor?: string;
99
+ }
100
+ declare function ObservabilityPanel({ trace, primaryColor }: ObservabilityPanelProps): React.JSX.Element;
101
+
88
102
  /**
89
103
  * ConfigProvider — React Context that makes RagConfig (UI subset) available
90
104
  * to all child components without prop drilling.
@@ -97,4 +111,10 @@ declare function useConfig(): ClientConfig;
97
111
 
98
112
  declare function useRagChat(projectId: string, options?: UseRagChatOptions): UseRagChatReturn;
99
113
 
100
- export { ChatWidget, type ChatWidgetProps, ChatWindow, type ChatWindowProps, type ClientConfig, ConfigProvider, DocumentUpload, type DocumentUploadProps, MessageBubble, type MessageBubbleProps, type ProductCardProps, type ProductCarouselProps, RagMessage, SourceCard, type SourceCardProps, UIConfig, UseRagChatOptions, UseRagChatReturn, VectorMatch, useConfig, useRagChat };
114
+ /**
115
+ * Dynamically registers new synonyms into the global FIELD_SYNONYMS dictionary.
116
+ * You can call this during your app initialization to support custom schema fields.
117
+ */
118
+ declare function addSynonyms(customSynonyms: Record<string, string[]>): void;
119
+
120
+ export { ChatWidget, type ChatWidgetProps, ChatWindow, type ChatWindowProps, type ClientConfig, ConfigProvider, DocumentUpload, type DocumentUploadProps, MessageBubble, type MessageBubbleProps, ObservabilityPanel, ObservabilityTrace, type ProductCardProps, type ProductCarouselProps, RagMessage, SourceCard, type SourceCardProps, UIConfig, UseRagChatOptions, UseRagChatReturn, VectorMatch, addSynonyms, useConfig, useRagChat };