@retrivora-ai/rag-engine 2.6.4 → 2.6.6
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/{ILLMProvider-CzXcTA6d.d.mts → ILLMProvider-BQXlVWNn.d.mts} +19 -0
- package/dist/{ILLMProvider-CzXcTA6d.d.ts → ILLMProvider-BQXlVWNn.d.ts} +19 -0
- package/dist/{PineconeProvider-3PXQFHSO.mjs → PineconeProvider-S7AV7FKC.mjs} +3 -3
- package/dist/{chunk-OMQM7AN6.mjs → chunk-2GDW6W5C.mjs} +1 -1
- package/dist/{chunk-6ZZOZFK6.mjs → chunk-557UWRCG.mjs} +1 -1
- package/dist/{chunk-T7XSD76K.mjs → chunk-F656WHWF.mjs} +546 -81
- package/dist/{chunk-BPIATXJ4.mjs → chunk-JNPVVOIF.mjs} +1 -1
- package/dist/{chunk-FMQN2K2D.mjs → chunk-Q4MVJ7NW.mjs} +1 -1
- package/dist/handlers/index.d.mts +2 -2
- package/dist/handlers/index.d.ts +2 -2
- package/dist/handlers/index.js +532 -80
- package/dist/handlers/index.mjs +2 -2
- package/dist/{index-BZ_rR6V8.d.ts → index-BVNd1Ii7.d.ts} +1 -1
- package/dist/{index-BST9Gzsv.d.mts → index-BmbFZGyv.d.mts} +7 -1
- package/dist/{index-BBbt5A2y.d.mts → index-C2ONv-uf.d.mts} +1 -1
- package/dist/{index-qLvtMUr-.d.ts → index-CBlH1Kvs.d.ts} +7 -1
- package/dist/index.css +209 -0
- package/dist/index.d.mts +7 -6
- package/dist/index.d.ts +7 -6
- package/dist/index.js +1291 -732
- package/dist/index.min.css +1 -1
- package/dist/index.mjs +1240 -681
- package/dist/server.d.mts +184 -35
- package/dist/server.d.ts +184 -35
- package/dist/server.js +560 -82
- package/dist/server.mjs +33 -7
- package/package.json +1 -1
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-
|
|
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-
|
|
3
|
-
import { V as Pipeline, o as DecisionContext, q as IntentCategory, I as IRenderRule, G as RenderDecision, p as IRendererStrategy } from './index-
|
|
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-
|
|
5
|
-
import { I as IProviderValidator, a as IProviderHealthChecker, H as HealthCheckResult } 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 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-
|
|
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-BQXlVWNn.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-BQXlVWNn.mjs';
|
|
3
|
+
import { V as Pipeline, o as DecisionContext, q as IntentCategory, I as IRenderRule, G as RenderDecision, p as IRendererStrategy } from './index-BmbFZGyv.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-BmbFZGyv.mjs';
|
|
5
|
+
import { I as IProviderValidator, a as IProviderHealthChecker, H as HealthCheckResult } from './index-C2ONv-uf.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-C2ONv-uf.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
|
*
|
|
@@ -1063,6 +1207,11 @@ declare class VisualizationDecisionEngine {
|
|
|
1063
1207
|
/**
|
|
1064
1208
|
* Clear the decision cache.
|
|
1065
1209
|
*/
|
|
1210
|
+
/**
|
|
1211
|
+
* Returns true when the generated chat response indicates there is no relevant
|
|
1212
|
+
* data or the assistant could not answer the query.
|
|
1213
|
+
*/
|
|
1214
|
+
static isNegativeResponse(response?: string): boolean;
|
|
1066
1215
|
static clearCache(): void;
|
|
1067
1216
|
/**
|
|
1068
1217
|
* Get size of current decision cache.
|
|
@@ -1820,4 +1969,4 @@ declare function initializeTelemetryService(projectId: string, licenseKey: strin
|
|
|
1820
1969
|
*/
|
|
1821
1970
|
declare function shutdownTelemetryService(): Promise<void>;
|
|
1822
1971
|
|
|
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 };
|
|
1972
|
+
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 };
|
package/dist/server.d.ts
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-
|
|
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-
|
|
3
|
-
import { V as Pipeline, o as DecisionContext, q as IntentCategory, I as IRenderRule, G as RenderDecision, p as IRendererStrategy } from './index-
|
|
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-
|
|
5
|
-
import { I as IProviderValidator, a as IProviderHealthChecker, H as HealthCheckResult } 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 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-
|
|
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-BQXlVWNn.js';
|
|
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-BQXlVWNn.js';
|
|
3
|
+
import { V as Pipeline, o as DecisionContext, q as IntentCategory, I as IRenderRule, G as RenderDecision, p as IRendererStrategy } from './index-CBlH1Kvs.js';
|
|
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-CBlH1Kvs.js';
|
|
5
|
+
import { I as IProviderValidator, a as IProviderHealthChecker, H as HealthCheckResult } from './index-BVNd1Ii7.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 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-BVNd1Ii7.js';
|
|
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
|
*
|
|
@@ -1063,6 +1207,11 @@ declare class VisualizationDecisionEngine {
|
|
|
1063
1207
|
/**
|
|
1064
1208
|
* Clear the decision cache.
|
|
1065
1209
|
*/
|
|
1210
|
+
/**
|
|
1211
|
+
* Returns true when the generated chat response indicates there is no relevant
|
|
1212
|
+
* data or the assistant could not answer the query.
|
|
1213
|
+
*/
|
|
1214
|
+
static isNegativeResponse(response?: string): boolean;
|
|
1066
1215
|
static clearCache(): void;
|
|
1067
1216
|
/**
|
|
1068
1217
|
* Get size of current decision cache.
|
|
@@ -1820,4 +1969,4 @@ declare function initializeTelemetryService(projectId: string, licenseKey: strin
|
|
|
1820
1969
|
*/
|
|
1821
1970
|
declare function shutdownTelemetryService(): Promise<void>;
|
|
1822
1971
|
|
|
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 };
|
|
1972
|
+
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 };
|