@retrivora-ai/rag-engine 1.9.6 → 1.9.8

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 (62) hide show
  1. package/README.md +130 -113
  2. package/dist/{ILLMProvider-DNhyOYoK.d.mts → ILLMProvider-B8ROITYK.d.mts} +59 -8
  3. package/dist/{ILLMProvider-DNhyOYoK.d.ts → ILLMProvider-B8ROITYK.d.ts} +59 -8
  4. package/dist/handlers/index.d.mts +2 -2
  5. package/dist/handlers/index.d.ts +2 -2
  6. package/dist/handlers/index.js +2376 -489
  7. package/dist/handlers/index.mjs +2372 -489
  8. package/dist/{index-CjQdL0cX.d.ts → index-B8PbEFSY.d.mts} +17 -3
  9. package/dist/{index-CHL1jdYm.d.mts → index-BCPKUAVL.d.ts} +33 -41
  10. package/dist/{index-Hgbwl9X4.d.ts → index-CrxCy36A.d.mts} +33 -41
  11. package/dist/{index-C9v7-tWd.d.mts → index-DNvoi-sV.d.ts} +17 -3
  12. package/dist/index.css +695 -203
  13. package/dist/index.d.mts +37 -7
  14. package/dist/index.d.ts +37 -7
  15. package/dist/index.js +1197 -286
  16. package/dist/index.mjs +1221 -297
  17. package/dist/server.d.mts +62 -6
  18. package/dist/server.d.ts +62 -6
  19. package/dist/server.js +2526 -574
  20. package/dist/server.mjs +2517 -573
  21. package/package.json +12 -10
  22. package/src/app/constants.tsx +207 -212
  23. package/src/app/layout.tsx +4 -28
  24. package/src/app/types.ts +17 -17
  25. package/src/components/AmbientBackground.tsx +10 -10
  26. package/src/components/ArchitectureCard.tsx +43 -7
  27. package/src/components/ArchitectureCardsSection.tsx +37 -4
  28. package/src/components/ChatWidget.tsx +4 -1
  29. package/src/components/ChatWindow.tsx +9 -2
  30. package/src/components/CodeViewer.tsx +19 -14
  31. package/src/components/DocViewer.tsx +75 -15
  32. package/src/components/Documentation.tsx +111 -28
  33. package/src/components/Hero.tsx +103 -20
  34. package/src/components/Lifecycle.tsx +65 -25
  35. package/src/components/MarkdownComponents.tsx +44 -1
  36. package/src/components/MessageBubble.tsx +162 -50
  37. package/src/components/constants.tsx +279 -0
  38. package/src/config/RagConfig.ts +56 -10
  39. package/src/config/constants.ts +5 -0
  40. package/src/config/serverConfig.ts +15 -0
  41. package/src/core/ConfigResolver.ts +30 -25
  42. package/src/core/DatabaseStorage.ts +469 -0
  43. package/src/core/LicenseVerifier.ts +154 -0
  44. package/src/core/MultiAgentCoordinator.ts +239 -0
  45. package/src/core/Pipeline.ts +148 -16
  46. package/src/core/ProviderRegistry.ts +5 -5
  47. package/src/core/Retrivora.ts +52 -6
  48. package/src/core/VectorPlugin.ts +74 -11
  49. package/src/core/mcp.ts +261 -0
  50. package/src/exceptions/index.ts +52 -0
  51. package/src/handlers/index.ts +504 -47
  52. package/src/hooks/useRagChat.ts +100 -43
  53. package/src/hooks/useStoredMessages.ts +15 -4
  54. package/src/index.ts +7 -0
  55. package/src/llm/LLMFactory.ts +15 -6
  56. package/src/llm/providers/GroqProvider.ts +176 -0
  57. package/src/llm/providers/QwenProvider.ts +191 -0
  58. package/src/server.ts +23 -13
  59. package/src/types/chat.ts +16 -0
  60. package/src/types/props.ts +50 -1
  61. package/.env.example +0 -80
  62. package/LICENSE.txt +0 -21
