@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.
Files changed (80) hide show
  1. package/dist/{ILLMProvider-BfRgI1Xh.d.mts → ILLMProvider-BOJFz3Na.d.mts} +47 -1
  2. package/dist/{ILLMProvider-BfRgI1Xh.d.ts → ILLMProvider-BOJFz3Na.d.ts} +47 -1
  3. package/dist/handlers/index.d.mts +2 -2
  4. package/dist/handlers/index.d.ts +2 -2
  5. package/dist/handlers/index.js +509 -162
  6. package/dist/handlers/index.mjs +5849 -15
  7. package/dist/{index-1Z4GuYBi.d.ts → index-BwpcaziY.d.ts} +4 -2
  8. package/dist/{index-BV0z5mb6.d.mts → index-D3V9Et2M.d.mts} +4 -2
  9. package/dist/index.d.mts +30 -16
  10. package/dist/index.d.ts +30 -16
  11. package/dist/index.js +1999 -1210
  12. package/dist/index.mjs +2041 -1205
  13. package/dist/server.d.mts +21 -25
  14. package/dist/server.d.ts +21 -25
  15. package/dist/server.js +536 -163
  16. package/dist/server.mjs +5923 -67
  17. package/package.json +9 -7
  18. package/src/app/api/upload/route.ts +4 -0
  19. package/src/app/constants.tsx +2 -2
  20. package/src/app/globals.css +35 -11
  21. package/src/app/page.tsx +12 -321
  22. package/src/components/AmbientBackground.tsx +29 -0
  23. package/src/components/ArchitectureCard.tsx +17 -0
  24. package/src/components/ArchitectureCardsSection.tsx +15 -0
  25. package/src/components/ChatWidget.tsx +0 -1
  26. package/src/components/ChatWindow.tsx +32 -0
  27. package/src/components/CodeViewer.tsx +51 -0
  28. package/src/components/ConfigProvider.tsx +1 -0
  29. package/src/components/DocViewer.tsx +37 -0
  30. package/src/components/DocumentUpload.tsx +44 -1
  31. package/src/components/Documentation.tsx +58 -0
  32. package/src/components/DynamicChart.tsx +27 -2
  33. package/src/components/Hero.tsx +59 -0
  34. package/src/components/HourglassLoader.tsx +87 -0
  35. package/src/components/Lifecycle.tsx +37 -0
  36. package/src/components/MarkdownComponents.tsx +143 -0
  37. package/src/components/MessageBubble.tsx +91 -1012
  38. package/src/components/Navbar.tsx +55 -0
  39. package/src/components/ObservabilityPanel.tsx +374 -0
  40. package/src/components/ProductCard.tsx +3 -1
  41. package/src/components/UIDispatcher.tsx +341 -0
  42. package/src/components/VisualizationRenderer.tsx +48 -26
  43. package/src/config/ConfigBuilder.ts +38 -1
  44. package/src/core/LangChainAgent.ts +1 -4
  45. package/src/core/Pipeline.ts +209 -86
  46. package/src/core/QueryProcessor.ts +65 -0
  47. package/src/handlers/index.ts +72 -12
  48. package/src/hooks/useRagChat.ts +19 -9
  49. package/src/index.ts +9 -1
  50. package/src/providers/vectordb/MultiTablePostgresProvider.ts +150 -64
  51. package/src/rag/Reranker.ts +99 -6
  52. package/src/types/chat.ts +2 -0
  53. package/src/types/index.ts +52 -0
  54. package/src/types/props.ts +9 -1
  55. package/src/utils/ProductExtractor.ts +347 -0
  56. package/src/utils/UITransformer.ts +4 -53
  57. package/src/utils/synonyms.ts +78 -0
  58. package/dist/ChromaDBProvider-MIDOR4FW.mjs +0 -8
  59. package/dist/MilvusProvider-U7SKC27V.mjs +0 -8
  60. package/dist/MongoDBProvider-YNKC7EJ6.mjs +0 -8
  61. package/dist/MultiTablePostgresProvider-YY7LPNJK.mjs +0 -8
  62. package/dist/PineconeProvider-QZNRKTN2.mjs +0 -8
  63. package/dist/QdrantProvider-RLJTNGPY.mjs +0 -8
  64. package/dist/RedisProvider-SR65SCKV.mjs +0 -8
  65. package/dist/SimpleGraphProvider-SLOXO4M7.mjs +0 -62
  66. package/dist/UniversalVectorProvider-IN67OS56.mjs +0 -9
  67. package/dist/WeaviateProvider-5FWDFITI.mjs +0 -8
  68. package/dist/chunk-5AJ4XHLW.mjs +0 -201
  69. package/dist/chunk-5YGUXK7Z.mjs +0 -80
  70. package/dist/chunk-BFYLQYQU.mjs +0 -3985
  71. package/dist/chunk-CFVEZTBJ.mjs +0 -102
  72. package/dist/chunk-IMP6FUCY.mjs +0 -30
  73. package/dist/chunk-LR3VMDVK.mjs +0 -157
  74. package/dist/chunk-M6JSPGAR.mjs +0 -117
  75. package/dist/chunk-PSFPZXHX.mjs +0 -245
  76. package/dist/chunk-R3RGUMHE.mjs +0 -218
  77. package/dist/chunk-U55XRW3U.mjs +0 -96
  78. package/dist/chunk-VUQJVIJT.mjs +0 -148
  79. package/dist/chunk-X4TOT24V.mjs +0 -89
  80. package/dist/chunk-YLTMFW4M.mjs +0 -49
