@retrivora-ai/rag-engine 1.7.7 → 1.7.9

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.
@@ -1,4 +1,4 @@
1
- import { C as ChatMessage, c as ChatOptions } from './index-DfsVx0a4.js';
1
+ import { C as ChatMessage, c as ChatOptions } from './index-wCRqMtdX.js';
2
2
 
3
3
  /**
4
4
  * Generic LLM Provider interface.
@@ -1,4 +1,4 @@
1
- import { C as ChatMessage, c as ChatOptions } from './index-DfsVx0a4.mjs';
1
+ import { C as ChatMessage, c as ChatOptions } from './index-wCRqMtdX.mjs';
2
2
 
3
3
  /**
4
4
  * Generic LLM Provider interface.
@@ -1,3 +1,3 @@
1
- import '../index-DfsVx0a4.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, j as sseTextFrame, l as sseUIFrame } from '../index-B1u4loP6.mjs';
1
+ import '../index-wCRqMtdX.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, j as sseTextFrame, l as sseUIFrame } from '../index-DhsG2o5q.mjs';
3
3
  import 'next/server';
@@ -1,3 +1,3 @@
1
- import '../index-DfsVx0a4.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, j as sseTextFrame, l as sseUIFrame } from '../index-D9w9fLjh.js';
1
+ import '../index-wCRqMtdX.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, j as sseTextFrame, l as sseUIFrame } from '../index-BDqz2_Yu.js';
3
3
  import 'next/server';
@@ -1,4 +1,4 @@
1
- import { h as RagConfig, C as ChatMessage, d as ChatResponse, I as IngestDocument } from './index-DfsVx0a4.js';
1
+ import { h as RagConfig, C as ChatMessage, d as ChatResponse, I as IngestDocument } from './index-wCRqMtdX.js';
2
2
  import { NextRequest, NextResponse } from 'next/server';
3
3
 
4
4
  interface ValidationError {
@@ -1,4 +1,4 @@
1
- import { h as RagConfig, C as ChatMessage, d as ChatResponse, I as IngestDocument } from './index-DfsVx0a4.mjs';
1
+ import { h as RagConfig, C as ChatMessage, d as ChatResponse, I as IngestDocument } from './index-wCRqMtdX.mjs';
2
2
  import { NextRequest, NextResponse } from 'next/server';
3
3
 
4
4
  interface ValidationError {
@@ -6,7 +6,7 @@ interface ChatMessage {
6
6
  interface RagMessage extends ChatMessage {
7
7
  id: string;
8
8
  sources?: VectorMatch[];
9
- uiTransformation?: any;
9
+ uiTransformation?: unknown;
10
10
  createdAt: string;
11
11
  }
12
12
  interface ChatOptions {
@@ -6,7 +6,7 @@ interface ChatMessage {
6
6
  interface RagMessage extends ChatMessage {
7
7
  id: string;
8
8
  sources?: VectorMatch[];
9
- uiTransformation?: any;
9
+ uiTransformation?: unknown;
10
10
  createdAt: string;
11
11
  }
12
12
  interface ChatOptions {
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-DfsVx0a4.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-DfsVx0a4.mjs';
4
- export { C as Chunk, a as ChunkOptions, E as EmbedOptions, I as ILLMProvider } from './DocumentChunker-wKE98F_G.mjs';
2
+ import { P as Product, U as UIConfig, R as RagMessage, V as VectorMatch, a as UseRagChatOptions, b as UseRagChatReturn } from './index-wCRqMtdX.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-wCRqMtdX.mjs';
4
+ export { C as Chunk, a as ChunkOptions, E as EmbedOptions, I as ILLMProvider } from './DocumentChunker-DCuxrOdM.mjs';
5
5
 
6
6
  type ChatViewportSize = 'compact' | 'medium' | 'large';
7
7
  interface ChatWindowProps {
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-DfsVx0a4.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-DfsVx0a4.js';
4
- export { C as Chunk, a as ChunkOptions, E as EmbedOptions, I as ILLMProvider } from './DocumentChunker-DMZVv6hi.js';
2
+ import { P as Product, U as UIConfig, R as RagMessage, V as VectorMatch, a as UseRagChatOptions, b as UseRagChatReturn } from './index-wCRqMtdX.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-wCRqMtdX.js';
4
+ export { C as Chunk, a as ChunkOptions, E as EmbedOptions, I as ILLMProvider } from './DocumentChunker-Bmscbh-X.js';
5
5
 
6
6
  type ChatViewportSize = 'compact' | 'medium' | 'large';
7
7
  interface ChatWindowProps {
package/dist/index.js CHANGED
@@ -1203,7 +1203,7 @@ ${match.trim()}
1203
1203
  onAddToCart,
1204
1204
  viewportSize
1205
1205
  }
1206
- ), !shouldRenderStructuredOnly && /* @__PURE__ */ import_react5.default.createElement(import_react_markdown.default, { remarkPlugins: [import_remark_gfm.default], components: markdownComponents }, processedMarkdown), !isUser && !structuredContent.payload && message.uiTransformation && /* @__PURE__ */ import_react5.default.createElement("div", { className: "mt-4 border-t border-slate-100 dark:border-white/5 pt-4" }, /* @__PURE__ */ import_react5.default.createElement(VisualizationRenderer, { data: message.uiTransformation })), isStreaming && message.content && /* @__PURE__ */ import_react5.default.createElement("span", { className: "inline-block w-1.5 h-3.5 ml-1 bg-emerald-500 animate-pulse align-middle" }))
1206
+ ), !shouldRenderStructuredOnly && /* @__PURE__ */ import_react5.default.createElement(import_react_markdown.default, { remarkPlugins: [import_remark_gfm.default], components: markdownComponents }, processedMarkdown), !isUser && !structuredContent.payload && !!message.uiTransformation && /* @__PURE__ */ import_react5.default.createElement("div", { className: "mt-4 border-t border-slate-100 dark:border-white/5 pt-4" }, /* @__PURE__ */ import_react5.default.createElement(VisualizationRenderer, { data: message.uiTransformation })), isStreaming && message.content && /* @__PURE__ */ import_react5.default.createElement("span", { className: "inline-block w-1.5 h-3.5 ml-1 bg-emerald-500 animate-pulse align-middle" }))
1207
1207
  ), !isUser && !hasStructuredProductBlock && allProducts.length > 0 && /* @__PURE__ */ import_react5.default.createElement("div", { className: "w-full mt-1" }, /* @__PURE__ */ import_react5.default.createElement(
1208
1208
  ProductCarousel,
1209
1209
  {
package/dist/index.mjs CHANGED
@@ -1166,7 +1166,7 @@ ${match.trim()}
1166
1166
  onAddToCart,
1167
1167
  viewportSize
1168
1168
  }
1169
- ), !shouldRenderStructuredOnly && /* @__PURE__ */ React6.createElement(ReactMarkdown, { remarkPlugins: [remarkGfm], components: markdownComponents }, processedMarkdown), !isUser && !structuredContent.payload && message.uiTransformation && /* @__PURE__ */ React6.createElement("div", { className: "mt-4 border-t border-slate-100 dark:border-white/5 pt-4" }, /* @__PURE__ */ React6.createElement(VisualizationRenderer, { data: message.uiTransformation })), isStreaming && message.content && /* @__PURE__ */ React6.createElement("span", { className: "inline-block w-1.5 h-3.5 ml-1 bg-emerald-500 animate-pulse align-middle" }))
1169
+ ), !shouldRenderStructuredOnly && /* @__PURE__ */ React6.createElement(ReactMarkdown, { remarkPlugins: [remarkGfm], components: markdownComponents }, processedMarkdown), !isUser && !structuredContent.payload && !!message.uiTransformation && /* @__PURE__ */ React6.createElement("div", { className: "mt-4 border-t border-slate-100 dark:border-white/5 pt-4" }, /* @__PURE__ */ React6.createElement(VisualizationRenderer, { data: message.uiTransformation })), isStreaming && message.content && /* @__PURE__ */ React6.createElement("span", { className: "inline-block w-1.5 h-3.5 ml-1 bg-emerald-500 animate-pulse align-middle" }))
1170
1170
  ), !isUser && !hasStructuredProductBlock && allProducts.length > 0 && /* @__PURE__ */ React6.createElement("div", { className: "w-full mt-1" }, /* @__PURE__ */ React6.createElement(
1171
1171
  ProductCarousel,
1172
1172
  {
package/dist/server.d.mts CHANGED
@@ -1,8 +1,8 @@
1
- import { j as VectorDBConfig, L as LLMConfig, E as EmbeddingConfig, h as RagConfig, I as IngestDocument, C as ChatMessage, d as ChatResponse, l as RetrievalResult, i as UpsertDocument, V as VectorMatch, G as GraphDBConfig, m as GraphNode, n as Edge, o as GraphSearchResult, k as VectorDBProvider, f as LLMProvider, e as EmbeddingProvider, g as RAGConfig, U as UIConfig, c as ChatOptions } from './index-DfsVx0a4.mjs';
2
- import { I as ILLMProvider, E as EmbedOptions } from './DocumentChunker-wKE98F_G.mjs';
3
- export { C as Chunk, a as ChunkOptions, D as DocumentChunker } from './DocumentChunker-wKE98F_G.mjs';
4
- import { H as HealthCheckResult, I as IProviderValidator, a as IProviderHealthChecker } from './index-B1u4loP6.mjs';
5
- 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-B1u4loP6.mjs';
1
+ import { j as VectorDBConfig, L as LLMConfig, E as EmbeddingConfig, h as RagConfig, I as IngestDocument, C as ChatMessage, d as ChatResponse, l as RetrievalResult, i as UpsertDocument, V as VectorMatch, G as GraphDBConfig, m as GraphNode, n as Edge, o as GraphSearchResult, k as VectorDBProvider, f as LLMProvider, e as EmbeddingProvider, g as RAGConfig, U as UIConfig, c as ChatOptions } from './index-wCRqMtdX.mjs';
2
+ import { I as ILLMProvider, E as EmbedOptions } from './DocumentChunker-DCuxrOdM.mjs';
3
+ export { C as Chunk, a as ChunkOptions, D as DocumentChunker } from './DocumentChunker-DCuxrOdM.mjs';
4
+ import { H as HealthCheckResult, I as IProviderValidator, a as IProviderHealthChecker } from './index-DhsG2o5q.mjs';
5
+ 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-DhsG2o5q.mjs';
6
6
  import 'next/server';
7
7
 
8
8
  /**
package/dist/server.d.ts CHANGED
@@ -1,8 +1,8 @@
1
- import { j as VectorDBConfig, L as LLMConfig, E as EmbeddingConfig, h as RagConfig, I as IngestDocument, C as ChatMessage, d as ChatResponse, l as RetrievalResult, i as UpsertDocument, V as VectorMatch, G as GraphDBConfig, m as GraphNode, n as Edge, o as GraphSearchResult, k as VectorDBProvider, f as LLMProvider, e as EmbeddingProvider, g as RAGConfig, U as UIConfig, c as ChatOptions } from './index-DfsVx0a4.js';
2
- import { I as ILLMProvider, E as EmbedOptions } from './DocumentChunker-DMZVv6hi.js';
3
- export { C as Chunk, a as ChunkOptions, D as DocumentChunker } from './DocumentChunker-DMZVv6hi.js';
4
- import { H as HealthCheckResult, I as IProviderValidator, a as IProviderHealthChecker } from './index-D9w9fLjh.js';
5
- 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-D9w9fLjh.js';
1
+ import { j as VectorDBConfig, L as LLMConfig, E as EmbeddingConfig, h as RagConfig, I as IngestDocument, C as ChatMessage, d as ChatResponse, l as RetrievalResult, i as UpsertDocument, V as VectorMatch, G as GraphDBConfig, m as GraphNode, n as Edge, o as GraphSearchResult, k as VectorDBProvider, f as LLMProvider, e as EmbeddingProvider, g as RAGConfig, U as UIConfig, c as ChatOptions } from './index-wCRqMtdX.js';
2
+ import { I as ILLMProvider, E as EmbedOptions } from './DocumentChunker-Bmscbh-X.js';
3
+ export { C as Chunk, a as ChunkOptions, D as DocumentChunker } from './DocumentChunker-Bmscbh-X.js';
4
+ import { H as HealthCheckResult, I as IProviderValidator, a as IProviderHealthChecker } from './index-BDqz2_Yu.js';
5
+ 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-BDqz2_Yu.js';
6
6
  import 'next/server';
7
7
 
8
8
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@retrivora-ai/rag-engine",
3
- "version": "1.7.7",
3
+ "version": "1.7.9",
4
4
  "description": "Retrivora AI is a plug-and-play AI engine for RAG chat experiences — generic vector DB + LLM provider, embeddable or standalone.",
5
5
  "author": "Abhinav Alkuchi",
6
6
  "license": "MIT",
@@ -10,6 +10,7 @@ import { SourceCard } from './SourceCard';
10
10
  import { ProductCarousel } from './ProductCarousel';
11
11
  import { DynamicChart } from './DynamicChart';
12
12
  import { VisualizationRenderer } from './VisualizationRenderer';
13
+ import { UITransformationResponse } from '../utils/UITransformer';
13
14
 
14
15
  // ─── JSON sanitization ────────────────────────────────────────────────────────
15
16
  // Order matters: each step is a targeted fix, no step undoes a previous one.
@@ -990,9 +991,9 @@ export function MessageBubble({
990
991
  )}
991
992
 
992
993
  {/* Automated UI Fallback (if LLM failed to output structured block but UITransformer found data) */}
993
- {!isUser && !structuredContent.payload && message.uiTransformation && (
994
+ {!isUser && !structuredContent.payload && !!message.uiTransformation && (
994
995
  <div className="mt-4 border-t border-slate-100 dark:border-white/5 pt-4">
995
- <VisualizationRenderer data={message.uiTransformation} />
996
+ <VisualizationRenderer data={message.uiTransformation as UITransformationResponse} />
996
997
  </div>
997
998
  )}
998
999
 
@@ -27,7 +27,7 @@ import { useStoredMessages } from './useStoredMessages';
27
27
  interface SseTextFrame { type: 'text'; text: string }
28
28
  interface SseMetaFrame { type: 'metadata'; sources?: VectorMatch[] }
29
29
  interface SseErrorFrame { type: 'error'; error: string }
30
- interface SseUiFrame { type: 'ui_transformation'; data: any }
30
+ interface SseUiFrame { type: 'ui_transformation'; data: unknown }
31
31
  type SseFrame = SseTextFrame | SseMetaFrame | SseErrorFrame | SseUiFrame;
32
32
 
33
33
  /**
@@ -125,7 +125,7 @@ export function useRagChat(
125
125
  const decoder = new TextDecoder();
126
126
  let assistantContent = '';
127
127
  let sources: VectorMatch[] = [];
128
- let uiTransformation: any = null;
128
+ let uiTransformation: unknown = null;
129
129
  // Buffer for partial SSE frames that arrive split across reads
130
130
  let buffer = '';
131
131
 
@@ -174,7 +174,7 @@ export function useRagChat(
174
174
  ...msg,
175
175
  content: assistantContent,
176
176
  sources: sources.length > 0 ? sources : msg.sources,
177
- uiTransformation: uiTransformation || (msg as any).uiTransformation
177
+ uiTransformation: uiTransformation || (msg as RagMessage).uiTransformation
178
178
  }
179
179
  : msg
180
180
  )
package/src/types/chat.ts CHANGED
@@ -10,7 +10,7 @@ export interface ChatMessage {
10
10
  export interface RagMessage extends ChatMessage {
11
11
  id: string;
12
12
  sources?: VectorMatch[];
13
- uiTransformation?: any;
13
+ uiTransformation?: unknown;
14
14
  createdAt: string;
15
15
  }
16
16