@retrivora-ai/rag-engine 2.3.1 → 2.3.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.
package/dist/server.d.mts CHANGED
@@ -1,54 +1,12 @@
1
- import { V as VectorDBConfig, L as LLMConfig, d as EmbeddingConfig, i as RagConfig, n as UniversalRagConfig, o as UpsertDocument, q as VectorMatch, G as GraphDBConfig, r as GraphNode, s as Edge, t as GraphSearchResult, I as ILLMProvider, p as VectorDBProvider, g as LLMProvider, e as EmbeddingProvider, R as RAGConfig, m as UIConfig, C as ChatMessage, b as ChatOptions, E as EmbedOptions } from './ILLMProvider-teTNQ1lh.mjs';
2
- export { B as BarChartData, u as CarouselProduct, c as ChatResponse, v as IRetriever, f as IngestDocument, h as LatencyBreakdown, w as LineChartDataPoint, M as MessageRole, x as MetricCardData, O as ObservabilityTrace, P as PieChartData, y as Product, j as RagMessage, k as RetrievalConfig, z as RetrievalResult, l as RetrievedChunk, A as RetrivoraChunkMetadata, D as RetrivoraIngestedDocument, S as ScatterPlotDataPoint, F as SuggestionsResponse, H as TableData, T as TokenUsage, J as UITransformationResponse, U as UseRagChatOptions, a as UseRagChatReturn, K as VisualizationType, W as WorkflowConfig } from './ILLMProvider-teTNQ1lh.mjs';
3
- import { I as IRenderRule, k as DecisionContext, m as IntentCategory, s as RenderDecision } from './BatchProcessor-7yV-UCHW.mjs';
4
- export { K as ArchitectureCardProps, A as AuthenticationException, B as BatchOptions, e as BatchProcessor, f as BatchResult, N as CarouselRendererStrategy, O as ChartRendererStrategy, g as ChartType, Q as ChatViewportSize, C as ChatWidgetProps, a as ChatWindowProps, h as Chunk, i as ChunkOptions, c as ClientConfig, b as ConfigProviderProps, j as ConfigurationException, T as DocumentChunker, D as DocumentUploadProps, E as EmbeddingFailedException, l as IRendererStrategy, n as IntentClassifier, L as LicenseValidationError, o as LicenseValidationRequest, p as LicenseValidationResponse, q as LicenseValidator, M as MessageBubbleProps, U as MixedRendererStrategy, W as Pipeline, X as PipelineStep, P as ProductCardProps, d as ProductCarouselProps, r as ProviderNotFoundException, Y as ProviderPill, R as RateLimitException, Z as RenderSectionDecision, t as RenderType, u as RendererRegistry, v as RetrievalException, w as Retrivora, x as RetrivoraError, y as RetrivoraErrorCode, z as RuleEngine, F as SDKVersionUnsupportedError, G as SDK_VERSION, _ as Snippet, S as SourceCardProps, $ as TableRendererStrategy, a0 as TextRendererStrategy, V as VisualizationDecisionEngine, H as decideVisualization, a1 as wrapError } from './BatchProcessor-7yV-UCHW.mjs';
5
- import { H as HealthCheckResult, I as IProviderValidator, a as IProviderHealthChecker } from './index-fnpaCuma.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 createRagHandler, j as createSessionsHandler, k as createStreamHandler, l as createUploadHandler, s as sseErrorFrame, m as sseFrame, n as sseMetaFrame, o as sseTextFrame } from './index-fnpaCuma.mjs';
1
+ import { V as VectorDBConfig, L as LLMConfig, d as EmbeddingConfig, i as RagConfig, n as UniversalRagConfig, o as UpsertDocument, q as VectorMatch, G as GraphDBConfig, r as GraphNode, s as Edge, t as GraphSearchResult, I as ILLMProvider, p as VectorDBProvider, g as LLMProvider, e as EmbeddingProvider, R as RAGConfig, m as UIConfig, u as UITransformationResponse, C as ChatMessage, b as ChatOptions, E as EmbedOptions } from './ILLMProvider-CcJ5N6XD.mjs';
2
+ export { B as BarChartData, v as CarouselProduct, c as ChatResponse, w as IRetriever, f as IngestDocument, h as LatencyBreakdown, x as LineChartDataPoint, M as MessageRole, y as MetricCardData, O as ObservabilityTrace, P as PieChartData, z as Product, j as RagMessage, k as RetrievalConfig, A as RetrievalResult, l as RetrievedChunk, D as RetrivoraChunkMetadata, F as RetrivoraIngestedDocument, S as ScatterPlotDataPoint, H as SuggestionsResponse, J as TableData, T as TokenUsage, U as UseRagChatOptions, a as UseRagChatReturn, K as VisualizationType, W as WorkflowConfig } from './ILLMProvider-CcJ5N6XD.mjs';
3
+ import { k as DecisionContext, m as IntentCategory, I as IRenderRule, r as RenderDecision, l as IRendererStrategy } from './BatchProcessor-tVzb9CdE.mjs';
4
+ export { F as ArchitectureCardProps, A as AuthenticationException, B as BatchOptions, e as BatchProcessor, f as BatchResult, g as ChartType, G as ChatViewportSize, C as ChatWidgetProps, a as ChatWindowProps, h as Chunk, i as ChunkOptions, c as ClientConfig, b as ConfigProviderProps, j as ConfigurationException, H as DocumentChunker, D as DocumentUploadProps, E as EmbeddingFailedException, L as LicenseValidationError, n as LicenseValidationRequest, o as LicenseValidationResponse, p as LicenseValidator, M as MessageBubbleProps, J as Pipeline, K as PipelineStep, P as ProductCardProps, d as ProductCarouselProps, q as ProviderNotFoundException, N as ProviderPill, R as RateLimitException, O as RenderSectionDecision, s as RenderType, t as RetrievalException, u as Retrivora, v as RetrivoraError, w as RetrivoraErrorCode, x as SDKVersionUnsupportedError, y as SDK_VERSION, Q as Snippet, S as SourceCardProps, T as wrapError } from './BatchProcessor-tVzb9CdE.mjs';
5
+ import { H as HealthCheckResult, I as IProviderValidator, a as IProviderHealthChecker } from './index-CL-zF6bD.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 createRagHandler, j as createSessionsHandler, k as createStreamHandler, l as createUploadHandler, s as sseErrorFrame, m as sseFrame, n as sseMetaFrame, o as sseTextFrame } from './index-CL-zF6bD.mjs';
7
7
  import 'react';
