@retrivora-ai/rag-engine 2.6.4 → 2.6.5

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.
@@ -16,10 +16,10 @@ import {
16
16
  sseObservabilityFrame,
17
17
  sseTextFrame,
18
18
  sseUIFrame
19
- } from "../chunk-T7XSD76K.mjs";
19
+ } from "../chunk-7PVV4TV2.mjs";
20
20
  import "../chunk-XYBKDJDW.mjs";
21
21
  import "../chunk-SG6XYLQE.mjs";
22
- import "../chunk-FMQN2K2D.mjs";
22
+ import "../chunk-4NRSH3VX.mjs";
23
23
  import "../chunk-BEPLYQBS.mjs";
24
24
  import "../chunk-UT6SZZEC.mjs";
25
25
  export {
@@ -1,5 +1,5 @@
1
1
  import { CSSProperties, MouseEvent, ReactNode, ElementType } from 'react';
2
- import { W as WidgetPosition, P as Product, U as UIConfig, a as ProjectChatSettings, R as RagMessage, V as VectorMatch, b as RagConfig, I as ILLMProvider, c as IngestDocument, C as ChatMessage, d as ChatResponse, e as RetrievalResult, f as UniversalRagConfig, g as UITransformationResponse, L as LLMConfig, E as EmbeddingConfig, h as VectorDBConfig } from './ILLMProvider-CzXcTA6d.mjs';
2
+ import { W as WidgetPosition, P as Product, U as UIConfig, a as ProjectChatSettings, R as RagMessage, V as VectorMatch, b as RagConfig, I as ILLMProvider, c as IngestDocument, C as ChatMessage, d as ChatResponse, e as RetrievalResult, f as UniversalRagConfig, g as UITransformationResponse, L as LLMConfig, E as EmbeddingConfig, h as VectorDBConfig } from './ILLMProvider-Csukdic7.mjs';
3
3
 
4
4
  interface ArchitectureCardProps {
5
5
  icon: ReactNode;
@@ -396,6 +396,8 @@ declare class Pipeline {
396
396
  private initialised;
397
397
  /** Namespace-specific static cold context cache for CAG */
398
398
  private coldContexts;
399
+ private semanticCache;
400
+ private docChunkHashes;
399
401
  constructor(config: RagConfig);
400
402
  /**
401
403
  * Expose the underlying LLM provider (set after initialize()).
@@ -1,5 +1,5 @@
1
1
  import { NextRequest } from 'next/server';
2
- import { b as RagConfig, I as ILLMProvider, C as ChatMessage, d as ChatResponse, c as IngestDocument } from './ILLMProvider-CzXcTA6d.js';
2
+ import { b as RagConfig, I as ILLMProvider, C as ChatMessage, d as ChatResponse, c as IngestDocument } from './ILLMProvider-Csukdic7.js';
3
3
 
4
4
  /**
5
5
  * Shared options accepted by every handler factory.
@@ -1,5 +1,5 @@
1
1
  import { NextRequest } from 'next/server';
2
- import { b as RagConfig, I as ILLMProvider, C as ChatMessage, d as ChatResponse, c as IngestDocument } from './ILLMProvider-CzXcTA6d.mjs';
2
+ import { b as RagConfig, I as ILLMProvider, C as ChatMessage, d as ChatResponse, c as IngestDocument } from './ILLMProvider-Csukdic7.mjs';
3
3
 
4
4
  /**
5
5
  * Shared options accepted by every handler factory.
@@ -1,5 +1,5 @@
1
1
  import { CSSProperties, MouseEvent, ReactNode, ElementType } from 'react';
2
- import { W as WidgetPosition, P as Product, U as UIConfig, a as ProjectChatSettings, R as RagMessage, V as VectorMatch, b as RagConfig, I as ILLMProvider, c as IngestDocument, C as ChatMessage, d as ChatResponse, e as RetrievalResult, f as UniversalRagConfig, g as UITransformationResponse, L as LLMConfig, E as EmbeddingConfig, h as VectorDBConfig } from './ILLMProvider-CzXcTA6d.js';
2
+ import { W as WidgetPosition, P as Product, U as UIConfig, a as ProjectChatSettings, R as RagMessage, V as VectorMatch, b as RagConfig, I as ILLMProvider, c as IngestDocument, C as ChatMessage, d as ChatResponse, e as RetrievalResult, f as UniversalRagConfig, g as UITransformationResponse, L as LLMConfig, E as EmbeddingConfig, h as VectorDBConfig } from './ILLMProvider-Csukdic7.js';
3
3
 
4
4
  interface ArchitectureCardProps {
5
5
  icon: ReactNode;
@@ -396,6 +396,8 @@ declare class Pipeline {
396
396
  private initialised;
397
397
  /** Namespace-specific static cold context cache for CAG */
398
398
  private coldContexts;
399
+ private semanticCache;
400
+ private docChunkHashes;
399
401
  constructor(config: RagConfig);
400
402
  /**
401
403
  * Expose the underlying LLM provider (set after initialize()).
package/dist/index.d.mts CHANGED
@@ -1,8 +1,8 @@
1
1
  import React$1 from 'react';
2
- import { C as ChatWidgetProps, a as ChatWindowProps, D as DocumentUploadProps, M as MessageBubbleProps, S as SourceCardProps, b as ConfigProviderProps, c as ClientConfig, P as ProductCardProps, d as ProductCarouselProps, e as ChatViewportSize, R as RemoteConfig } from './index-BST9Gzsv.mjs';
3
- export { A as AuthenticationException, B as BatchOptions, f as BatchProcessor, g as BatchResult, h as ChartType, i as Chunk, j as ChunkOptions, k as CircuitBreaker, l as CircuitBreakerOptions, m as ConfigFetcher, n as ConfigurationException, o as DecisionContext, E as EmbeddingFailedException, I as IRenderRule, p as IRendererStrategy, q as IntentCategory, L as LicenseTierConfig, r as LicenseValidationError, s as LicenseValidationRequest, t as LicenseValidationResponse, u as LicenseValidator, v as ProviderCredentials, w as ProviderNotFoundException, x as RateLimitException, y as RemoteEmbeddingConfig, z as RemoteLLMConfig, F as RemoteVectorConfig, G as RenderDecision, H as RenderType, J as RetrievalException, K as Retrivora, N as RetrivoraError, O as RetrivoraErrorCode, Q as SDKVersionUnsupportedError, T as SDK_VERSION, U as isTransientError } from './index-BST9Gzsv.mjs';
4
- import { O as ObservabilityTrace, P as Product, g as UITransformationResponse, i as UseRagChatOptions, j as UseRagChatReturn, a as ProjectChatSettings } from './ILLMProvider-CzXcTA6d.mjs';
5
- export { A as AuthMode, C as ChatMessage, k as ChatOptions, d as ChatResponse, l as EmbedOptions, E as EmbeddingConfig, m as EmbeddingProvider, I as ILLMProvider, c as IngestDocument, L as LLMConfig, n as LLMProvider, o as LatencyBreakdown, p as ProjectAiSettings, q as ProjectAuthSettings, r as ProjectBrandingSettings, s as ProjectTelemetrySettings, t as ProjectWidgetSettings, u as RAGConfig, b as RagConfig, R as RagMessage, v as RetrievalConfig, w as RetrievedChunk, T as ThemeMode, x as TokenUsage, U as UIConfig, f as UniversalRagConfig, y as UpsertDocument, h as VectorDBConfig, z as VectorDBProvider, V as VectorMatch, W as WidgetPosition, B as WorkflowConfig, D as createDefaultProjectSettings, F as normalizeProjectSettings, G as projectSettingsToUiConfig } from './ILLMProvider-CzXcTA6d.mjs';
2
+ import { C as ChatWidgetProps, a as ChatWindowProps, D as DocumentUploadProps, M as MessageBubbleProps, S as SourceCardProps, b as ConfigProviderProps, c as ClientConfig, P as ProductCardProps, d as ProductCarouselProps, e as ChatViewportSize, R as RemoteConfig } from './index-Bzpu_Ujt.mjs';
3
+ export { A as AuthenticationException, B as BatchOptions, f as BatchProcessor, g as BatchResult, h as ChartType, i as Chunk, j as ChunkOptions, k as CircuitBreaker, l as CircuitBreakerOptions, m as ConfigFetcher, n as ConfigurationException, o as DecisionContext, E as EmbeddingFailedException, I as IRenderRule, p as IRendererStrategy, q as IntentCategory, L as LicenseTierConfig, r as LicenseValidationError, s as LicenseValidationRequest, t as LicenseValidationResponse, u as LicenseValidator, v as ProviderCredentials, w as ProviderNotFoundException, x as RateLimitException, y as RemoteEmbeddingConfig, z as RemoteLLMConfig, F as RemoteVectorConfig, G as RenderDecision, H as RenderType, J as RetrievalException, K as Retrivora, N as RetrivoraError, O as RetrivoraErrorCode, Q as SDKVersionUnsupportedError, T as SDK_VERSION, U as isTransientError } from './index-Bzpu_Ujt.mjs';
4
+ import { O as ObservabilityTrace, P as Product, g as UITransformationResponse, i as UseRagChatOptions, j as UseRagChatReturn, a as ProjectChatSettings } from './ILLMProvider-Csukdic7.mjs';
5
+ export { A as AuthMode, C as ChatMessage, k as ChatOptions, d as ChatResponse, l as EmbedOptions, E as EmbeddingConfig, m as EmbeddingProvider, I as ILLMProvider, c as IngestDocument, L as LLMConfig, n as LLMProvider, o as LatencyBreakdown, p as ProjectAiSettings, q as ProjectAuthSettings, r as ProjectBrandingSettings, s as ProjectTelemetrySettings, t as ProjectWidgetSettings, u as RAGConfig, b as RagConfig, R as RagMessage, v as RetrievalConfig, w as RetrievedChunk, T as ThemeMode, x as TokenUsage, U as UIConfig, f as UniversalRagConfig, y as UpsertDocument, h as VectorDBConfig, z as VectorDBProvider, V as VectorMatch, W as WidgetPosition, B as WorkflowConfig, D as createDefaultProjectSettings, F as normalizeProjectSettings, G as projectSettingsToUiConfig } from './ILLMProvider-Csukdic7.mjs';
6
6
 
7
7
  /**
8
8
  * ChatWidget — Floating Action Button (FAB) that toggles the chat window.
package/dist/index.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import React$1 from 'react';
2
- import { C as ChatWidgetProps, a as ChatWindowProps, D as DocumentUploadProps, M as MessageBubbleProps, S as SourceCardProps, b as ConfigProviderProps, c as ClientConfig, P as ProductCardProps, d as ProductCarouselProps, e as ChatViewportSize, R as RemoteConfig } from './index-qLvtMUr-.js';
3
- export { A as AuthenticationException, B as BatchOptions, f as BatchProcessor, g as BatchResult, h as ChartType, i as Chunk, j as ChunkOptions, k as CircuitBreaker, l as CircuitBreakerOptions, m as ConfigFetcher, n as ConfigurationException, o as DecisionContext, E as EmbeddingFailedException, I as IRenderRule, p as IRendererStrategy, q as IntentCategory, L as LicenseTierConfig, r as LicenseValidationError, s as LicenseValidationRequest, t as LicenseValidationResponse, u as LicenseValidator, v as ProviderCredentials, w as ProviderNotFoundException, x as RateLimitException, y as RemoteEmbeddingConfig, z as RemoteLLMConfig, F as RemoteVectorConfig, G as RenderDecision, H as RenderType, J as RetrievalException, K as Retrivora, N as RetrivoraError, O as RetrivoraErrorCode, Q as SDKVersionUnsupportedError, T as SDK_VERSION, U as isTransientError } from './index-qLvtMUr-.js';
4
- import { O as ObservabilityTrace, P as Product, g as UITransformationResponse, i as UseRagChatOptions, j as UseRagChatReturn, a as ProjectChatSettings } from './ILLMProvider-CzXcTA6d.js';
5
- export { A as AuthMode, C as ChatMessage, k as ChatOptions, d as ChatResponse, l as EmbedOptions, E as EmbeddingConfig, m as EmbeddingProvider, I as ILLMProvider, c as IngestDocument, L as LLMConfig, n as LLMProvider, o as LatencyBreakdown, p as ProjectAiSettings, q as ProjectAuthSettings, r as ProjectBrandingSettings, s as ProjectTelemetrySettings, t as ProjectWidgetSettings, u as RAGConfig, b as RagConfig, R as RagMessage, v as RetrievalConfig, w as RetrievedChunk, T as ThemeMode, x as TokenUsage, U as UIConfig, f as UniversalRagConfig, y as UpsertDocument, h as VectorDBConfig, z as VectorDBProvider, V as VectorMatch, W as WidgetPosition, B as WorkflowConfig, D as createDefaultProjectSettings, F as normalizeProjectSettings, G as projectSettingsToUiConfig } from './ILLMProvider-CzXcTA6d.js';
2
+ import { C as ChatWidgetProps, a as ChatWindowProps, D as DocumentUploadProps, M as MessageBubbleProps, S as SourceCardProps, b as ConfigProviderProps, c as ClientConfig, P as ProductCardProps, d as ProductCarouselProps, e as ChatViewportSize, R as RemoteConfig } from './index-DYgeV_V5.js';
3
+ export { A as AuthenticationException, B as BatchOptions, f as BatchProcessor, g as BatchResult, h as ChartType, i as Chunk, j as ChunkOptions, k as CircuitBreaker, l as CircuitBreakerOptions, m as ConfigFetcher, n as ConfigurationException, o as DecisionContext, E as EmbeddingFailedException, I as IRenderRule, p as IRendererStrategy, q as IntentCategory, L as LicenseTierConfig, r as LicenseValidationError, s as LicenseValidationRequest, t as LicenseValidationResponse, u as LicenseValidator, v as ProviderCredentials, w as ProviderNotFoundException, x as RateLimitException, y as RemoteEmbeddingConfig, z as RemoteLLMConfig, F as RemoteVectorConfig, G as RenderDecision, H as RenderType, J as RetrievalException, K as Retrivora, N as RetrivoraError, O as RetrivoraErrorCode, Q as SDKVersionUnsupportedError, T as SDK_VERSION, U as isTransientError } from './index-DYgeV_V5.js';
4
+ import { O as ObservabilityTrace, P as Product, g as UITransformationResponse, i as UseRagChatOptions, j as UseRagChatReturn, a as ProjectChatSettings } from './ILLMProvider-Csukdic7.js';
5
+ export { A as AuthMode, C as ChatMessage, k as ChatOptions, d as ChatResponse, l as EmbedOptions, E as EmbeddingConfig, m as EmbeddingProvider, I as ILLMProvider, c as IngestDocument, L as LLMConfig, n as LLMProvider, o as LatencyBreakdown, p as ProjectAiSettings, q as ProjectAuthSettings, r as ProjectBrandingSettings, s as ProjectTelemetrySettings, t as ProjectWidgetSettings, u as RAGConfig, b as RagConfig, R as RagMessage, v as RetrievalConfig, w as RetrievedChunk, T as ThemeMode, x as TokenUsage, U as UIConfig, f as UniversalRagConfig, y as UpsertDocument, h as VectorDBConfig, z as VectorDBProvider, V as VectorMatch, W as WidgetPosition, B as WorkflowConfig, D as createDefaultProjectSettings, F as normalizeProjectSettings, G as projectSettingsToUiConfig } from './ILLMProvider-Csukdic7.js';
6
6
 
7
7
  /**
8
8
  * ChatWidget — Floating Action Button (FAB) that toggles the chat window.
package/dist/index.js CHANGED
@@ -360,7 +360,7 @@ function projectSettingsToUiConfig(settings) {
360
360
  // package.json
361
361
  var package_default = {
362
362
  name: "@retrivora-ai/rag-engine",
363
- version: "2.6.4",
363
+ version: "2.6.5",
364
364
  description: "Retrivora AI is a plug-and-play AI engine for RAG chat experiences \u2014 generic vector DB + LLM provider, embeddable or standalone.",
365
365
  author: "Abhinav Alkuchi",
366
366
  license: "UNLICENSED",
package/dist/index.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import {
3
3
  LicenseValidator
4
- } from "./chunk-OMQM7AN6.mjs";
4
+ } from "./chunk-SYI7TYRP.mjs";
5
5
  import {
6
6
  AuthenticationException,
7
7
  BatchProcessor,
@@ -23,10 +23,10 @@ import {
23
23
  createDefaultProjectSettings,
24
24
  normalizeProjectSettings,
25
25
  projectSettingsToUiConfig
26
- } from "./chunk-6ZZOZFK6.mjs";
26
+ } from "./chunk-PLODIWBN.mjs";
27
27
  import {
28
28
  SDK_VERSION
29
- } from "./chunk-FMQN2K2D.mjs";
29
+ } from "./chunk-4NRSH3VX.mjs";
30
30
  import {
31
31
  addSynonyms,
32
32
  resolveMetadataValue
package/dist/server.d.mts CHANGED
@@ -1,9 +1,9 @@
1
- import { b as RagConfig, f as UniversalRagConfig, h as VectorDBConfig, y as UpsertDocument, V as VectorMatch, H as GraphDBConfig, J as GraphNode, K as Edge, M as GraphSearchResult, L as LLMConfig, E as EmbeddingConfig, I as ILLMProvider, z as VectorDBProvider, n as LLMProvider, m as EmbeddingProvider, u as RAGConfig, U as UIConfig, C as ChatMessage, g as UITransformationResponse, k as ChatOptions, l as EmbedOptions, c as IngestDocument, d as ChatResponse } from './ILLMProvider-CzXcTA6d.mjs';
2
- export { A as AuthMode, N as BarChartData, Q as CarouselProduct, S as IRetriever, o as LatencyBreakdown, X as LineChartDataPoint, Y as MessageRole, Z as MetricCardData, O as ObservabilityTrace, _ as PieChartData, P as Product, p as ProjectAiSettings, q as ProjectAuthSettings, r as ProjectBrandingSettings, a as ProjectChatSettings, s as ProjectTelemetrySettings, t as ProjectWidgetSettings, R as RagMessage, v as RetrievalConfig, e as RetrievalResult, w as RetrievedChunk, $ as RetrivoraChunkMetadata, a0 as RetrivoraIngestedDocument, a1 as ScatterPlotDataPoint, a2 as SuggestionsResponse, a3 as TableData, T as ThemeMode, x as TokenUsage, i as UseRagChatOptions, j as UseRagChatReturn, a4 as VisualizationType, W as WidgetPosition, B as WorkflowConfig, D as createDefaultProjectSettings, F as normalizeProjectSettings, G as projectSettingsToUiConfig } from './ILLMProvider-CzXcTA6d.mjs';
3
- import { V as Pipeline, o as DecisionContext, q as IntentCategory, I as IRenderRule, G as RenderDecision, p as IRendererStrategy } from './index-BST9Gzsv.mjs';
4
- export { W as ArchitectureCardProps, A as AuthenticationException, B as BatchOptions, f as BatchProcessor, g as BatchResult, h as ChartType, e as ChatViewportSize, C as ChatWidgetProps, a as ChatWindowProps, i as Chunk, j as ChunkOptions, c as ClientConfig, m as ConfigFetcher, b as ConfigProviderProps, n as ConfigurationException, X as DocumentChunker, D as DocumentUploadProps, E as EmbeddingFailedException, Y as LicenseConfigResolver, L as LicenseTierConfig, r as LicenseValidationError, s as LicenseValidationRequest, t as LicenseValidationResponse, u as LicenseValidator, M as MessageBubbleProps, Z as PipelineStep, P as ProductCardProps, d as ProductCarouselProps, v as ProviderCredentials, w as ProviderNotFoundException, _ as ProviderPill, x as RateLimitException, R as RemoteConfig, y as RemoteEmbeddingConfig, z as RemoteLLMConfig, F as RemoteVectorConfig, $ as RenderSectionDecision, H as RenderType, J as RetrievalException, K as Retrivora, N as RetrivoraError, O as RetrivoraErrorCode, Q as SDKVersionUnsupportedError, T as SDK_VERSION, a0 as Snippet, S as SourceCardProps, a1 as wrapError } from './index-BST9Gzsv.mjs';
5
- import { I as IProviderValidator, a as IProviderHealthChecker, H as HealthCheckResult } from './index-BBbt5A2y.mjs';
6
- export { C as ConfigValidator, b as HandlerOptions, V as ValidationError, c as VectorPlugin, d as createChatHandler, e as createFeedbackHandler, f as createHealthHandler, g as createHistoryHandler, h as createIngestHandler, i as createLicenseHandler, j as createRagHandler, k as createSessionsHandler, l as createStreamHandler, m as createSuggestionsHandler, n as createUploadHandler, s as sseErrorFrame, o as sseFrame, p as sseMetaFrame, q as sseObservabilityFrame, r as sseTextFrame, t as sseUIFrame } from './index-BBbt5A2y.mjs';
1
+ import { b as RagConfig, f as UniversalRagConfig, h as VectorDBConfig, y as UpsertDocument, V as VectorMatch, H as GraphDBConfig, J as GraphNode, K as Edge, M as GraphSearchResult, L as LLMConfig, E as EmbeddingConfig, I as ILLMProvider, z as VectorDBProvider, n as LLMProvider, m as EmbeddingProvider, u as RAGConfig, U as UIConfig, C as ChatMessage, g as UITransformationResponse, k as ChatOptions, l as EmbedOptions, c as IngestDocument, d as ChatResponse } from './ILLMProvider-Csukdic7.mjs';
2
+ export { A as AuthMode, N as BarChartData, Q as CarouselProduct, S as IRetriever, o as LatencyBreakdown, X as LineChartDataPoint, Y as MessageRole, Z as MetricCardData, O as ObservabilityTrace, _ as PieChartData, P as Product, p as ProjectAiSettings, q as ProjectAuthSettings, r as ProjectBrandingSettings, a as ProjectChatSettings, s as ProjectTelemetrySettings, t as ProjectWidgetSettings, R as RagMessage, v as RetrievalConfig, e as RetrievalResult, w as RetrievedChunk, $ as RetrivoraChunkMetadata, a0 as RetrivoraIngestedDocument, a1 as ScatterPlotDataPoint, a2 as SuggestionsResponse, a3 as TableData, T as ThemeMode, x as TokenUsage, i as UseRagChatOptions, j as UseRagChatReturn, a4 as VisualizationType, W as WidgetPosition, B as WorkflowConfig, D as createDefaultProjectSettings, F as normalizeProjectSettings, G as projectSettingsToUiConfig } from './ILLMProvider-Csukdic7.mjs';
3
+ import { V as Pipeline, o as DecisionContext, q as IntentCategory, I as IRenderRule, G as RenderDecision, p as IRendererStrategy } from './index-Bzpu_Ujt.mjs';
4
+ export { W as ArchitectureCardProps, A as AuthenticationException, B as BatchOptions, f as BatchProcessor, g as BatchResult, h as ChartType, e as ChatViewportSize, C as ChatWidgetProps, a as ChatWindowProps, i as Chunk, j as ChunkOptions, c as ClientConfig, m as ConfigFetcher, b as ConfigProviderProps, n as ConfigurationException, X as DocumentChunker, D as DocumentUploadProps, E as EmbeddingFailedException, Y as LicenseConfigResolver, L as LicenseTierConfig, r as LicenseValidationError, s as LicenseValidationRequest, t as LicenseValidationResponse, u as LicenseValidator, M as MessageBubbleProps, Z as PipelineStep, P as ProductCardProps, d as ProductCarouselProps, v as ProviderCredentials, w as ProviderNotFoundException, _ as ProviderPill, x as RateLimitException, R as RemoteConfig, y as RemoteEmbeddingConfig, z as RemoteLLMConfig, F as RemoteVectorConfig, $ as RenderSectionDecision, H as RenderType, J as RetrievalException, K as Retrivora, N as RetrivoraError, O as RetrivoraErrorCode, Q as SDKVersionUnsupportedError, T as SDK_VERSION, a0 as Snippet, S as SourceCardProps, a1 as wrapError } from './index-Bzpu_Ujt.mjs';
5
+ import { I as IProviderValidator, a as IProviderHealthChecker, H as HealthCheckResult } from './index-CYhWkWaX.mjs';
6
+ export { C as ConfigValidator, b as HandlerOptions, V as ValidationError, c as VectorPlugin, d as createChatHandler, e as createFeedbackHandler, f as createHealthHandler, g as createHistoryHandler, h as createIngestHandler, i as createLicenseHandler, j as createRagHandler, k as createSessionsHandler, l as createStreamHandler, m as createSuggestionsHandler, n as createUploadHandler, s as sseErrorFrame, o as sseFrame, p as sseMetaFrame, q as sseObservabilityFrame, r as sseTextFrame, t as sseUIFrame } from './index-CYhWkWaX.mjs';
7
7
  import 'react';
8
8
  import 'next/server';
9
9
 
@@ -570,6 +570,176 @@ declare const VECTOR_PROFILES: {
570
570
  };
571
571
  };
572
572
 
573
+ /**
574
+ * Production RAG standard utilities:
575
+ * - NFKC text normalization & pre-embed SHA-256 deduplication
576
+ * - Contextual chunk headers (embed_text vs raw text)
577
+ * - Maximal Marginal Relevance (MMR) diversity re-selection
578
+ * - "Lost in the Middle" context packing
579
+ * - Untrusted <source> prompt isolation & citation validation
580
+ */
581
+ declare function normalizeRagText(text: string): string;
582
+ declare function computeRagContentHash(text: string): string;
583
+ declare function dedupeChunksByHash<T extends {
584
+ content: string;
585
+ metadata?: Record<string, any>;
586
+ }>(chunks: T[]): T[];
587
+ declare function buildContextualEmbedText(content: string, metadata?: Record<string, any>): string;
588
+ /**
589
+ * Maximal Marginal Relevance (MMR): balances query relevance with inter-chunk diversity.
590
+ */
591
+ declare function applyMMR<T extends {
592
+ score?: number;
593
+ content?: string;
594
+ }>(items: T[], k: number, lambda?: number): T[];
595
+ /**
596
+ * "Lost in the Middle" reordering:
597
+ * Places the strongest chunks at the start and end of the prompt context
598
+ * (e.g., [1, 2, 3, 4, 5] -> [1, 3, 5, 4, 2]).
599
+ */
600
+ declare function packLostInMiddle<T>(items: T[]): T[];
601
+ declare const UNTRUSTED_SOURCE_POLICY: string;
602
+ declare function wrapUntrustedSources<T extends {
603
+ content?: string;
604
+ metadata?: Record<string, any>;
605
+ }>(chunks: T[], charBudget?: number): {
606
+ contextBlock: string;
607
+ includedCount: number;
608
+ };
609
+ declare function validateCitations(answer: string, sourceCount: number): {
610
+ valid: boolean;
611
+ invalidCitations: number[];
612
+ };
613
+ /**
614
+ * Incremental Sync diff:
615
+ * Compares newly generated chunks (with stable IDs + contentHash) against
616
+ * previously stored `{ chunkId -> contentHash }` so only changed/new chunks
617
+ * are embedded and removed chunks are deleted.
618
+ */
619
+ declare function diffDocumentChunks<T extends {
620
+ id: string;
621
+ content: string;
622
+ metadata?: Record<string, any>;
623
+ }>(newChunks: T[], existingHashes: Record<string, string>): {
624
+ toUpsert: T[];
625
+ toDeleteIds: string[];
626
+ unchangedCount: number;
627
+ };
628
+ /**
629
+ * Small-to-Big (Parent-Child) chunking:
630
+ * Splits document into large parent sections (~1500 tokens / ~4800 chars)
631
+ * and smaller child chunks (~250 tokens / ~1000 chars) that carry `parentId`
632
+ * and `parentContent` in metadata for crisp matching + rich LLM context.
633
+ */
634
+ declare function buildParentChildChunks(docId: string, content: string, metadata?: Record<string, any>, parentChars?: number, childChars?: number, childOverlap?: number): Array<{
635
+ id: string;
636
+ content: string;
637
+ metadata: Record<string, any>;
638
+ }>;
639
+ /**
640
+ * Promotes child matches to their parent section (`metadata.parentContent`)
641
+ * and deduplicates multiple child hits from the same `parentId`.
642
+ */
643
+ declare function promoteParentContexts<T extends {
644
+ id: string | number;
645
+ content?: string;
646
+ score?: number;
647
+ metadata?: Record<string, any>;
648
+ }>(matches: T[]): T[];
649
+
650
+ /**
651
+ * Tenant-scoped Semantic Answer Cache.
652
+ *
653
+ * Caches RAG answers keyed by (namespace, filterKey) using cosine similarity
654
+ * over L2-normalized or raw query embeddings. Bounded LRU eviction + TTL +
655
+ * explicit namespace invalidation on document ingest/delete.
656
+ */
657
+ interface SemanticCacheEntry {
658
+ namespace: string;
659
+ filterKey: string;
660
+ queryVector: number[];
661
+ answer: string;
662
+ sources: any[];
663
+ createdAt: number;
664
+ }
665
+ declare class SemanticCache {
666
+ private entries;
667
+ private readonly maxEntries;
668
+ private readonly ttlMs;
669
+ private readonly defaultThreshold;
670
+ constructor(options?: {
671
+ maxEntries?: number;
672
+ ttlMs?: number;
673
+ threshold?: number;
674
+ });
675
+ get(namespace: string, queryVector: number[], filterKey?: string, threshold?: number): {
676
+ answer: string;
677
+ sources: any[];
678
+ score: number;
679
+ } | null;
680
+ set(namespace: string, queryVector: number[], filterKey: string, answer: string, sources: any[]): void;
681
+ invalidateNamespace(namespace: string): void;
682
+ clear(): void;
683
+ }
684
+
685
+ /**
686
+ * RAGEvaluator — Automated RAG Triad & Hallucination Assessment Engine.
687
+ *
688
+ * Implements the 3 gold-standard RAG quality metrics (Ragas & TruLens framework):
689
+ * 1. Context Relevance: Did the retrieval engine fetch documents directly relevant to the user query?
690
+ * 2. Faithfulness / Groundedness: Is the generated answer 100% truthful to the retrieved context (0% hallucinated)?
691
+ * 3. Answer Relevance: Did the LLM answer what the user asked without deflection or unprompted tangents?
692
+ */
693
+ interface RAGTriadScore {
694
+ contextRelevance: number;
695
+ faithfulness: number;
696
+ answerRelevance: number;
697
+ overallQuality: number;
698
+ isHallucinated: boolean;
699
+ reason?: string;
700
+ }
701
+ declare class RAGEvaluator {
702
+ /**
703
+ * Evaluate a RAG interaction across the full RAG Triad.
704
+ */
705
+ static evaluate(query: string, context: string, answer: string, llm?: ILLMProvider): Promise<RAGTriadScore>;
706
+ /**
707
+ * Deterministic fast keyword-overlap heuristic when LLM evaluation is not invoked.
708
+ */
709
+ private static deterministicHeuristic;
710
+ /**
711
+ * Retrieval Recall@k over a golden dataset: fraction of queries where at least
712
+ * one gold document/chunk ID appears in the top-k retrieved IDs.
713
+ */
714
+ static recallAtK(results: string[][], goldSets: Set<string>[], k?: number): number;
715
+ /**
716
+ * Mean Reciprocal Rank (MRR): average 1 / rank of the first relevant result.
717
+ */
718
+ static meanReciprocalRank(results: string[][], goldSets: Set<string>[]): number;
719
+ /**
720
+ * Runs a golden-set evaluation suite (supporting both answerable and unanswerable cases).
721
+ */
722
+ static runGoldenEval(cases: GoldenEvalCase[], runner: (question: string) => Promise<{
723
+ answer: string;
724
+ context: string;
725
+ retrievedIds: string[];
726
+ abstained?: boolean;
727
+ }>, llm?: ILLMProvider): Promise<GoldenEvalReport>;
728
+ }
729
+ interface GoldenEvalCase {
730
+ question: string;
731
+ expectedSourceIds: string[];
732
+ unanswerable?: boolean;
733
+ }
734
+ interface GoldenEvalReport {
735
+ totalCases: number;
736
+ recallAt5: number;
737
+ recallAt20: number;
738
+ mrr: number;
739
+ avgFaithfulness: number;
740
+ abstentionAccuracy: number;
741
+ }
742
+
573
743
  /**
574
744
  * DocumentParser — handles text extraction from various file formats.
575
745
  * Supported:
@@ -756,7 +926,7 @@ declare class HybridSearch {
756
926
 
757
927
  interface RerankOptions {
758
928
  /** Reranking provider: 'hybrid' | 'cohere' | 'jina' | 'llm' | 'keyword' (default: 'hybrid') */
759
- provider?: 'hybrid' | 'cohere' | 'jina' | 'llm' | 'keyword';
929
+ provider?: 'hybrid' | 'cohere' | 'jina' | 'cloudflare' | 'llm' | 'keyword';
760
930
  /** Cohere API Key if using cohere provider */
761
931
  cohereApiKey?: string;
762
932
  /** Cohere model (default: 'rerank-v3.5') */
@@ -774,6 +944,7 @@ declare class Reranker {
774
944
  /**
775
945
  * Cohere Rerank v3.5 API integration.
776
946
  */
947
+ private cloudflareRerank;
777
948
  private cohereRerank;
778
949
  /**
779
950
  * Jina AI Reranker v2 API integration.
@@ -797,33 +968,6 @@ declare class Reranker {
797
968
  private llmRerank;
798
969
  }
799
970
 
800
- /**
801
- * RAGEvaluator — Automated RAG Triad & Hallucination Assessment Engine.
802
- *
803
- * Implements the 3 gold-standard RAG quality metrics (Ragas & TruLens framework):
804
- * 1. Context Relevance: Did the retrieval engine fetch documents directly relevant to the user query?
805
- * 2. Faithfulness / Groundedness: Is the generated answer 100% truthful to the retrieved context (0% hallucinated)?
806
- * 3. Answer Relevance: Did the LLM answer what the user asked without deflection or unprompted tangents?
807
- */
808
- interface RAGTriadScore {
809
- contextRelevance: number;
810
- faithfulness: number;
811
- answerRelevance: number;
812
- overallQuality: number;
813
- isHallucinated: boolean;
814
- reason?: string;
815
- }
816
- declare class RAGEvaluator {
817
- /**
818
- * Evaluate a RAG interaction across the full RAG Triad.
819
- */
820
- static evaluate(query: string, context: string, answer: string, llm?: ILLMProvider): Promise<RAGTriadScore>;
821
- /**
822
- * Deterministic fast keyword-overlap heuristic when LLM evaluation is not invoked.
823
- */
824
- private static deterministicHeuristic;
825
- }
826
-
827
971
  /**
828
972
  * PIIMasker — Enterprise Personally Identifiable Information (PII) Redaction.
829
973
  *
@@ -1820,4 +1964,4 @@ declare function initializeTelemetryService(projectId: string, licenseKey: strin
1820
1964
  */
1821
1965
  declare function shutdownTelemetryService(): Promise<void>;
1822
1966
 
1823
- export { AnthropicProvider, BaseVectorProvider, CarouselRendererStrategy, ChartRendererStrategy, ChatMessage, ChatOptions, ChatResponse, ChromaDBProvider, ConfigBuilder, ConfigResolver, type CustomEmbeddingOptions, CustomEmbeddingProvider, DecisionContext, DocumentParser, Edge, EmbedOptions, EmbeddingConfig, EmbeddingProvider, EmbeddingStrategy, EmbeddingStrategyResolver, EventType, GraphNode, GraphSearchResult, GroqProvider, HealthCheckResult, HybridSearch, type HybridSearchOptions, ILLMProvider, IProviderHealthChecker, IProviderValidator, IRenderRule, IRendererStrategy, IngestDocument, IntentCategory, IntentClassifier, LLMConfig, LLMFactory, LLMProvider, LLM_PROFILES, LangChainAgent, type LicensePayload, LicenseVerifier, LicensedRetrivora, type LicensedRetrivoraOptions, MilvusProvider, MixedRendererStrategy, MongoDBProvider, MultiTablePostgresProvider, OllamaProvider, OpenAIProvider, type OptimizedPromptResult, PIIMasker, type PIIMaskerOptions, PRESETS, type ParsedTableResult, PineconeProvider, Pipeline, PostgreSQLProvider, PromptGuard, type PromptGuardResult, type PromptOptimizationOptions, PromptOptimizer, ProviderHealthCheck, ProviderRegistry, QdrantProvider, QwenProvider, RAGConfig, RAGEvaluator, type RAGTriadScore, RagConfig, RedisProvider, RenderDecision, RendererRegistry, type RerankOptions, Reranker, Rule1SpecificInfoRule, Rule2ComparisonRule, Rule3ProductDiscoveryRule, Rule4AnalyticalRule, Rule5MixedResponseRule, Rule6SmallResultSetRule, Rule7LargeTableRule, RuleEngine, type RuntimeTierConfig, TableRendererStrategy, type TelemetryEvent, TelemetryService, TextRendererStrategy, UIConfig, UITransformationResponse, UniversalLLMAdapter, UniversalRagConfig, UniversalTableParser, UniversalVectorProvider, UpsertDocument, VECTOR_PROFILES, VectorDBConfig, VectorDBProvider, VectorMatch, type VisionExtractOptions, VisionExtractor, VisualizationDecisionEngine, WeaviateProvider, createFromPreset, createRetrivora, decideVisualization, getRagConfig, getRuntimeConfig, getTelemetryService, initializeTelemetryService, injectRuntimeConfig, shutdownTelemetryService };
1967
+ export { AnthropicProvider, BaseVectorProvider, CarouselRendererStrategy, ChartRendererStrategy, ChatMessage, ChatOptions, ChatResponse, ChromaDBProvider, ConfigBuilder, ConfigResolver, type CustomEmbeddingOptions, CustomEmbeddingProvider, DecisionContext, DocumentParser, Edge, EmbedOptions, EmbeddingConfig, EmbeddingProvider, EmbeddingStrategy, EmbeddingStrategyResolver, EventType, type GoldenEvalCase, type GoldenEvalReport, GraphNode, GraphSearchResult, GroqProvider, HealthCheckResult, HybridSearch, type HybridSearchOptions, ILLMProvider, IProviderHealthChecker, IProviderValidator, IRenderRule, IRendererStrategy, IngestDocument, IntentCategory, IntentClassifier, LLMConfig, LLMFactory, LLMProvider, LLM_PROFILES, LangChainAgent, type LicensePayload, LicenseVerifier, LicensedRetrivora, type LicensedRetrivoraOptions, MilvusProvider, MixedRendererStrategy, MongoDBProvider, MultiTablePostgresProvider, OllamaProvider, OpenAIProvider, type OptimizedPromptResult, PIIMasker, type PIIMaskerOptions, PRESETS, type ParsedTableResult, PineconeProvider, Pipeline, PostgreSQLProvider, PromptGuard, type PromptGuardResult, type PromptOptimizationOptions, PromptOptimizer, ProviderHealthCheck, ProviderRegistry, QdrantProvider, QwenProvider, RAGConfig, RAGEvaluator, type RAGTriadScore, RagConfig, RedisProvider, RenderDecision, RendererRegistry, type RerankOptions, Reranker, Rule1SpecificInfoRule, Rule2ComparisonRule, Rule3ProductDiscoveryRule, Rule4AnalyticalRule, Rule5MixedResponseRule, Rule6SmallResultSetRule, Rule7LargeTableRule, RuleEngine, type RuntimeTierConfig, SemanticCache, type SemanticCacheEntry, TableRendererStrategy, type TelemetryEvent, TelemetryService, TextRendererStrategy, UIConfig, UITransformationResponse, UNTRUSTED_SOURCE_POLICY, UniversalLLMAdapter, UniversalRagConfig, UniversalTableParser, UniversalVectorProvider, UpsertDocument, VECTOR_PROFILES, VectorDBConfig, VectorDBProvider, VectorMatch, type VisionExtractOptions, VisionExtractor, VisualizationDecisionEngine, WeaviateProvider, applyMMR, buildContextualEmbedText, buildParentChildChunks, computeRagContentHash, createFromPreset, createRetrivora, decideVisualization, dedupeChunksByHash, diffDocumentChunks, getRagConfig, getRuntimeConfig, getTelemetryService, initializeTelemetryService, injectRuntimeConfig, normalizeRagText, packLostInMiddle, promoteParentContexts, shutdownTelemetryService, validateCitations, wrapUntrustedSources };