package/dist/index.d.mts CHANGED
@@ -1,8 +1,8 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
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-DNhyOYoK.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 RetrievalConfig, m as RetrievedChunk, T as TokenUsage, n as UniversalRagConfig, o as UpsertDocument, p as VectorDBConfig, q as VectorDBProvider, W as WorkflowConfig } from './ILLMProvider-DNhyOYoK.mjs';
5
- export { A as AuthenticationException, C as Chunk, a as ChunkOptions, b as ConfigurationException, E as EmbeddingFailedException, P as ProviderNotFoundException, R as RateLimitException, c as RetrievalException, d as Retrivora, e as RetrivoraError, f as RetrivoraErrorCode } from './index-C9v7-tWd.mjs';
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-B8ROITYK.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 RetrievalConfig, m as RetrievedChunk, T as TokenUsage, n as UniversalRagConfig, o as UpsertDocument, p as VectorDBConfig, q as VectorDBProvider, W as WorkflowConfig } from './ILLMProvider-B8ROITYK.mjs';
5
+ export { A as AuthenticationException, C as Chunk, a as ChunkOptions, b as ConfigurationException, E as EmbeddingFailedException, P as ProviderNotFoundException, R as RateLimitException, c as RetrievalException, d as Retrivora, e as RetrivoraError, f as RetrivoraErrorCode } from './index-B8PbEFSY.mjs';
6
6
 
7
7
  type ChatViewportSize = 'compact' | 'medium' | 'large';