8
8
  import 'next/server';
9
9
 
10
- declare class Rule1SpecificInfoRule implements IRenderRule {
11
- readonly name = "Rule1SpecificInfo";
12
- readonly priority = 100;
13
- evaluate(context: DecisionContext, intent: IntentCategory): RenderDecision | null;
14
- }
15
-
16
- declare class Rule2ComparisonRule implements IRenderRule {
17
- readonly name = "Rule2Comparison";
18
- readonly priority = 90;
19
- evaluate(context: DecisionContext, intent: IntentCategory): RenderDecision | null;
20
- }
21
-
22
- declare class Rule3ProductDiscoveryRule implements IRenderRule {
23
- readonly name = "Rule3ProductDiscovery";
24
- readonly priority = 85;
25
- evaluate(context: DecisionContext, intent: IntentCategory): RenderDecision | null;
26
- }
27
-
28
- declare class Rule4AnalyticalRule implements IRenderRule {
29
- readonly name = "Rule4Analytical";
30
- readonly priority = 80;
31
- evaluate(context: DecisionContext, intent: IntentCategory): RenderDecision | null;
32
- }
33
-
34
- declare class Rule5MixedResponseRule implements IRenderRule {
35
- readonly name = "Rule5MixedResponse";
36
- readonly priority = 95;
37
- evaluate(context: DecisionContext, _intent: IntentCategory): RenderDecision | null;
38
- }
39
-
40
- declare class Rule6SmallResultSetRule implements IRenderRule {
41
- readonly name = "Rule6SmallResultSet";
42
- readonly priority = 110;
43
- evaluate(context: DecisionContext, _intent: IntentCategory): RenderDecision | null;
44
- }
45
-
46
- declare class Rule7LargeTableRule implements IRenderRule {
47
- readonly name = "Rule7LargeTable";
48
- readonly priority = 75;
49
- evaluate(context: DecisionContext, intent: IntentCategory): RenderDecision | null;
50
- }
51
-
52
10
  /**
53
11
  * Decoded payload of a Retrivora license JWT.
54
12
  *
@@ -573,6 +531,185 @@ declare class DocumentParser {
573
531
  private static readAsText;
574
532
  }
575
533
 
534
+ interface DataSignals {
535
+ rowCount: number;
536
+ hasNumericFields: boolean;
537
+ hasDateFields: boolean;
538
+ hasCategoricalFields: boolean;
539
+ isProductLike: boolean;
540
+ numericFieldCount: number;
541
+ categoricalFieldCount: number;
542
+ }
543
+ declare class IntentClassifier {
544
+ /**
545
+ * Fast, zero-latency classifier that maps a user query and optional data context
546
+ * into a high-level IntentCategory.
547
+ */
548
+ static classify(context: DecisionContext): {
549
+ intent: IntentCategory;
550
+ signals: DataSignals;
551
+ };
552
+ /**
553
+ * Extract key data structure signals from retrieved documents.
554
+ */
555
+ static extractDataSignals(context: DecisionContext): DataSignals;
556
+ private static isInformationLookup;
557
+ private static isComparisonQuery;
558
+ private static isProductQuery;
559
+ private static isRecommendationQuery;
560
+ private static isTrendQuery;
561
+ private static isRankingQuery;
562
+ private static isAnalyticsQuery;
563
+ }
564
+
565
+ declare class RuleEngine {
566
+ private rules;
567
+ constructor();
568
+ /**
569
+ * Register standard rules in priority order.
570
+ */
571
+ private registerDefaultRules;
572
+ /**
573
+ * Add or replace a rule in the engine.
574
+ * Automatically keeps rules sorted by descending priority.
575
+ */
576
+ registerRule(rule: IRenderRule): void;
577
+ /**
578
+ * Evaluate context against rules in descending priority order.
579
+ * Returns the first non-null RenderDecision.
580
+ */
581
+ evaluate(context: DecisionContext, intent: IntentCategory): RenderDecision;
582
+ /**
583
+ * List all registered rules.
584
+ */
585
+ getRegisteredRules(): Array<{
586
+ name: string;
587
+ priority: number;
588
+ }>;
589
+ }
590
+
591
+ declare class TextRendererStrategy implements IRendererStrategy {
592
+ readonly type = "text";
593
+ render(data: unknown, options?: Record<string, unknown>): UITransformationResponse;
594
+ }
595
+ declare class TableRendererStrategy implements IRendererStrategy {
596
+ readonly type = "table";
597
+ render(data: unknown, options?: Record<string, unknown>): UITransformationResponse;
598
+ }
599
+ declare class CarouselRendererStrategy implements IRendererStrategy {
600
+ readonly type = "carousel";
601
+ render(data: unknown, options?: Record<string, unknown>): UITransformationResponse;
602
+ }
603
+ declare class ChartRendererStrategy implements IRendererStrategy {
604
+ readonly type = "chart";
605
+ render(data: unknown, options?: Record<string, unknown>): UITransformationResponse;
606
+ }
607
+ declare class MixedRendererStrategy implements IRendererStrategy {
608
+ readonly type = "mixed";
609
+ render(data: unknown, options?: Record<string, unknown>): UITransformationResponse;
610
+ }
611
+ declare class RendererRegistry {
612
+ private static strategies;
613
+ /**
614
+ * Register a new renderer strategy.
615
+ * Enables seamless addition of custom visualizers (Timeline, Maps, Flow Diagrams, etc.).
616
+ */
617
+ static registerStrategy(strategy: IRendererStrategy): void;
618
+ /**
619
+ * Retrieve a registered renderer strategy by type string.
620
+ */
621
+ static getStrategy(type: string): IRendererStrategy;
622
+ /**
623
+ * Check if a renderer strategy is registered.
624
+ */
625
+ static hasStrategy(type: string): boolean;
626
+ /**
627
+ * List all registered strategy types.
628
+ */
629
+ static getRegisteredTypes(): string[];
630
+ }
631
+
632
+ /**
633
+ * High-Performance Visualization Decision Engine.
634
+ * Intelligently determines whether to render text, table, carousel, chart, or mixed sections
635
+ * BEFORE expensive visual generation or LLM visual calls execute.
636
+ */
637
+ declare class VisualizationDecisionEngine {
638
+ private static ruleEngine;
639
+ private static cache;
640
+ /**
641
+ * Evaluate user query, documents, and context to produce a RenderDecision.
642
+ * Execution time is < 1ms for cached or rule-matched queries.
643
+ */
644
+ static decideVisualization(userQuery: string, retrievedDocuments?: VectorMatch[], llmResponse?: string, metadata?: Record<string, unknown>): RenderDecision;
645
+ /**
646
+ * Convenience helper to decide AND render the data into a UITransformationResponse.
647
+ */
648
+ static render(userQuery: string, retrievedDocuments?: VectorMatch[], llmResponse?: string, metadata?: Record<string, unknown>): UITransformationResponse;
649
+ /**
650
+ * Register a custom rule in the rule engine.
651
+ */
652
+ static registerRule(rule: IRenderRule): void;
653
+ /**
654
+ * Register a custom renderer strategy.
655
+ */
656
+ static registerRendererStrategy(strategy: IRendererStrategy): void;
657
+ /**
658
+ * Clear the decision cache.
659
+ */
660
+ static clearCache(): void;
661
+ /**
662
+ * Get size of current decision cache.
663
+ */
664
+ static getCacheSize(): number;
665
+ }
666
+ /**
667
+ * Top-level function export matching prompt specification.
668
+ */
669
+ declare function decideVisualization(userQuery: string, retrievedDocuments?: VectorMatch[], llmResponse?: string, metadata?: Record<string, unknown>): RenderDecision;
670
+
671
+ declare class Rule1SpecificInfoRule implements IRenderRule {
672
+ readonly name = "Rule1SpecificInfo";
673
+ readonly priority = 100;
674
+ evaluate(context: DecisionContext, intent: IntentCategory): RenderDecision | null;
675
+ }
676
+
677
+ declare class Rule2ComparisonRule implements IRenderRule {
678
+ readonly name = "Rule2Comparison";
679
+ readonly priority = 90;
680
+ evaluate(context: DecisionContext, intent: IntentCategory): RenderDecision | null;
681
+ }
682
+
683
+ declare class Rule3ProductDiscoveryRule implements IRenderRule {
684
+ readonly name = "Rule3ProductDiscovery";
685
+ readonly priority = 85;
686
+ evaluate(context: DecisionContext, intent: IntentCategory): RenderDecision | null;
687
+ }
688
+
689
+ declare class Rule4AnalyticalRule implements IRenderRule {
690
+ readonly name = "Rule4Analytical";
691
+ readonly priority = 80;
692
+ evaluate(context: DecisionContext, intent: IntentCategory): RenderDecision | null;
693
+ }
694
+
695
+ declare class Rule5MixedResponseRule implements IRenderRule {
696
+ readonly name = "Rule5MixedResponse";
697
+ readonly priority = 95;
698
+ evaluate(context: DecisionContext, _intent: IntentCategory): RenderDecision | null;
699
+ }
700
+
701
+ declare class Rule6SmallResultSetRule implements IRenderRule {
702
+ readonly name = "Rule6SmallResultSet";
703
+ readonly priority = 110;
704
+ evaluate(context: DecisionContext, _intent: IntentCategory): RenderDecision | null;
705
+ }
706
+
707
+ declare class Rule7LargeTableRule implements IRenderRule {
708
+ readonly name = "Rule7LargeTable";
709
+ readonly priority = 75;
710
+ evaluate(context: DecisionContext, intent: IntentCategory): RenderDecision | null;
711
+ }
712
+
576
713
  /**
577
714
  * PineconeProvider — Pinecone vector database implementation.
578
715
  */
