@retrivora-ai/rag-engine 2.3.2 → 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/{BatchProcessor-BfzuU4cK.d.ts → BatchProcessor-CQDtlggz.d.ts} +2 -139
- package/dist/{BatchProcessor-7yV-UCHW.d.mts → BatchProcessor-tVzb9CdE.d.mts} +2 -139
- package/dist/{ILLMProvider-teTNQ1lh.d.mts → ILLMProvider-CcJ5N6XD.d.mts} +1 -1
- package/dist/{ILLMProvider-teTNQ1lh.d.ts → ILLMProvider-CcJ5N6XD.d.ts} +1 -1
- package/dist/handlers/index.d.mts +2 -2
- package/dist/handlers/index.d.ts +2 -2
- package/dist/handlers/index.js +1 -1
- package/dist/handlers/index.mjs +1 -1
- package/dist/{index-DR_O_B-W.d.ts → index-BwmyPJHp.d.ts} +1 -1
- package/dist/{index-fnpaCuma.d.mts → index-CL-zF6bD.d.mts} +1 -1
- package/dist/index.d.mts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +1 -1963
- package/dist/index.mjs +1 -1958
- package/dist/server.d.mts +186 -49
- package/dist/server.d.ts +186 -49
- package/dist/server.js +1 -1
- package/dist/server.mjs +1 -1
- package/package.json +1 -1
- package/src/index.ts +4 -9
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-
|
|
2
|
-
export { B as BarChartData,
|
|
3
|
-
import {
|
|
4
|
-
export {
|
|
5
|
-
import { H as HealthCheckResult, I as IProviderValidator, a as IProviderHealthChecker } from './index-
|
|
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-
|
|
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-
|
|
2
|
-
export { B as BarChartData,
|
|
3
|
-
import {
|
|
4
|
-
export {
|
|
5
|
-
import { H as HealthCheckResult, I as IProviderValidator, a as IProviderHealthChecker } from './index-
|
|
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-
|
|
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
|
@@ -4821,7 +4821,7 @@ var ConfigValidator = class {
|
|
|
4821
4821
|
// package.json
|
|
4822
4822
|
var package_default = {
|
|
4823
4823
|
name: "@retrivora-ai/rag-engine",
|
|
4824
|
-
version: "2.3.
|
|
4824
|
+
version: "2.3.3",
|
|
4825
4825
|
description: "Retrivora AI is a plug-and-play AI engine for RAG chat experiences \u2014 generic vector DB + LLM provider, embeddable or standalone.",
|
|
4826
4826
|
author: "Abhinav Alkuchi",
|
|
4827
4827
|
license: "UNLICENSED",
|
package/dist/server.mjs
CHANGED
|
@@ -4721,7 +4721,7 @@ var ConfigValidator = class {
|
|
|
4721
4721
|
// package.json
|
|
4722
4722
|
var package_default = {
|
|
4723
4723
|
name: "@retrivora-ai/rag-engine",
|
|
4724
|
-
version: "2.3.
|
|
4724
|
+
version: "2.3.3",
|
|
4725
4725
|
description: "Retrivora AI is a plug-and-play AI engine for RAG chat experiences \u2014 generic vector DB + LLM provider, embeddable or standalone.",
|
|
4726
4726
|
author: "Abhinav Alkuchi",
|
|
4727
4727
|
license: "UNLICENSED",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@retrivora-ai/rag-engine",
|
|
3
|
-
"version": "2.3.
|
|
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",
|
package/src/index.ts
CHANGED
|
@@ -26,14 +26,9 @@ export { useRagChat } from './hooks/useRagChat';
|
|
|
26
26
|
// ── Utils ─────────────────────────────────────────────────────
|
|
27
27
|
export { addSynonyms } from './utils/synonyms';
|
|
28
28
|
|
|
29
|
-
// ── Visualization
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
decideVisualization,
|
|
33
|
-
RendererRegistry,
|
|
34
|
-
IntentClassifier,
|
|
35
|
-
RuleEngine,
|
|
36
|
-
} from './rendering';
|
|
29
|
+
// ── Visualization Types ────────────────────────────────────────
|
|
30
|
+
// Runtime rendering utilities are exported from the server entrypoint to
|
|
31
|
+
// avoid pulling the rendering engine into client bundles unnecessarily.
|
|
37
32
|
export type {
|
|
38
33
|
RenderDecision,
|
|
39
34
|
RenderType,
|
|
@@ -42,7 +37,7 @@ export type {
|
|
|
42
37
|
DecisionContext,
|
|
43
38
|
IRenderRule,
|
|
44
39
|
IRendererStrategy,
|
|
45
|
-
} from './rendering';
|
|
40
|
+
} from './rendering/types';
|
|
46
41
|
|
|
47
42
|
// ── Types (Interfaces/Types only, no Node.js deps) ─────────────
|
|
48
43
|
export type {
|