8
8
  interface ChatWindowProps {
@@ -26,12 +26,30 @@ interface ChatWindowProps {
26
26
  isMaximized?: boolean;
27
27
  /** Called when the user clicks 'Add to Cart' on a product */
28
28
  onAddToCart?: (product: Product) => void;
29
+ /** Optional custom API URL to send chat messages to */
30
+ apiUrl?: string;
31
+ /**
32
+ * Base URL for Retrivora SDK history/feedback/sessions endpoints.
33
+ * Defaults to '/api/retrivora'. Set this to match your catch-all route location.
34
+ */
35
+ retrivoraApiBase?: string;
36
+ /** Optional custom headers to send with the chat request */
37
+ headers?: Record<string, string>;
29
38
  }
30
39
  interface ChatWidgetProps {
31
40
  /** Position of the floating button. Defaults to bottom-right. */
32
41
  position?: 'bottom-right' | 'bottom-left';
33
42
  /** Called when the user clicks 'Add to Cart' on a product */
34
43
  onAddToCart?: (product: Product) => void;
44
+ /** Optional custom API URL to send chat messages to */
45
+ apiUrl?: string;
46
+ /**
47
+ * Base URL for Retrivora SDK history/feedback/sessions endpoints.
48
+ * Defaults to '/api/retrivora'.
49
+ */
50
+ retrivoraApiBase?: string;
51
+ /** Optional custom headers to send with the chat request */
52
+ headers?: Record<string, string>;
35
53
  }
36
54
  interface MessageBubbleProps {
37
55
  message: RagMessage;
@@ -41,6 +59,8 @@ interface MessageBubbleProps {
41
59
  accentColor: string;
42
60
  onAddToCart?: (product: Product) => void;
43
61
  viewportSize?: ChatViewportSize;
62
+ /** Called when the user clicks thumbs up or thumbs down on an assistant message */
63
+ onFeedback?: (messageId: string, rating: 'thumbs_up' | 'thumbs_down') => void;
44
64
  }
45
65
  interface ProductCardProps {
46
66
  product: Product;
@@ -84,13 +104,13 @@ interface ConfigProviderProps {
84
104
  children: ReactNode;
85
105
  }
86
106
 
87
- declare function ChatWidget({ position, onAddToCart }: ChatWidgetProps): react_jsx_runtime.JSX.Element | null;
107
+ declare function ChatWidget({ position, onAddToCart, apiUrl, retrivoraApiBase, headers }: ChatWidgetProps): react_jsx_runtime.JSX.Element | null;
88
108
 
89
- declare function ChatWindow({ className, style, onClose, showClose, onResizeStart, onResetResize, isResized, onMaximize, isMaximized, onAddToCart }: ChatWindowProps): react_jsx_runtime.JSX.Element;
109
+ declare function ChatWindow({ className, style, onClose, showClose, onResizeStart, onResetResize, isResized, onMaximize, isMaximized, onAddToCart, apiUrl, retrivoraApiBase, headers }: ChatWindowProps): react_jsx_runtime.JSX.Element;
90
110
 
91
111
  declare function DocumentUpload({ namespace, onUploadComplete, className }: DocumentUploadProps): react_jsx_runtime.JSX.Element;
92
112
 
93
- declare function MessageBubble({ message, sources, isStreaming, primaryColor, accentColor, onAddToCart, viewportSize, }: MessageBubbleProps): react_jsx_runtime.JSX.Element;
113
+ declare function MessageBubble({ message, sources, isStreaming, primaryColor, accentColor, onAddToCart, viewportSize, onFeedback, }: MessageBubbleProps): react_jsx_runtime.JSX.Element;
94
114
 
95
115
  declare function SourceCard({ source, index }: SourceCardProps): react_jsx_runtime.JSX.Element;
96
116
 
@@ -103,6 +123,16 @@ declare function ObservabilityPanel({ trace, primaryColor }: ObservabilityPanelP
103
123
  declare function ConfigProvider({ config, children, }: ConfigProviderProps): react_jsx_runtime.JSX.Element;
104
124
  declare function useConfig(): ClientConfig;
105
125
 
126
+ declare function Hero(): react_jsx_runtime.JSX.Element;
127
+
128
+ declare function Lifecycle(): react_jsx_runtime.JSX.Element;
129
+
130
+ declare function ArchitectureCardsSection(): react_jsx_runtime.JSX.Element;
131
+
132
+ declare function Documentation(): react_jsx_runtime.JSX.Element;
133
+
134
+ declare function AmbientBackground(): react_jsx_runtime.JSX.Element;
135
+
106
136
  declare function useRagChat(projectId: string, options?: UseRagChatOptions): UseRagChatReturn;
107
137
 
108
138
  /**
@@ -111,4 +141,4 @@ declare function useRagChat(projectId: string, options?: UseRagChatOptions): Use
111
141
  */
112
142
  declare function addSynonyms(customSynonyms: Record<string, string[]>): void;
113
143
 
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 };
144
+ export { AmbientBackground, ArchitectureCardsSection, ChatWidget, type ChatWidgetProps, ChatWindow, type ChatWindowProps, type ClientConfig, ConfigProvider, DocumentUpload, type DocumentUploadProps, Documentation, Hero, Lifecycle, 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,8 +1,8 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
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-DNhyOYoK.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 RetrievalConfig, m as RetrievedChunk, T as TokenUsage, n as UniversalRagConfig, o as UpsertDocument, p as VectorDBConfig, q as VectorDBProvider, W as WorkflowConfig } from './ILLMProvider-DNhyOYoK.js';
5
- export { A as AuthenticationException, C as Chunk, a as ChunkOptions, b as ConfigurationException, E as EmbeddingFailedException, P as ProviderNotFoundException, R as RateLimitException, c as RetrievalException, d as Retrivora, e as RetrivoraError, f as RetrivoraErrorCode } from './index-CjQdL0cX.js';
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-B8ROITYK.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 RetrievalConfig, m as RetrievedChunk, T as TokenUsage, n as UniversalRagConfig, o as UpsertDocument, p as VectorDBConfig, q as VectorDBProvider, W as WorkflowConfig } from './ILLMProvider-B8ROITYK.js';
5
+ export { A as AuthenticationException, C as Chunk, a as ChunkOptions, b as ConfigurationException, E as EmbeddingFailedException, P as ProviderNotFoundException, R as RateLimitException, c as RetrievalException, d as Retrivora, e as RetrivoraError, f as RetrivoraErrorCode } from './index-DNvoi-sV.js';
6
6
 
7
7
  type ChatViewportSize = 'compact' | 'medium' | 'large';
8
8
  interface ChatWindowProps {
@@ -26,12 +26,30 @@ interface ChatWindowProps {
26
26
  isMaximized?: boolean;
27
27
  /** Called when the user clicks 'Add to Cart' on a product */
28
28
  onAddToCart?: (product: Product) => void;
29
+ /** Optional custom API URL to send chat messages to */
30
+ apiUrl?: string;
31
+ /**
32
+ * Base URL for Retrivora SDK history/feedback/sessions endpoints.
33
+ * Defaults to '/api/retrivora'. Set this to match your catch-all route location.
34
+ */
35
+ retrivoraApiBase?: string;
36
+ /** Optional custom headers to send with the chat request */
37
+ headers?: Record<string, string>;
29
38
  }
30
39
  interface ChatWidgetProps {
31
40
  /** Position of the floating button. Defaults to bottom-right. */
32
41
  position?: 'bottom-right' | 'bottom-left';
33
42
  /** Called when the user clicks 'Add to Cart' on a product */
34
43
  onAddToCart?: (product: Product) => void;
44
+ /** Optional custom API URL to send chat messages to */
45
+ apiUrl?: string;
46
+ /**
47
+ * Base URL for Retrivora SDK history/feedback/sessions endpoints.
48
+ * Defaults to '/api/retrivora'.
49
+ */
50
+ retrivoraApiBase?: string;
51
+ /** Optional custom headers to send with the chat request */
52
+ headers?: Record<string, string>;
35
53
  }
36
54
  interface MessageBubbleProps {
37
55
  message: RagMessage;
@@ -41,6 +59,8 @@ interface MessageBubbleProps {
41
59
  accentColor: string;
42
60
  onAddToCart?: (product: Product) => void;
43
61
  viewportSize?: ChatViewportSize;
62
+ /** Called when the user clicks thumbs up or thumbs down on an assistant message */
63
+ onFeedback?: (messageId: string, rating: 'thumbs_up' | 'thumbs_down') => void;
44
64
  }
45
65
  interface ProductCardProps {
46
66
  product: Product;
@@ -84,13 +104,13 @@ interface ConfigProviderProps {
84
104
  children: ReactNode;
85
105
  }
86
106
 
87
- declare function ChatWidget({ position, onAddToCart }: ChatWidgetProps): react_jsx_runtime.JSX.Element | null;
107
+ declare function ChatWidget({ position, onAddToCart, apiUrl, retrivoraApiBase, headers }: ChatWidgetProps): react_jsx_runtime.JSX.Element | null;
88
108
 
89
- declare function ChatWindow({ className, style, onClose, showClose, onResizeStart, onResetResize, isResized, onMaximize, isMaximized, onAddToCart }: ChatWindowProps): react_jsx_runtime.JSX.Element;
109
+ declare function ChatWindow({ className, style, onClose, showClose, onResizeStart, onResetResize, isResized, onMaximize, isMaximized, onAddToCart, apiUrl, retrivoraApiBase, headers }: ChatWindowProps): react_jsx_runtime.JSX.Element;
90
110
 
91
111
  declare function DocumentUpload({ namespace, onUploadComplete, className }: DocumentUploadProps): react_jsx_runtime.JSX.Element;
92
112
 
93
- declare function MessageBubble({ message, sources, isStreaming, primaryColor, accentColor, onAddToCart, viewportSize, }: MessageBubbleProps): react_jsx_runtime.JSX.Element;
113
+ declare function MessageBubble({ message, sources, isStreaming, primaryColor, accentColor, onAddToCart, viewportSize, onFeedback, }: MessageBubbleProps): react_jsx_runtime.JSX.Element;
94
114
 
95
115
  declare function SourceCard({ source, index }: SourceCardProps): react_jsx_runtime.JSX.Element;
96
116
 
@@ -103,6 +123,16 @@ declare function ObservabilityPanel({ trace, primaryColor }: ObservabilityPanelP
103
123
  declare function ConfigProvider({ config, children, }: ConfigProviderProps): react_jsx_runtime.JSX.Element;
104
124
  declare function useConfig(): ClientConfig;
105
125
 
126
+ declare function Hero(): react_jsx_runtime.JSX.Element;
127
+
128
+ declare function Lifecycle(): react_jsx_runtime.JSX.Element;
129
+
130
+ declare function ArchitectureCardsSection(): react_jsx_runtime.JSX.Element;
131
+
132
+ declare function Documentation(): react_jsx_runtime.JSX.Element;
133
+
134
+ declare function AmbientBackground(): react_jsx_runtime.JSX.Element;
135
+
106
136
  declare function useRagChat(projectId: string, options?: UseRagChatOptions): UseRagChatReturn;
107
137
 
108
138
  /**
@@ -111,4 +141,4 @@ declare function useRagChat(projectId: string, options?: UseRagChatOptions): Use
111
141
  */
112
142
  declare function addSynonyms(customSynonyms: Record<string, string[]>): void;
113
143
 
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 };
144
+ export { AmbientBackground, ArchitectureCardsSection, ChatWidget, type ChatWidgetProps, ChatWindow, type ChatWindowProps, type ClientConfig, ConfigProvider, DocumentUpload, type DocumentUploadProps, Documentation, Hero, Lifecycle, MessageBubble, type MessageBubbleProps, ObservabilityPanel, ObservabilityTrace, type ProductCardProps, type ProductCarouselProps, RagMessage, SourceCard, type SourceCardProps, UIConfig, UseRagChatOptions, UseRagChatReturn, VectorMatch, addSynonyms, useConfig, useRagChat };