@@ -989,4 +1126,4 @@ declare class UniversalLLMAdapter implements ILLMProvider {
989
1126
  ping(): Promise<boolean>;
990
1127
  }
991
1128
 
992
- export { AnthropicProvider, BaseVectorProvider, ChatMessage, ChatOptions, ChromaDBProvider, ConfigBuilder, ConfigResolver, DecisionContext, DocumentParser, Edge, EmbedOptions, EmbeddingConfig, EmbeddingProvider, EmbeddingStrategy, EmbeddingStrategyResolver, GraphNode, GraphSearchResult, GroqProvider, HealthCheckResult, ILLMProvider, IProviderHealthChecker, IProviderValidator, IRenderRule, IntentCategory, LLMConfig, LLMFactory, LLMProvider, LLM_PROFILES, type LicensePayload, LicenseVerifier, MilvusProvider, MongoDBProvider, MultiTablePostgresProvider, OllamaProvider, OpenAIProvider, PRESETS, PineconeProvider, PostgreSQLProvider, ProviderHealthCheck, ProviderRegistry, QdrantProvider, QwenProvider, RAGConfig, RagConfig, RedisProvider, RenderDecision, Rule1SpecificInfoRule, Rule2ComparisonRule, Rule3ProductDiscoveryRule, Rule4AnalyticalRule, Rule5MixedResponseRule, Rule6SmallResultSetRule, Rule7LargeTableRule, UIConfig, UniversalLLMAdapter, UniversalRagConfig, UniversalVectorProvider, UpsertDocument, VECTOR_PROFILES, VectorDBConfig, VectorDBProvider, VectorMatch, WeaviateProvider, createFromPreset, getRagConfig };
1129
+ export { AnthropicProvider, BaseVectorProvider, CarouselRendererStrategy, ChartRendererStrategy, ChatMessage, ChatOptions, ChromaDBProvider, ConfigBuilder, ConfigResolver, DecisionContext, DocumentParser, Edge, EmbedOptions, EmbeddingConfig, EmbeddingProvider, EmbeddingStrategy, EmbeddingStrategyResolver, GraphNode, GraphSearchResult, GroqProvider, HealthCheckResult, ILLMProvider, IProviderHealthChecker, IProviderValidator, IRenderRule, IRendererStrategy, IntentCategory, IntentClassifier, LLMConfig, LLMFactory, LLMProvider, LLM_PROFILES, type LicensePayload, LicenseVerifier, MilvusProvider, MixedRendererStrategy, MongoDBProvider, MultiTablePostgresProvider, OllamaProvider, OpenAIProvider, PRESETS, PineconeProvider, PostgreSQLProvider, ProviderHealthCheck, ProviderRegistry, QdrantProvider, QwenProvider, RAGConfig, RagConfig, RedisProvider, RenderDecision, RendererRegistry, Rule1SpecificInfoRule, Rule2ComparisonRule, Rule3ProductDiscoveryRule, Rule4AnalyticalRule, Rule5MixedResponseRule, Rule6SmallResultSetRule, Rule7LargeTableRule, RuleEngine, TableRendererStrategy, TextRendererStrategy, UIConfig, UITransformationResponse, UniversalLLMAdapter, UniversalRagConfig, UniversalVectorProvider, UpsertDocument, VECTOR_PROFILES, VectorDBConfig, VectorDBProvider, VectorMatch, VisualizationDecisionEngine, WeaviateProvider, createFromPreset, decideVisualization, getRagConfig };
package/dist/server.d.ts CHANGED
@@ -1,54 +1,12 @@
1
- import { V as VectorDBConfig, L as LLMConfig, d as EmbeddingConfig, i as RagConfig, n as UniversalRagConfig, o as UpsertDocument, q as VectorMatch, G as GraphDBConfig, r as GraphNode, s as Edge, t as GraphSearchResult, I as ILLMProvider, p as VectorDBProvider, g as LLMProvider, e as EmbeddingProvider, R as RAGConfig, m as UIConfig, C as ChatMessage, b as ChatOptions, E as EmbedOptions } from './ILLMProvider-teTNQ1lh.js';
2
- export { B as BarChartData, u as CarouselProduct, c as ChatResponse, v as IRetriever, f as IngestDocument, h as LatencyBreakdown, w as LineChartDataPoint, M as MessageRole, x as MetricCardData, O as ObservabilityTrace, P as PieChartData, y as Product, j as RagMessage, k as RetrievalConfig, z as RetrievalResult, l as RetrievedChunk, A as RetrivoraChunkMetadata, D as RetrivoraIngestedDocument, S as ScatterPlotDataPoint, F as SuggestionsResponse, H as TableData, T as TokenUsage, J as UITransformationResponse, U as UseRagChatOptions, a as UseRagChatReturn, K as VisualizationType, W as WorkflowConfig } from './ILLMProvider-teTNQ1lh.js';
3
- import { I as IRenderRule, k as DecisionContext, m as IntentCategory, s as RenderDecision } from './BatchProcessor-BfzuU4cK.js';
4
- export { K as ArchitectureCardProps, A as AuthenticationException, B as BatchOptions, e as BatchProcessor, f as BatchResult, N as CarouselRendererStrategy, O as ChartRendererStrategy, g as ChartType, Q as ChatViewportSize, C as ChatWidgetProps, a as ChatWindowProps, h as Chunk, i as ChunkOptions, c as ClientConfig, b as ConfigProviderProps, j as ConfigurationException, T as DocumentChunker, D as DocumentUploadProps, E as EmbeddingFailedException, l as IRendererStrategy, n as IntentClassifier, L as LicenseValidationError, o as LicenseValidationRequest, p as LicenseValidationResponse, q as LicenseValidator, M as MessageBubbleProps, U as MixedRendererStrategy, W as Pipeline, X as PipelineStep, P as ProductCardProps, d as ProductCarouselProps, r as ProviderNotFoundException, Y as ProviderPill, R as RateLimitException, Z as RenderSectionDecision, t as RenderType, u as RendererRegistry, v as RetrievalException, w as Retrivora, x as RetrivoraError, y as RetrivoraErrorCode, z as RuleEngine, F as SDKVersionUnsupportedError, G as SDK_VERSION, _ as Snippet, S as SourceCardProps, $ as TableRendererStrategy, a0 as TextRendererStrategy, V as VisualizationDecisionEngine, H as decideVisualization, a1 as wrapError } from './BatchProcessor-BfzuU4cK.js';
5
- import { H as HealthCheckResult, I as IProviderValidator, a as IProviderHealthChecker } from './index-DR_O_B-W.js';
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 createRagHandler, j as createSessionsHandler, k as createStreamHandler, l as createUploadHandler, s as sseErrorFrame, m as sseFrame, n as sseMetaFrame, o as sseTextFrame } from './index-DR_O_B-W.js';
1
+ import { V as VectorDBConfig, L as LLMConfig, d as EmbeddingConfig, i as RagConfig, n as UniversalRagConfig, o as UpsertDocument, q as VectorMatch, G as GraphDBConfig, r as GraphNode, s as Edge, t as GraphSearchResult, I as ILLMProvider, p as VectorDBProvider, g as LLMProvider, e as EmbeddingProvider, R as RAGConfig, m as UIConfig, u as UITransformationResponse, C as ChatMessage, b as ChatOptions, E as EmbedOptions } from './ILLMProvider-CcJ5N6XD.js';
2
+ export { B as BarChartData, v as CarouselProduct, c as ChatResponse, w as IRetriever, f as IngestDocument, h as LatencyBreakdown, x as LineChartDataPoint, M as MessageRole, y as MetricCardData, O as ObservabilityTrace, P as PieChartData, z as Product, j as RagMessage, k as RetrievalConfig, A as RetrievalResult, l as RetrievedChunk, D as RetrivoraChunkMetadata, F as RetrivoraIngestedDocument, S as ScatterPlotDataPoint, H as SuggestionsResponse, J as TableData, T as TokenUsage, U as UseRagChatOptions, a as UseRagChatReturn, K as VisualizationType, W as WorkflowConfig } from './ILLMProvider-CcJ5N6XD.js';
3
+ import { k as DecisionContext, m as IntentCategory, I as IRenderRule, r as RenderDecision, l as IRendererStrategy } from './BatchProcessor-CQDtlggz.js';
4
+ export { F as ArchitectureCardProps, A as AuthenticationException, B as BatchOptions, e as BatchProcessor, f as BatchResult, g as ChartType, G as ChatViewportSize, C as ChatWidgetProps, a as ChatWindowProps, h as Chunk, i as ChunkOptions, c as ClientConfig, b as ConfigProviderProps, j as ConfigurationException, H as DocumentChunker, D as DocumentUploadProps, E as EmbeddingFailedException, L as LicenseValidationError, n as LicenseValidationRequest, o as LicenseValidationResponse, p as LicenseValidator, M as MessageBubbleProps, J as Pipeline, K as PipelineStep, P as ProductCardProps, d as ProductCarouselProps, q as ProviderNotFoundException, N as ProviderPill, R as RateLimitException, O as RenderSectionDecision, s as RenderType, t as RetrievalException, u as Retrivora, v as RetrivoraError, w as RetrivoraErrorCode, x as SDKVersionUnsupportedError, y as SDK_VERSION, Q as Snippet, S as SourceCardProps, T as wrapError } from './BatchProcessor-CQDtlggz.js';
5
+ import { H as HealthCheckResult, I as IProviderValidator, a as IProviderHealthChecker } from './index-BwmyPJHp.js';
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 createRagHandler, j as createSessionsHandler, k as createStreamHandler, l as createUploadHandler, s as sseErrorFrame, m as sseFrame, n as sseMetaFrame, o as sseTextFrame } from './index-BwmyPJHp.js';
7
7
  import 'react';
