@retrivora-ai/rag-engine 2.5.9 → 2.6.2
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/README.md +8 -6
- package/dist/{ILLMProvider-B2N3lMBc.d.mts → ILLMProvider-CzXcTA6d.d.mts} +31 -3
- package/dist/{ILLMProvider-B2N3lMBc.d.ts → ILLMProvider-CzXcTA6d.d.ts} +31 -3
- package/dist/handlers/index.d.mts +2 -2
- package/dist/handlers/index.d.ts +2 -2
- package/dist/handlers/index.js +9815 -8601
- package/dist/handlers/index.mjs +9818 -8612
- package/dist/{index-CAGGPyI7.d.mts → index-BST9Gzsv.d.mts} +8 -7
- package/dist/{index-BxzDv2jd.d.ts → index-CFl4KrKq.d.ts} +58 -46
- package/dist/{index-37V810a-.d.mts → index-D7FuQRSb.d.mts} +58 -46
- package/dist/{index-DdQxoIpu.d.ts → index-qLvtMUr-.d.ts} +8 -7
- package/dist/index.css +23 -0
- package/dist/index.d.mts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +267 -187
- package/dist/index.min.css +1 -1
- package/dist/index.mjs +268 -193
- package/dist/server.d.mts +322 -14
- package/dist/server.d.ts +322 -14
- package/dist/server.js +1925 -688
- package/dist/server.mjs +1912 -693
- package/package.json +1 -1
package/dist/server.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { A as AuthMode,
|
|
3
|
-
import { o as DecisionContext, q as IntentCategory, I as IRenderRule, G as RenderDecision, p as IRendererStrategy } from './index-
|
|
4
|
-
export {
|
|
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
|
|
1
|
+
import { b as RagConfig, f as UniversalRagConfig, h as VectorDBConfig, y as UpsertDocument, V as VectorMatch, H as GraphDBConfig, J as GraphNode, K as Edge, M as GraphSearchResult, L as LLMConfig, E as EmbeddingConfig, I as ILLMProvider, z as VectorDBProvider, n as LLMProvider, m as EmbeddingProvider, u as RAGConfig, U as UIConfig, C as ChatMessage, g as UITransformationResponse, k as ChatOptions, l as EmbedOptions, c as IngestDocument, d as ChatResponse } from './ILLMProvider-CzXcTA6d.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-CzXcTA6d.js';
|
|
3
|
+
import { V as Pipeline, o as DecisionContext, q as IntentCategory, I as IRenderRule, G as RenderDecision, p as IRendererStrategy } from './index-qLvtMUr-.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-qLvtMUr-.js';
|
|
5
|
+
import { I as IProviderValidator, a as IProviderHealthChecker, H as HealthCheckResult } from './index-CFl4KrKq.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-CFl4KrKq.js';
|
|
7
7
|
import 'react';
|
|
8
8
|
import 'next/server';
|
|
9
9
|
|
|
@@ -18,10 +18,6 @@ interface LicensePayload {
|
|
|
18
18
|
minimumSupportedVersion?: string;
|
|
19
19
|
forceUpgrade?: boolean;
|
|
20
20
|
}
|
|
21
|
-
/**
|
|
22
|
-
* Validates licenses against the central Retrivora API.
|
|
23
|
-
* Replaces the old zero-latency local cryptographic verifier.
|
|
24
|
-
*/
|
|
25
21
|
declare class LicenseVerifier {
|
|
26
22
|
private static readonly cache;
|
|
27
23
|
private static readonly CACHE_TTL_MS;
|
|
@@ -37,10 +33,53 @@ declare class LicenseVerifier {
|
|
|
37
33
|
* @param provider - Optional provider for tier checks.
|
|
38
34
|
*/
|
|
39
35
|
static verifyAsync(licenseKey: string | undefined, currentProjectId: string, provider?: string): Promise<LicensePayload>;
|
|
36
|
+
private static cachedIps;
|
|
40
37
|
static verifyIP(licenseKey: string | undefined): Promise<void>;
|
|
41
38
|
static extractTier(licenseKey: string | undefined): string;
|
|
42
39
|
}
|
|
43
40
|
|
|
41
|
+
/**
|
|
42
|
+
* LangChainAgent — Orchestration layer that turns the RAG pipeline into an Agent.
|
|
43
|
+
*
|
|
44
|
+
* Uses dynamic imports to keep LangChain an optional peer dependency.
|
|
45
|
+
* Requires `langchain` (v1.x) and `@langchain/core` to be installed.
|
|
46
|
+
*
|
|
47
|
+
* LangChain v1.x migration notes:
|
|
48
|
+
* - `AgentExecutor` and `createOpenAIFunctionsAgent` are removed.
|
|
49
|
+
* - The replacement is `createAgent` from the `langchain` root package,
|
|
50
|
+
* which returns a `ReactAgent` (LangGraph-backed ReAct agent).
|
|
51
|
+
* - Invocation uses `{ messages: [...] }` instead of `{ input, chat_history }`.
|
|
52
|
+
*/
|
|
53
|
+
declare class LangChainAgent {
|
|
54
|
+
private pipeline;
|
|
55
|
+
private config;
|
|
56
|
+
private agent?;
|
|
57
|
+
constructor(pipeline: Pipeline, config: RagConfig);
|
|
58
|
+
/**
|
|
59
|
+
* Initializes the LangChain ReAct agent with the RAG pipeline as a tool.
|
|
60
|
+
* Dynamically imports langchain so the package doesn't crash if it isn't installed.
|
|
61
|
+
*/
|
|
62
|
+
initialize(chatModel: unknown): Promise<void>;
|
|
63
|
+
/**
|
|
64
|
+
* Run the agentic flow.
|
|
65
|
+
*
|
|
66
|
+
* LangChain v1.x: invoke takes `{ messages: [...] }` instead of `{ input, chat_history }`.
|
|
67
|
+
* The agent returns `{ messages: [...] }` — the last message is the final answer.
|
|
68
|
+
*/
|
|
69
|
+
run(input: string, chatHistory?: unknown[]): Promise<any>;
|
|
70
|
+
/**
|
|
71
|
+
* Run the agentic flow in streaming mode, emitting granular SSE event frames.
|
|
72
|
+
* Leverages LangChain/LangGraph `streamEvents` (v2 API) to stream:
|
|
73
|
+
* - Token-by-token LLM output (`type: "text"`)
|
|
74
|
+
* - Tool invocation / thinking steps (`type: "thinking"`)
|
|
75
|
+
* - Tool execution metadata & search sources
|
|
76
|
+
*/
|
|
77
|
+
streamRun(input: string, chatHistory?: unknown[]): AsyncGenerator<{
|
|
78
|
+
type: string;
|
|
79
|
+
text: any;
|
|
80
|
+
}, void, unknown>;
|
|
81
|
+
}
|
|
82
|
+
|
|
44
83
|
/**
|
|
45
84
|
* ConfigResolver — validates and normalizes host configuration.
|
|
46
85
|
* It merges host-provided config with environment defaults.
|
|
@@ -546,8 +585,8 @@ declare class DocumentParser {
|
|
|
546
585
|
*/
|
|
547
586
|
static sniffMagicBytes(buffer: Buffer): 'pdf' | 'zip' | 'ole2' | 'json' | 'text' | null;
|
|
548
587
|
/**
|
|
549
|
-
* Convert spreadsheet sheets into high-fidelity, context-preserved tabular text.
|
|
550
|
-
*
|
|
588
|
+
* Convert spreadsheet sheets into high-fidelity, context-preserved tabular text via UniversalTableParser.
|
|
589
|
+
* Unrolls merged cells, fuses multi-level headers, and generates tri-perspective comparison profiles.
|
|
551
590
|
*/
|
|
552
591
|
private static formatSheetToContextualText;
|
|
553
592
|
/**
|
|
@@ -578,6 +617,268 @@ declare class DocumentParser {
|
|
|
578
617
|
private static readAsText;
|
|
579
618
|
}
|
|
580
619
|
|
|
620
|
+
/**
|
|
621
|
+
* UniversalTableParser — Advanced table, comparison matrix, and financial sheet parser.
|
|
622
|
+
*
|
|
623
|
+
* Capabilities:
|
|
624
|
+
* 1. Merged-Cell Resolution: Unrolls `sheet['!merges']` across full rows and column spans.
|
|
625
|
+
* 2. Multi-Tier Header Fusion: Combines hierarchical headers into composite paths (e.g. "Commercial > Total Cost > Bidder 1").
|
|
626
|
+
* 3. Matrix & Layout Classification: Detects comparison matrices (e.g. Bidder Comparisons, Vendor Scorecards, Feature Matrices).
|
|
627
|
+
* 4. Tri-Perspective Serialization:
|
|
628
|
+
* - Perspective A: Clean Markdown Table
|
|
629
|
+
* - Perspective B: Entity-Centric Profiles (e.g. full profile for Bidder 1, Bidder 2)
|
|
630
|
+
* - Perspective C: Criteria Cross-Comparisons (e.g. Cost comparison across all Bidders)
|
|
631
|
+
*/
|
|
632
|
+
interface ParsedTableResult {
|
|
633
|
+
markdownTable: string;
|
|
634
|
+
entityProfiles: string;
|
|
635
|
+
criteriaComparisons: string;
|
|
636
|
+
contextualText: string;
|
|
637
|
+
isComparisonMatrix: boolean;
|
|
638
|
+
entities: string[];
|
|
639
|
+
criteria: string[];
|
|
640
|
+
}
|
|
641
|
+
declare class UniversalTableParser {
|
|
642
|
+
/**
|
|
643
|
+
* Parse a raw 2D grid of strings with complete matrix intelligence.
|
|
644
|
+
*/
|
|
645
|
+
static parseGrid(grid: string[][], sheetName?: string): string;
|
|
646
|
+
/**
|
|
647
|
+
* Parse a raw CSV / TSV text string into tri-perspective contextual format.
|
|
648
|
+
*/
|
|
649
|
+
static parseDelimitedText(text: string, title?: string, delimiter?: string): string;
|
|
650
|
+
/**
|
|
651
|
+
* Parse a SheetJS sheet object with complete merged cell and matrix intelligence.
|
|
652
|
+
*/
|
|
653
|
+
static parseSheet(sheet: any, sheetName: string, XLSX: any): string;
|
|
654
|
+
/**
|
|
655
|
+
* Unrolls SheetJS merged cell ranges (`!merges`) across the 2D grid
|
|
656
|
+
* so no child cell is left blank.
|
|
657
|
+
*/
|
|
658
|
+
private static extractAndUnrollGrid;
|
|
659
|
+
/**
|
|
660
|
+
* Intelligently identify where header rows end and data rows begin.
|
|
661
|
+
*/
|
|
662
|
+
private static splitHeaderAndDataRows;
|
|
663
|
+
/**
|
|
664
|
+
* Fuses multi-tier header rows into composite paths (e.g. `Commercial > Payment Terms > Bidder A`).
|
|
665
|
+
*/
|
|
666
|
+
private static fuseHeaders;
|
|
667
|
+
/**
|
|
668
|
+
* Analyzes whether the table is a comparison matrix (columns = entities, rows = criteria).
|
|
669
|
+
*/
|
|
670
|
+
private static analyzeMatrixStructure;
|
|
671
|
+
/**
|
|
672
|
+
* Perspective A: Clean Markdown Table
|
|
673
|
+
*/
|
|
674
|
+
private static generateMarkdownTable;
|
|
675
|
+
/**
|
|
676
|
+
* Perspective B: Entity-Centric Profiles (e.g. Bidder 1, Bidder 2 full summary)
|
|
677
|
+
*/
|
|
678
|
+
private static generateEntityProfiles;
|
|
679
|
+
/**
|
|
680
|
+
* Perspective C: Criteria Cross-Comparisons (e.g. Commercial Bid comparison across all Bidders)
|
|
681
|
+
*/
|
|
682
|
+
private static generateCriteriaComparisons;
|
|
683
|
+
/**
|
|
684
|
+
* Standard contextual key-value rows for general tabular records.
|
|
685
|
+
*/
|
|
686
|
+
private static generateContextualRows;
|
|
687
|
+
}
|
|
688
|
+
|
|
689
|
+
/**
|
|
690
|
+
* VisionExtractor — Multi-Modal Vision & Scanned PDF OCR Engine.
|
|
691
|
+
*
|
|
692
|
+
* Capabilities:
|
|
693
|
+
* 1. Automatically detects scanned or rasterized PDF pages where text extraction returns near-empty text.
|
|
694
|
+
* 2. Directly handles image formats (.png, .jpg, .jpeg, .webp, .bmp, .tiff).
|
|
695
|
+
* 3. Transcribes handwritten notes, invoices, receipts, architecture diagrams, flowcharts, and visual tables into high-fidelity Markdown using Vision LLM models (GPT-4o-mini, Claude 3.5 Sonnet, Gemini 1.5 Flash).
|
|
696
|
+
*/
|
|
697
|
+
interface VisionExtractOptions {
|
|
698
|
+
apiKey?: string;
|
|
699
|
+
provider?: 'openai' | 'anthropic' | 'gemini' | 'litellm';
|
|
700
|
+
model?: string;
|
|
701
|
+
maxTokens?: number;
|
|
702
|
+
temperature?: number;
|
|
703
|
+
}
|
|
704
|
+
declare class VisionExtractor {
|
|
705
|
+
/**
|
|
706
|
+
* Check if a buffer represents an image format.
|
|
707
|
+
*/
|
|
708
|
+
static isImageBuffer(buffer: Buffer, fileName?: string, mimeType?: string): boolean;
|
|
709
|
+
/**
|
|
710
|
+
* Extract rich textual content, tables, and diagram descriptions from an image buffer using Vision LLM.
|
|
711
|
+
*/
|
|
712
|
+
static extractFromImage(buffer: Buffer, fileName?: string, options?: VisionExtractOptions): Promise<string>;
|
|
713
|
+
}
|
|
714
|
+
|
|
715
|
+
/**
|
|
716
|
+
* Hybrid Search & Reciprocal Rank Fusion (RRF) Engine.
|
|
717
|
+
*
|
|
718
|
+
* Implements:
|
|
719
|
+
* 1. Okapi BM25 sparse keyword ranking (term frequency, inverse document frequency, document length normalization).
|
|
720
|
+
* 2. Reciprocal Rank Fusion (RRF) algorithm:
|
|
721
|
+
* RRF_Score(d) = w_dense / (k + rank_dense(d)) + w_sparse / (k + rank_sparse(d))
|
|
722
|
+
*
|
|
723
|
+
* Provides 100% exact matching on SKU codes, serial numbers, error codes, and technical jargon
|
|
724
|
+
* while preserving deep semantic matching from dense vector embeddings.
|
|
725
|
+
*/
|
|
726
|
+
interface HybridSearchOptions {
|
|
727
|
+
/** Dense vector weight (default: 0.6) */
|
|
728
|
+
denseWeight?: number;
|
|
729
|
+
/** Sparse BM25 weight (default: 0.4) */
|
|
730
|
+
sparseWeight?: number;
|
|
731
|
+
/** RRF constant k (default: 60) */
|
|
732
|
+
rrfK?: number;
|
|
733
|
+
/** BM25 k1 parameter (default: 1.5) */
|
|
734
|
+
bm25K1?: number;
|
|
735
|
+
/** BM25 b parameter (default: 0.75) */
|
|
736
|
+
bm25B?: number;
|
|
737
|
+
}
|
|
738
|
+
declare class HybridSearch {
|
|
739
|
+
private static stopWords;
|
|
740
|
+
/**
|
|
741
|
+
* Tokenize text into normalized alphanumeric keywords, keeping exact codes, numbers, and identifiers.
|
|
742
|
+
*/
|
|
743
|
+
static tokenize(text: string): string[];
|
|
744
|
+
/**
|
|
745
|
+
* Calculate Okapi BM25 sparse scores for an array of document chunks given a query.
|
|
746
|
+
*/
|
|
747
|
+
static scoreBM25(documents: Array<{
|
|
748
|
+
id: string | number;
|
|
749
|
+
content: string;
|
|
750
|
+
}>, query: string, k1?: number, b?: number): Map<string | number, number>;
|
|
751
|
+
/**
|
|
752
|
+
* Fuse Dense Vector Matches with Sparse BM25 Scores using Reciprocal Rank Fusion (RRF).
|
|
753
|
+
*/
|
|
754
|
+
static fuse(denseMatches: VectorMatch[], query: string, options?: HybridSearchOptions): VectorMatch[];
|
|
755
|
+
}
|
|
756
|
+
|
|
757
|
+
interface RerankOptions {
|
|
758
|
+
/** Reranking provider: 'hybrid' | 'cohere' | 'jina' | 'llm' | 'keyword' (default: 'hybrid') */
|
|
759
|
+
provider?: 'hybrid' | 'cohere' | 'jina' | 'llm' | 'keyword';
|
|
760
|
+
/** Cohere API Key if using cohere provider */
|
|
761
|
+
cohereApiKey?: string;
|
|
762
|
+
/** Cohere model (default: 'rerank-v3.5') */
|
|
763
|
+
cohereModel?: string;
|
|
764
|
+
/** Jina API Key if using jina provider */
|
|
765
|
+
jinaApiKey?: string;
|
|
766
|
+
/** Jina model (default: 'jina-reranker-v2-base-multilingual') */
|
|
767
|
+
jinaModel?: string;
|
|
768
|
+
}
|
|
769
|
+
declare class Reranker {
|
|
770
|
+
/**
|
|
771
|
+
* Re-ranks matches based on a secondary relevance score using Hybrid BM25, Cohere, Jina or LLM.
|
|
772
|
+
*/
|
|
773
|
+
rerank(matches: VectorMatch[], query: string, limit?: number, llm?: ILLMProvider, options?: RerankOptions): Promise<VectorMatch[]>;
|
|
774
|
+
/**
|
|
775
|
+
* Cohere Rerank v3.5 API integration.
|
|
776
|
+
*/
|
|
777
|
+
private cohereRerank;
|
|
778
|
+
/**
|
|
779
|
+
* Jina AI Reranker v2 API integration.
|
|
780
|
+
*/
|
|
781
|
+
private jinaRerank;
|
|
782
|
+
/**
|
|
783
|
+
* Keyword-based re-ranking fallback.
|
|
784
|
+
*
|
|
785
|
+
* Fix RAG-2: `rerankScore` is a separate field; `score` (the original
|
|
786
|
+
* vector similarity) is never mutated. Callers that display `score` to
|
|
787
|
+
* end-users receive the canonical cosine similarity value.
|
|
788
|
+
*/
|
|
789
|
+
private keywordRerank;
|
|
790
|
+
/**
|
|
791
|
+
* LLM-based re-ranking.
|
|
792
|
+
*
|
|
793
|
+
* Fix RAG-1: total document content is now budgeted against
|
|
794
|
+
* MAX_RERANK_CONTENT_CHARS to prevent silent truncation or failures
|
|
795
|
+
* on models with small context windows.
|
|
796
|
+
*/
|
|
797
|
+
private llmRerank;
|
|
798
|
+
}
|
|
799
|
+
|
|
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
|
+
/**
|
|
828
|
+
* PIIMasker — Enterprise Personally Identifiable Information (PII) Redaction.
|
|
829
|
+
*
|
|
830
|
+
* Automatically detects and masks sensitive data before vector embedding or LLM submission:
|
|
831
|
+
* - Social Security Numbers (SSN)
|
|
832
|
+
* - Credit Card Numbers (PCI-DSS compliance)
|
|
833
|
+
* - Email Addresses
|
|
834
|
+
* - Phone Numbers (international & US formats)
|
|
835
|
+
* - API Keys & Bearer Tokens (AWS, OpenAI, Stripe, JWTs)
|
|
836
|
+
* - IPv4 and IPv6 Addresses
|
|
837
|
+
*/
|
|
838
|
+
interface PIIMaskerOptions {
|
|
839
|
+
maskEmails?: boolean;
|
|
840
|
+
maskPhones?: boolean;
|
|
841
|
+
maskCreditCards?: boolean;
|
|
842
|
+
maskSSN?: boolean;
|
|
843
|
+
maskApiKeys?: boolean;
|
|
844
|
+
maskIPs?: boolean;
|
|
845
|
+
replacementPattern?: 'token' | 'asterisk';
|
|
846
|
+
}
|
|
847
|
+
declare class PIIMasker {
|
|
848
|
+
private static SSN_REGEX;
|
|
849
|
+
private static CREDIT_CARD_REGEX;
|
|
850
|
+
private static EMAIL_REGEX;
|
|
851
|
+
private static PHONE_REGEX;
|
|
852
|
+
private static API_KEY_REGEX;
|
|
853
|
+
private static IP_REGEX;
|
|
854
|
+
/**
|
|
855
|
+
* Redact sensitive information from text.
|
|
856
|
+
*/
|
|
857
|
+
static mask(text: string, options?: PIIMaskerOptions): string;
|
|
858
|
+
}
|
|
859
|
+
|
|
860
|
+
/**
|
|
861
|
+
* PromptGuard — Enterprise Prompt Injection & Adversarial Attack Defense.
|
|
862
|
+
*
|
|
863
|
+
* Capabilities:
|
|
864
|
+
* 1. Detects system prompt leak attempts (e.g. "Ignore previous instructions", "Repeat the system prompt").
|
|
865
|
+
* 2. Neutralizes jailbreak vectors (DAN, developer mode overrides, instruction hijack).
|
|
866
|
+
* 3. Sanitizes dangerous delimiters and hidden instruction tags.
|
|
867
|
+
*/
|
|
868
|
+
interface PromptGuardResult {
|
|
869
|
+
isSafe: boolean;
|
|
870
|
+
threatLevel: 'none' | 'low' | 'medium' | 'high';
|
|
871
|
+
detectedPatterns: string[];
|
|
872
|
+
sanitizedText: string;
|
|
873
|
+
}
|
|
874
|
+
declare class PromptGuard {
|
|
875
|
+
private static INJECTION_PATTERNS;
|
|
876
|
+
/**
|
|
877
|
+
* Scan and evaluate user query or document text for prompt injection vectors.
|
|
878
|
+
*/
|
|
879
|
+
static evaluate(text: string): PromptGuardResult;
|
|
880
|
+
}
|
|
881
|
+
|
|
581
882
|
/**
|
|
582
883
|
* PromptOptimizer — Intelligent query normalizer and prompt enhancement engine.
|
|
583
884
|
*
|
|
@@ -653,9 +954,11 @@ declare class IntentClassifier {
|
|
|
653
954
|
signals: DataSignals;
|
|
654
955
|
};
|
|
655
956
|
/**
|
|
656
|
-
* Extract key data structure signals from retrieved documents.
|
|
957
|
+
* Extract key data structure signals dynamically from retrieved documents.
|
|
958
|
+
* Inspects both structured metadata and parsed chunk text.
|
|
657
959
|
*/
|
|
658
960
|
static extractDataSignals(context: DecisionContext): DataSignals;
|
|
961
|
+
private static isDiscoveryQuery;
|
|
659
962
|
private static isInformationLookup;
|
|
660
963
|
private static isComparisonQuery;
|
|
661
964
|
private static isProductQuery;
|
|
@@ -1376,6 +1679,11 @@ declare function createRetrivora(options: LicensedRetrivoraOptions): Promise<Lic
|
|
|
1376
1679
|
* Axios added ~25KB gzipped to every consumer's bundle purely for non-critical
|
|
1377
1680
|
* fire-and-forget POST calls. fetch is available in Node.js 18+ and all
|
|
1378
1681
|
* Next.js deployment targets (Vercel, Edge, Node runtime).
|
|
1682
|
+
*
|
|
1683
|
+
* @deprecated The streaming and handler paths use `reportTelemetry()` in
|
|
1684
|
+
* `packages/sdk/src/handlers/index.ts` directly. TelemetryService is only
|
|
1685
|
+
* consumed by `LicensedRetrivora` (the non-streaming API). Its event queue
|
|
1686
|
+
* and auto-flush are functional but not exercised by the main request path.
|
|
1379
1687
|
*/
|
|
1380
1688
|
declare enum EventType {
|
|
1381
1689
|
EMBEDDING_GENERATED = "embedding_generated",
|
|
@@ -1512,4 +1820,4 @@ declare function initializeTelemetryService(projectId: string, licenseKey: strin
|
|
|
1512
1820
|
*/
|
|
1513
1821
|
declare function shutdownTelemetryService(): Promise<void>;
|
|
1514
1822
|
|
|
1515
|
-
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, ILLMProvider, IProviderHealthChecker, IProviderValidator, IRenderRule, IRendererStrategy, IngestDocument, IntentCategory, IntentClassifier, LLMConfig, LLMFactory, LLMProvider, LLM_PROFILES, type LicensePayload, LicenseVerifier, LicensedRetrivora, type LicensedRetrivoraOptions, MilvusProvider, MixedRendererStrategy, MongoDBProvider, MultiTablePostgresProvider, OllamaProvider, OpenAIProvider, type OptimizedPromptResult, PRESETS, PineconeProvider, PostgreSQLProvider, type PromptOptimizationOptions, PromptOptimizer, ProviderHealthCheck, ProviderRegistry, QdrantProvider, QwenProvider, RAGConfig, RagConfig, RedisProvider, RenderDecision, RendererRegistry, Rule1SpecificInfoRule, Rule2ComparisonRule, Rule3ProductDiscoveryRule, Rule4AnalyticalRule, Rule5MixedResponseRule, Rule6SmallResultSetRule, Rule7LargeTableRule, RuleEngine, type RuntimeTierConfig, TableRendererStrategy, type TelemetryEvent, TelemetryService, TextRendererStrategy, UIConfig, UITransformationResponse, UniversalLLMAdapter, UniversalRagConfig, UniversalVectorProvider, UpsertDocument, VECTOR_PROFILES, VectorDBConfig, VectorDBProvider, VectorMatch, VisualizationDecisionEngine, WeaviateProvider, createFromPreset, createRetrivora, decideVisualization, getRagConfig, getRuntimeConfig, getTelemetryService, initializeTelemetryService, injectRuntimeConfig, shutdownTelemetryService };
|
|
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 };
|