@@ -1,4 +1,4 @@
1
- import { j as RagConfig, I as ILLMProvider, C as ChatMessage, d as ChatResponse, g as IngestDocument } from './ILLMProvider-BfRgI1Xh.js';
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 {
@@ -135,6 +135,8 @@ declare function sseTextFrame(text: string): string;
135
135
  declare function sseMetaFrame(meta: unknown): string;
136
136
  /** Encode the UI transformation result as an SSE frame. */
137
137
  declare function sseUIFrame(uiTransformation: unknown): string;
138
+ /** Encode the observability trace as an SSE frame. */
139
+ declare function sseObservabilityFrame(trace: unknown): string;
138
140
  /** Encode a stream error as an SSE frame. */
139
141
  declare function sseErrorFrame(message: string): string;
140
142
  /**
@@ -223,4 +225,4 @@ declare function createSuggestionsHandler(configOrPlugin?: Partial<RagConfig> |
223
225
  suggestions: string[];
224
226
  }>>;
225
227
 
226
- 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 { j as RagConfig, I as ILLMProvider, C as ChatMessage, d as ChatResponse, g as IngestDocument } from './ILLMProvider-BfRgI1Xh.mjs';
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 {
@@ -135,6 +135,8 @@ declare function sseTextFrame(text: string): string;
135
135
  declare function sseMetaFrame(meta: unknown): string;
136
136
  /** Encode the UI transformation result as an SSE frame. */
137
137
  declare function sseUIFrame(uiTransformation: unknown): string;
138
+ /** Encode the observability trace as an SSE frame. */
139
+ declare function sseObservabilityFrame(trace: unknown): string;
138
140
  /** Encode a stream error as an SSE frame. */
139
141
  declare function sseErrorFrame(message: string): string;
140
142
  /**
@@ -223,4 +225,4 @@ declare function createSuggestionsHandler(configOrPlugin?: Partial<RagConfig> |
223
225
  suggestions: string[];
224
226
  }>>;
225
227
 
226
- 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,6 +1,7 @@
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 './ILLMProvider-BfRgI1Xh.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 RAGConfig, j as RagConfig, k as UpsertDocument, l as VectorDBConfig, m as VectorDBProvider } from './ILLMProvider-BfRgI1Xh.mjs';
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { CSSProperties, MouseEvent, ReactNode } from 'react';
3
+ 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';
4
+ 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
5
  export { C as Chunk, a as ChunkOptions } from './DocumentChunker-Dh9TvmGG.mjs';
5
6
 
6
7
  type ChatViewportSize = 'compact' | 'medium' | 'large';
@@ -66,35 +67,48 @@ interface SourceCardProps {
66
67
  interface ClientConfig {
67
68
  projectId: string;
68
69
  ui: Required<UIConfig>;
70
+ embedding?: {
71
+ model?: string;
72
+ dimensions?: number;
73
+ };
69
74
  }
70
75
  interface ConfigProviderProps {
71
76
  config?: {
72
77
  projectId?: string;
73
78
  ui?: Partial<UIConfig>;
79
+ embedding?: {
80
+ model?: string;
81
+ dimensions?: number;
82
+ };
74
83
  };
75
84
  children: ReactNode;
76
85
  }
77
86
 
78
- declare function ChatWidget({ position, onAddToCart }: ChatWidgetProps): React.JSX.Element | null;
87
+ declare function ChatWidget({ position, onAddToCart }: ChatWidgetProps): react_jsx_runtime.JSX.Element | null;
79
88
 
80
- declare function ChatWindow({ className, style, onClose, showClose, onResizeStart, onResetResize, isResized, onMaximize, isMaximized, onAddToCart }: ChatWindowProps): React.JSX.Element;
89
+ declare function ChatWindow({ className, style, onClose, showClose, onResizeStart, onResetResize, isResized, onMaximize, isMaximized, onAddToCart }: ChatWindowProps): react_jsx_runtime.JSX.Element;
81
90
 
82
- declare function DocumentUpload({ namespace, onUploadComplete, className }: DocumentUploadProps): React.JSX.Element;
91
+ declare function DocumentUpload({ namespace, onUploadComplete, className }: DocumentUploadProps): react_jsx_runtime.JSX.Element;
83
92
 
84
- declare function MessageBubble({ message, sources, isStreaming, primaryColor, accentColor, onAddToCart, viewportSize, }: MessageBubbleProps): React.JSX.Element;
93
+ declare function MessageBubble({ message, sources, isStreaming, primaryColor, accentColor, onAddToCart, viewportSize, }: MessageBubbleProps): react_jsx_runtime.JSX.Element;
85
94
 
86
- declare function SourceCard({ source, index }: SourceCardProps): React.JSX.Element;
95
+ declare function SourceCard({ source, index }: SourceCardProps): react_jsx_runtime.JSX.Element;
87
96
 
88
- /**
89
- * ConfigProvider — React Context that makes RagConfig (UI subset) available
90
- * to all child components without prop drilling.
91
- *
92
- * Only the UI-safe portions of RagConfig are exposed to the client.
93
- */
97
+ interface ObservabilityPanelProps {
98
+ trace: ObservabilityTrace;
99
+ primaryColor?: string;
100
+ }
101
+ declare function ObservabilityPanel({ trace, primaryColor }: ObservabilityPanelProps): react_jsx_runtime.JSX.Element;
94
102
 
95
- declare function ConfigProvider({ config, children, }: ConfigProviderProps): React.JSX.Element;
103
+ declare function ConfigProvider({ config, children, }: ConfigProviderProps): react_jsx_runtime.JSX.Element;
96
104
  declare function useConfig(): ClientConfig;
97
105
 
98
106
  declare function useRagChat(projectId: string, options?: UseRagChatOptions): UseRagChatReturn;
99
107
 
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 };
108
+ /**
109
+ * Dynamically registers new synonyms into the global FIELD_SYNONYMS dictionary.
110
+ * You can call this during your app initialization to support custom schema fields.
111
+ */
112
+ declare function addSynonyms(customSynonyms: Record<string, string[]>): void;
113
+
114
+ 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,6 +1,7 @@
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 './ILLMProvider-BfRgI1Xh.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 RAGConfig, j as RagConfig, k as UpsertDocument, l as VectorDBConfig, m as VectorDBProvider } from './ILLMProvider-BfRgI1Xh.js';
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { CSSProperties, MouseEvent, ReactNode } from 'react';
3
+ 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';
4
+ 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
5
  export { C as Chunk, a as ChunkOptions } from './DocumentChunker-Dh9TvmGG.js';