8
8
  import 'next/server';
9
9
 
10
- declare class Rule1SpecificInfoRule implements IRenderRule {
11
- readonly name = "Rule1SpecificInfo";
12
- readonly priority = 100;
13
- evaluate(context: DecisionContext, intent: IntentCategory): RenderDecision | null;
14
- }
15
-
16
- declare class Rule2ComparisonRule implements IRenderRule {
17
- readonly name = "Rule2Comparison";
18
- readonly priority = 90;
19
- evaluate(context: DecisionContext, intent: IntentCategory): RenderDecision | null;
20
- }
21
-
22
- declare class Rule3ProductDiscoveryRule implements IRenderRule {
23
- readonly name = "Rule3ProductDiscovery";
24
- readonly priority = 85;
25
- evaluate(context: DecisionContext, intent: IntentCategory): RenderDecision | null;
26
- }
27
-
28
- declare class Rule4AnalyticalRule implements IRenderRule {
29
- readonly name = "Rule4Analytical";
30
- readonly priority = 80;
31
- evaluate(context: DecisionContext, intent: IntentCategory): RenderDecision | null;
32
- }
33
-
34
- declare class Rule5MixedResponseRule implements IRenderRule {
35
- readonly name = "Rule5MixedResponse";
36
- readonly priority = 95;
37
- evaluate(context: DecisionContext, _intent: IntentCategory): RenderDecision | null;
38
- }
39
-
40
- declare class Rule6SmallResultSetRule implements IRenderRule {
41
- readonly name = "Rule6SmallResultSet";
42
- readonly priority = 110;
43
- evaluate(context: DecisionContext, _intent: IntentCategory): RenderDecision | null;
44
- }
45
-
46
- declare class Rule7LargeTableRule implements IRenderRule {
47
- readonly name = "Rule7LargeTable";
48
- readonly priority = 75;
49
- evaluate(context: DecisionContext, intent: IntentCategory): RenderDecision | null;
50
- }
51
-
52
10
  /**
53
11
  * Decoded payload of a Retrivora license JWT.
54
12
  *
@@ -573,6 +531,185 @@ declare class DocumentParser {
573
531
  private static readAsText;
574
532
  }
575
533
 
534
+ interface DataSignals {
535
+ rowCount: number;
536
+ hasNumericFields: boolean;
537
+ hasDateFields: boolean;
538
+ hasCategoricalFields: boolean;
539
+ isProductLike: boolean;
540
+ numericFieldCount: number;
541
+ categoricalFieldCount: number;
542
+ }
543
+ declare class IntentClassifier {
544
+ /**
545
+ * Fast, zero-latency classifier that maps a user query and optional data context
546
+ * into a high-level IntentCategory.
547
+ */
548
+ static classify(context: DecisionContext): {
549
+ intent: IntentCategory;
550
+ signals: DataSignals;
551
+ };
552
+ /**
553
+ * Extract key data structure signals from retrieved documents.
554
+ */
555
+ static extractDataSignals(context: DecisionContext): DataSignals;
556
+ private static isInformationLookup;
557
+ private static isComparisonQuery;
558
+ private static isProductQuery;
559
+ private static isRecommendationQuery;
560
+ private static isTrendQuery;
561
+ private static isRankingQuery;
562
+ private static isAnalyticsQuery;
563
+ }
564
+
565
+ declare class RuleEngine {
566
+ private rules;
567
+ constructor();
568
+ /**
569
+ * Register standard rules in priority order.
570
+ */
571
+ private registerDefaultRules;
572
+ /**
573
+ * Add or replace a rule in the engine.
574
+ * Automatically keeps rules sorted by descending priority.
575
+ */
576
+ registerRule(rule: IRenderRule): void;
577
+ /**
578
+ * Evaluate context against rules in descending priority order.
579
+ * Returns the first non-null RenderDecision.
580
+ */
581
+ evaluate(context: DecisionContext, intent: IntentCategory): RenderDecision;
582
+ /**
583
+ * List all registered rules.
584
+ */
585
+ getRegisteredRules(): Array<{
586
+ name: string;
587
+ priority: number;
588
+ }>;
589
+ }
590
+
591
+ declare class TextRendererStrategy implements IRendererStrategy {
592
+ readonly type = "text";
593
+ render(data: unknown, options?: Record<string, unknown>): UITransformationResponse;
594
+ }
595
+ declare class TableRendererStrategy implements IRendererStrategy {
596
+ readonly type = "table";
597
+ render(data: unknown, options?: Record<string, unknown>): UITransformationResponse;
598
+ }
599
+ declare class CarouselRendererStrategy implements IRendererStrategy {
600
+ readonly type = "carousel";
601
+ render(data: unknown, options?: Record<string, unknown>): UITransformationResponse;
602
+ }
603
+ declare class ChartRendererStrategy implements IRendererStrategy {
604
+ readonly type = "chart";
605
+ render(data: unknown, options?: Record<string, unknown>): UITransformationResponse;
606
+ }
607
+ declare class MixedRendererStrategy implements IRendererStrategy {
608
+ readonly type = "mixed";
609
+ render(data: unknown, options?: Record<string, unknown>): UITransformationResponse;
610
+ }
611
+ declare class RendererRegistry {
612
+ private static strategies;
613
+ /**
614
+ * Register a new renderer strategy.
615
+ * Enables seamless addition of custom visualizers (Timeline, Maps, Flow Diagrams, etc.).
616
+ */
617
+ static registerStrategy(strategy: IRendererStrategy): void;
618
+ /**
619
+ * Retrieve a registered renderer strategy by type string.
620
+ */
621
+ static getStrategy(type: string): IRendererStrategy;
622
+ /**
623
+ * Check if a renderer strategy is registered.
624
+ */
625
+ static hasStrategy(type: string): boolean;
626
+ /**
627
+ * List all registered strategy types.
628
+ */
629
+ static getRegisteredTypes(): string[];
630
+ }
631
+
632
+ /**
633
+ * High-Performance Visualization Decision Engine.
634
+ * Intelligently determines whether to render text, table, carousel, chart, or mixed sections
635
+ * BEFORE expensive visual generation or LLM visual calls execute.
636
+ */
637
+ declare class VisualizationDecisionEngine {
638
+ private static ruleEngine;
639
+ private static cache;
640
+ /**
641
+ * Evaluate user query, documents, and context to produce a RenderDecision.
642
+ * Execution time is < 1ms for cached or rule-matched queries.
643
+ */
644
+ static decideVisualization(userQuery: string, retrievedDocuments?: VectorMatch[], llmResponse?: string, metadata?: Record<string, unknown>): RenderDecision;
645
+ /**
646
+ * Convenience helper to decide AND render the data into a UITransformationResponse.
647
+ */
648
+ static render(userQuery: string, retrievedDocuments?: VectorMatch[], llmResponse?: string, metadata?: Record<string, unknown>): UITransformationResponse;
649
+ /**
650
+ * Register a custom rule in the rule engine.
651
+ */
652
+ static registerRule(rule: IRenderRule): void;
653
+ /**
654
+ * Register a custom renderer strategy.
655
+ */
656
+ static registerRendererStrategy(strategy: IRendererStrategy): void;
657
+ /**
658
+ * Clear the decision cache.
659
+ */
660
+ static clearCache(): void;
661
+ /**
662
+ * Get size of current decision cache.
663
+ */
664
+ static getCacheSize(): number;
665
+ }
666
+ /**
667
+ * Top-level function export matching prompt specification.
668
+ */
669
+ declare function decideVisualization(userQuery: string, retrievedDocuments?: VectorMatch[], llmResponse?: string, metadata?: Record<string, unknown>): RenderDecision;
670
+
671
+ declare class Rule1SpecificInfoRule implements IRenderRule {
672
+ readonly name = "Rule1SpecificInfo";
673
+ readonly priority = 100;
674
+ evaluate(context: DecisionContext, intent: IntentCategory): RenderDecision | null;
675
+ }
676
+
677
+ declare class Rule2ComparisonRule implements IRenderRule {
678
+ readonly name = "Rule2Comparison";
679
+ readonly priority = 90;
680
+ evaluate(context: DecisionContext, intent: IntentCategory): RenderDecision | null;
681
+ }
682
+
683
+ declare class Rule3ProductDiscoveryRule implements IRenderRule {
684
+ readonly name = "Rule3ProductDiscovery";
685
+ readonly priority = 85;
686
+ evaluate(context: DecisionContext, intent: IntentCategory): RenderDecision | null;
687
+ }
688
+
689
+ declare class Rule4AnalyticalRule implements IRenderRule {
690
+ readonly name = "Rule4Analytical";
691
+ readonly priority = 80;
692
+ evaluate(context: DecisionContext, intent: IntentCategory): RenderDecision | null;
693
+ }
694
+
695
+ declare class Rule5MixedResponseRule implements IRenderRule {
696
+ readonly name = "Rule5MixedResponse";
697
+ readonly priority = 95;
698
+ evaluate(context: DecisionContext, _intent: IntentCategory): RenderDecision | null;
699
+ }
700
+
701
+ declare class Rule6SmallResultSetRule implements IRenderRule {
702
+ readonly name = "Rule6SmallResultSet";
703
+ readonly priority = 110;
704
+ evaluate(context: DecisionContext, _intent: IntentCategory): RenderDecision | null;
705
+ }
706
+
707
+ declare class Rule7LargeTableRule implements IRenderRule {
708
+ readonly name = "Rule7LargeTable";
709
+ readonly priority = 75;
710
+ evaluate(context: DecisionContext, intent: IntentCategory): RenderDecision | null;
711
+ }
712
+
576
713
  /**
577
714
  * PineconeProvider — Pinecone vector database implementation.
578
715
  */