5
6
 
6
7
  type ChatViewportSize = 'compact' | 'medium' | 'large';
@@ -66,35 +67,48 @@ interface SourceCardProps {
66
67
  interface ClientConfig {
67
68
  projectId: string;
68
69
  ui: Required<UIConfig>;
70
+ embedding?: {
71
+ model?: string;
72
+ dimensions?: number;
73
+ };
69
74
  }
70
75
  interface ConfigProviderProps {
71
76
  config?: {
72
77
  projectId?: string;
73
78
  ui?: Partial<UIConfig>;
79
+ embedding?: {
80
+ model?: string;
81
+ dimensions?: number;
82
+ };
74
83
  };
75
84
  children: ReactNode;
76
85
  }
77
86
 
78
- declare function ChatWidget({ position, onAddToCart }: ChatWidgetProps): React.JSX.Element | null;
87
+ declare function ChatWidget({ position, onAddToCart }: ChatWidgetProps): react_jsx_runtime.JSX.Element | null;
79
88
 
80
- declare function ChatWindow({ className, style, onClose, showClose, onResizeStart, onResetResize, isResized, onMaximize, isMaximized, onAddToCart }: ChatWindowProps): React.JSX.Element;
89
+ declare function ChatWindow({ className, style, onClose, showClose, onResizeStart, onResetResize, isResized, onMaximize, isMaximized, onAddToCart }: ChatWindowProps): react_jsx_runtime.JSX.Element;
81
90
 
82
- declare function DocumentUpload({ namespace, onUploadComplete, className }: DocumentUploadProps): React.JSX.Element;
91
+ declare function DocumentUpload({ namespace, onUploadComplete, className }: DocumentUploadProps): react_jsx_runtime.JSX.Element;
83
92
 
84
- declare function MessageBubble({ message, sources, isStreaming, primaryColor, accentColor, onAddToCart, viewportSize, }: MessageBubbleProps): React.JSX.Element;
93
+ declare function MessageBubble({ message, sources, isStreaming, primaryColor, accentColor, onAddToCart, viewportSize, }: MessageBubbleProps): react_jsx_runtime.JSX.Element;
85
94
 
86
- declare function SourceCard({ source, index }: SourceCardProps): React.JSX.Element;
95
+ declare function SourceCard({ source, index }: SourceCardProps): react_jsx_runtime.JSX.Element;
87
96
 
88
- /**
89
- * ConfigProvider — React Context that makes RagConfig (UI subset) available
90
- * to all child components without prop drilling.
91
- *
92
- * Only the UI-safe portions of RagConfig are exposed to the client.
93
- */
97
+ interface ObservabilityPanelProps {
98
+ trace: ObservabilityTrace;
99
+ primaryColor?: string;
100
+ }
101
+ declare function ObservabilityPanel({ trace, primaryColor }: ObservabilityPanelProps): react_jsx_runtime.JSX.Element;
94
102
 
95
- declare function ConfigProvider({ config, children, }: ConfigProviderProps): React.JSX.Element;
103
+ declare function ConfigProvider({ config, children, }: ConfigProviderProps): react_jsx_runtime.JSX.Element;
96
104
  declare function useConfig(): ClientConfig;
97
105
 
98
106
  declare function useRagChat(projectId: string, options?: UseRagChatOptions): UseRagChatReturn;
99
107
 
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 };
108
+ /**
109
+ * Dynamically registers new synonyms into the global FIELD_SYNONYMS dictionary.
110
+ * You can call this during your app initialization to support custom schema fields.
111
+ */
112
+ declare function addSynonyms(customSynonyms: Record<string, string[]>): void;
113
+
114
+ 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 };