@@ -989,4 +1126,4 @@ declare class UniversalLLMAdapter implements ILLMProvider {
989
1126
  ping(): Promise<boolean>;
990
1127
  }
991
1128
 
992
- export { AnthropicProvider, BaseVectorProvider, ChatMessage, ChatOptions, ChromaDBProvider, ConfigBuilder, ConfigResolver, DecisionContext, DocumentParser, Edge, EmbedOptions, EmbeddingConfig, EmbeddingProvider, EmbeddingStrategy, EmbeddingStrategyResolver, GraphNode, GraphSearchResult, GroqProvider, HealthCheckResult, ILLMProvider, IProviderHealthChecker, IProviderValidator, IRenderRule, IntentCategory, LLMConfig, LLMFactory, LLMProvider, LLM_PROFILES, type LicensePayload, LicenseVerifier, MilvusProvider, MongoDBProvider, MultiTablePostgresProvider, OllamaProvider, OpenAIProvider, PRESETS, PineconeProvider, PostgreSQLProvider, ProviderHealthCheck, ProviderRegistry, QdrantProvider, QwenProvider, RAGConfig, RagConfig, RedisProvider, RenderDecision, Rule1SpecificInfoRule, Rule2ComparisonRule, Rule3ProductDiscoveryRule, Rule4AnalyticalRule, Rule5MixedResponseRule, Rule6SmallResultSetRule, Rule7LargeTableRule, UIConfig, UniversalLLMAdapter, UniversalRagConfig, UniversalVectorProvider, UpsertDocument, VECTOR_PROFILES, VectorDBConfig, VectorDBProvider, VectorMatch, WeaviateProvider, createFromPreset, getRagConfig };
1129
+ export { AnthropicProvider, BaseVectorProvider, CarouselRendererStrategy, ChartRendererStrategy, ChatMessage, ChatOptions, ChromaDBProvider, ConfigBuilder, ConfigResolver, DecisionContext, DocumentParser, Edge, EmbedOptions, EmbeddingConfig, EmbeddingProvider, EmbeddingStrategy, EmbeddingStrategyResolver, GraphNode, GraphSearchResult, GroqProvider, HealthCheckResult, ILLMProvider, IProviderHealthChecker, IProviderValidator, IRenderRule, IRendererStrategy, IntentCategory, IntentClassifier, LLMConfig, LLMFactory, LLMProvider, LLM_PROFILES, type LicensePayload, LicenseVerifier, MilvusProvider, MixedRendererStrategy, MongoDBProvider, MultiTablePostgresProvider, OllamaProvider, OpenAIProvider, PRESETS, PineconeProvider, PostgreSQLProvider, ProviderHealthCheck, ProviderRegistry, QdrantProvider, QwenProvider, RAGConfig, RagConfig, RedisProvider, RenderDecision, RendererRegistry, Rule1SpecificInfoRule, Rule2ComparisonRule, Rule3ProductDiscoveryRule, Rule4AnalyticalRule, Rule5MixedResponseRule, Rule6SmallResultSetRule, Rule7LargeTableRule, RuleEngine, TableRendererStrategy, TextRendererStrategy, UIConfig, UITransformationResponse, UniversalLLMAdapter, UniversalRagConfig, UniversalVectorProvider, UpsertDocument, VECTOR_PROFILES, VectorDBConfig, VectorDBProvider, VectorMatch, VisualizationDecisionEngine, WeaviateProvider, createFromPreset, decideVisualization, getRagConfig };
package/dist/server.js CHANGED
@@ -1355,7 +1355,6 @@ var init_MilvusProvider = __esm({
1355
1355
  metadata: res["metadata"] || {}
1356
1356
  }));
1357
1357
  }
1358
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
1359
1358
  async delete(id, _namespace) {
1360
1359
  await this.http.post("/v1/vector/delete", {
1361
1360
  collectionName: this.indexName,
@@ -1780,7 +1779,6 @@ var init_RedisProvider = __esm({
1780
1779
  await this.upsert(doc, namespace);
1781
1780
  }
1782
1781
  }
1783
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
1784
1782
  async query(vector, topK, namespace, _filter) {
1785
1783
  const payload = {
1786
1784
  index: this.indexName,
@@ -1917,7 +1915,6 @@ var init_WeaviateProvider = __esm({
1917
1915
  metadata: res["metadata"] ? JSON.parse(res["metadata"]) : {}
1918
1916
  }));
1919
1917
  }
1920
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
1921
1918
  async delete(id, _namespace) {
1922
1919
  await this.http.delete(`/v1/objects/${this.indexName}/${id}`);
1923
1920
  }
@@ -4824,7 +4821,7 @@ var ConfigValidator = class {
4824
4821
  // package.json
4825
4822
  var package_default = {
4826
4823
  name: "@retrivora-ai/rag-engine",
4827
- version: "2.3.1",
4824
+ version: "2.3.3",
4828
4825
  description: "Retrivora AI is a plug-and-play AI engine for RAG chat experiences \u2014 generic vector DB + LLM provider, embeddable or standalone.",
4829
4826
  author: "Abhinav Alkuchi",
4830
4827
  license: "UNLICENSED",
@@ -4903,6 +4900,7 @@ var package_default = {
4903
4900
  build: "npm run build:pkg",
4904
4901
  "build:pkg": "npx @tailwindcss/cli -i src/tailwind.css -o src/index.css && tsup src/index.ts src/handlers/index.ts src/server.ts --format cjs,esm --dts --clean --no-splitting --tsconfig tsconfig.build.json --external react,react-dom,next,mongodb,pg,openai,@anthropic-ai/sdk,@pinecone-database/pinecone,axios,lucide-react,mammoth,pdf-parse,xlsx,react-markdown,remark-gfm,next-themes,langchain,@langchain/core,@langchain/openai,llamaindex --inject-style && npx @tailwindcss/cli -i src/tailwind.css -o dist/index.css",
4905
4902
  lint: "eslint",
4903
+ typecheck: "tsc --noEmit -p tsconfig.build.json",
4906
4904
  clean: "rm -rf dist"
4907
4905
  },
4908
4906
  peerDependencies: {
@@ -5289,7 +5287,6 @@ When presenting structured data, statistics, or comparisons, decide if it is bes
5289
5287
  finalSystemPrompt += chartInstruction;
5290
5288
  }
5291
5289
  this.agent = createAgent({
5292
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
5293
5290
  model: chatModel,
5294
5291
  tools: [searchTool],
5295
5292
  systemPrompt: finalSystemPrompt
package/dist/server.mjs CHANGED
@@ -1340,7 +1340,6 @@ var init_MilvusProvider = __esm({
1340
1340
  metadata: res["metadata"] || {}
1341
1341
  }));
1342
1342
  }
1343
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
1344
1343
  async delete(id, _namespace) {
1345
1344
  await this.http.post("/v1/vector/delete", {
1346
1345
  collectionName: this.indexName,
@@ -1765,7 +1764,6 @@ var init_RedisProvider = __esm({
1765
1764
  await this.upsert(doc, namespace);
1766
1765
  }
1767
1766
  }
1768
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
1769
1767
  async query(vector, topK, namespace, _filter) {
1770
1768
  const payload = {
1771
1769
  index: this.indexName,
@@ -1902,7 +1900,6 @@ var init_WeaviateProvider = __esm({
1902
1900
  metadata: res["metadata"] ? JSON.parse(res["metadata"]) : {}
1903
1901
  }));
1904
1902
  }
1905
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
1906
1903
  async delete(id, _namespace) {
1907
1904
  await this.http.delete(`/v1/objects/${this.indexName}/${id}`);
1908
1905
  }
@@ -4724,7 +4721,7 @@ var ConfigValidator = class {
4724
4721
  // package.json
4725
4722
  var package_default = {
4726
4723
  name: "@retrivora-ai/rag-engine",
4727
- version: "2.3.1",
4724
+ version: "2.3.3",
4728
4725
  description: "Retrivora AI is a plug-and-play AI engine for RAG chat experiences \u2014 generic vector DB + LLM provider, embeddable or standalone.",
4729
4726
  author: "Abhinav Alkuchi",
4730
4727
  license: "UNLICENSED",
@@ -4803,6 +4800,7 @@ var package_default = {
4803
4800
  build: "npm run build:pkg",
4804
4801
  "build:pkg": "npx @tailwindcss/cli -i src/tailwind.css -o src/index.css && tsup src/index.ts src/handlers/index.ts src/server.ts --format cjs,esm --dts --clean --no-splitting --tsconfig tsconfig.build.json --external react,react-dom,next,mongodb,pg,openai,@anthropic-ai/sdk,@pinecone-database/pinecone,axios,lucide-react,mammoth,pdf-parse,xlsx,react-markdown,remark-gfm,next-themes,langchain,@langchain/core,@langchain/openai,llamaindex --inject-style && npx @tailwindcss/cli -i src/tailwind.css -o dist/index.css",
4805
4802
  lint: "eslint",
4803
+ typecheck: "tsc --noEmit -p tsconfig.build.json",
4806
4804
  clean: "rm -rf dist"
4807
4805
  },
4808
4806
  peerDependencies: {
@@ -5189,7 +5187,6 @@ When presenting structured data, statistics, or comparisons, decide if it is bes
5189
5187
  finalSystemPrompt += chartInstruction;
5190
5188
  }
5191
5189
  this.agent = createAgent({
5192
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
5193
5190
  model: chatModel,
5194
5191
  tools: [searchTool],
5195
5192
  systemPrompt: finalSystemPrompt
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@retrivora-ai/rag-engine",
3
- "version": "2.3.1",
3
+ "version": "2.3.3",
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": "UNLICENSED",
@@ -79,6 +79,7 @@
79
79
  "build": "npm run build:pkg",
80
80
  "build:pkg": "npx @tailwindcss/cli -i src/tailwind.css -o src/index.css && tsup src/index.ts src/handlers/index.ts src/server.ts --format cjs,esm --dts --clean --no-splitting --tsconfig tsconfig.build.json --external react,react-dom,next,mongodb,pg,openai,@anthropic-ai/sdk,@pinecone-database/pinecone,axios,lucide-react,mammoth,pdf-parse,xlsx,react-markdown,remark-gfm,next-themes,langchain,@langchain/core,@langchain/openai,llamaindex --inject-style && npx @tailwindcss/cli -i src/tailwind.css -o dist/index.css",
81
81
  "lint": "eslint",
82
+ "typecheck": "tsc --noEmit -p tsconfig.build.json",
82
83
  "clean": "rm -rf dist"
83
84
  },
84
85
  "peerDependencies": {
@@ -135,4 +136,4 @@
135
136
  "tsup": "^8.5.1",
136
137
  "typescript": "^5"
137
138
  }
138
- }
139
+ }
@@ -79,8 +79,6 @@ export function ChatWidget({ position = 'bottom-right', onAddToCart, apiUrl, ret
79
79
  const [isValidating, setIsValidating] = useState(false);
80
80
  const [hasMountValidationFailed, setHasMountValidationFailed] = useState(false);
81
81
 
82
- if (ui.showWidget === false) return null;
83
-
84
82
  const positionClass =
85
83
  position === 'bottom-left'
86
84
  ? 'bottom-6 left-6'
@@ -233,6 +231,8 @@ export function ChatWidget({ position = 'bottom-right', onAddToCart, apiUrl, ret
233
231
 
234
232
  const isResized = dimensions.width !== DEFAULT_DIMENSIONS.width || dimensions.height !== DEFAULT_DIMENSIONS.height;
235
233
 
234
+ if (ui.showWidget === false) return null;
235
+
236
236
  return (
237
237
  <>
238
238
  <style dangerouslySetInnerHTML={{ __html: GEMINI_STYLES }} />