@retrivora-ai/rag-engine 2.5.7 → 2.5.8

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.
Files changed (51) hide show
  1. package/dist/{ILLMProvider-DwFj0h2u.d.mts → ILLMProvider-B2N3lMBc.d.mts} +10 -1
  2. package/dist/{ILLMProvider-DwFj0h2u.d.ts → ILLMProvider-B2N3lMBc.d.ts} +10 -1
  3. package/dist/handlers/index.d.mts +2 -2
  4. package/dist/handlers/index.d.ts +2 -2
  5. package/dist/handlers/index.js +961 -192
  6. package/dist/handlers/index.mjs +12821 -24
  7. package/dist/{index-Cb0GsT16.d.ts → index-37V810a-.d.mts} +3 -3
  8. package/dist/{index-D1jN8KSF.d.mts → index-BxzDv2jd.d.ts} +3 -3
  9. package/dist/{index-9h_ENWQn.d.mts → index-CAGGPyI7.d.mts} +6 -2
  10. package/dist/{index-Xci6GfpI.d.ts → index-DdQxoIpu.d.ts} +6 -2
  11. package/dist/index.css +76 -4
  12. package/dist/index.d.mts +6 -6
  13. package/dist/index.d.ts +6 -6
  14. package/dist/index.js +136 -94
  15. package/dist/index.min.css +1 -1
  16. package/dist/index.mjs +1553 -129
  17. package/dist/server.d.mts +100 -9
  18. package/dist/server.d.ts +100 -9
  19. package/dist/server.js +963 -192
  20. package/dist/server.mjs +13378 -372
  21. package/package.json +5 -2
  22. package/dist/ChromaDBProvider-4RPJN7Y3.mjs +0 -8
  23. package/dist/MilvusProvider-WJLLZ6TW.mjs +0 -8
  24. package/dist/MongoDBProvider-QSERELZX.mjs +0 -8
  25. package/dist/MultiTablePostgresProvider-JF2HEUDZ.mjs +0 -9
  26. package/dist/PineconeProvider-HLZL7HKU.mjs +0 -10
  27. package/dist/PostgreSQLProvider-JQMCNHRO.mjs +0 -8
  28. package/dist/QdrantProvider-6MNFPEVC.mjs +0 -8
  29. package/dist/RedisProvider-ERQL6AEB.mjs +0 -8
  30. package/dist/SimpleGraphProvider-OP3HAJJM.mjs +0 -70
  31. package/dist/UniversalVectorProvider-INM3KH5F.mjs +0 -9
  32. package/dist/WeaviateProvider-VHWWICCC.mjs +0 -8
  33. package/dist/chunk-366EFBZC.mjs +0 -165
  34. package/dist/chunk-6MGVQTU4.mjs +0 -8883
  35. package/dist/chunk-B4AXIUM7.mjs +0 -49
  36. package/dist/chunk-BEPLYQBS.mjs +0 -89
  37. package/dist/chunk-BNOPQCZW.mjs +0 -238
  38. package/dist/chunk-FJ43J4FW.mjs +0 -654
  39. package/dist/chunk-GP2AJQRQ.mjs +0 -107
  40. package/dist/chunk-IMP6FUCY.mjs +0 -30
  41. package/dist/chunk-JRQWSJNF.mjs +0 -202
  42. package/dist/chunk-LYHCKUNF.mjs +0 -112
  43. package/dist/chunk-MFIWWUC7.mjs +0 -152
  44. package/dist/chunk-MWICNCB2.mjs +0 -157
  45. package/dist/chunk-N54YTFBN.mjs +0 -76
  46. package/dist/chunk-POOWU2HR.mjs +0 -211
  47. package/dist/chunk-QGDGPOZH.mjs +0 -217
  48. package/dist/chunk-QI3FTN6G.mjs +0 -281
  49. package/dist/chunk-QJIDGVG6.mjs +0 -334
  50. package/dist/chunk-W2DKVD3G.mjs +0 -81
  51. package/dist/chunk-XHSDHPKI.mjs +0 -336
package/dist/server.d.mts CHANGED
@@ -1,9 +1,9 @@
1
- import { p as RagConfig, v as UniversalRagConfig, V as VectorDBConfig, w as UpsertDocument, y as VectorMatch, G as GraphDBConfig, H as GraphNode, J as Edge, K as GraphSearchResult, L as LLMConfig, f as EmbeddingConfig, I as ILLMProvider, x as VectorDBProvider, i as LLMProvider, g as EmbeddingProvider, R as RAGConfig, u as UIConfig, U as UITransformationResponse, C as ChatMessage, d as ChatOptions, E as EmbedOptions, h as IngestDocument, e as ChatResponse } from './ILLMProvider-DwFj0h2u.mjs';
2
- export { A as AuthMode, M as BarChartData, N as CarouselProduct, Q as IRetriever, j as LatencyBreakdown, S as LineChartDataPoint, X as MessageRole, Y as MetricCardData, O as ObservabilityTrace, Z as PieChartData, P as Product, k as ProjectAiSettings, l as ProjectAuthSettings, m as ProjectBrandingSettings, c as ProjectChatSettings, n as ProjectTelemetrySettings, o as ProjectWidgetSettings, q as RagMessage, r as RetrievalConfig, _ as RetrievalResult, s as RetrievedChunk, $ as RetrivoraChunkMetadata, a0 as RetrivoraIngestedDocument, a1 as ScatterPlotDataPoint, a2 as SuggestionsResponse, a3 as TableData, T as ThemeMode, t as TokenUsage, a as UseRagChatOptions, b as UseRagChatReturn, a4 as VisualizationType, W as WidgetPosition, z as WorkflowConfig, B as createDefaultProjectSettings, D as normalizeProjectSettings, F as projectSettingsToUiConfig } from './ILLMProvider-DwFj0h2u.mjs';
3
- import { o as DecisionContext, q as IntentCategory, I as IRenderRule, G as RenderDecision, p as IRendererStrategy } from './index-9h_ENWQn.mjs';
4
- export { V 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, W as DocumentChunker, D as DocumentUploadProps, E as EmbeddingFailedException, X as LicenseConfigResolver, L as LicenseTierConfig, r as LicenseValidationError, s as LicenseValidationRequest, t as LicenseValidationResponse, u as LicenseValidator, M as MessageBubbleProps, Y as Pipeline, 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-9h_ENWQn.mjs';
5
- import { I as IProviderValidator, a as IProviderHealthChecker, H as HealthCheckResult } from './index-D1jN8KSF.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-D1jN8KSF.mjs';
1
+ import { p as RagConfig, v as UniversalRagConfig, V as VectorDBConfig, w as UpsertDocument, y as VectorMatch, G as GraphDBConfig, H as GraphNode, J as Edge, K as GraphSearchResult, L as LLMConfig, f as EmbeddingConfig, I as ILLMProvider, x as VectorDBProvider, i as LLMProvider, g as EmbeddingProvider, R as RAGConfig, u as UIConfig, C as ChatMessage, U as UITransformationResponse, d as ChatOptions, E as EmbedOptions, h as IngestDocument, e as ChatResponse } from './ILLMProvider-B2N3lMBc.mjs';
2
+ export { A as AuthMode, M as BarChartData, N as CarouselProduct, Q as IRetriever, j as LatencyBreakdown, S as LineChartDataPoint, X as MessageRole, Y as MetricCardData, O as ObservabilityTrace, Z as PieChartData, P as Product, k as ProjectAiSettings, l as ProjectAuthSettings, m as ProjectBrandingSettings, c as ProjectChatSettings, n as ProjectTelemetrySettings, o as ProjectWidgetSettings, q as RagMessage, r as RetrievalConfig, _ as RetrievalResult, s as RetrievedChunk, $ as RetrivoraChunkMetadata, a0 as RetrivoraIngestedDocument, a1 as ScatterPlotDataPoint, a2 as SuggestionsResponse, a3 as TableData, T as ThemeMode, t as TokenUsage, a as UseRagChatOptions, b as UseRagChatReturn, a4 as VisualizationType, W as WidgetPosition, z as WorkflowConfig, B as createDefaultProjectSettings, D as normalizeProjectSettings, F as projectSettingsToUiConfig } from './ILLMProvider-B2N3lMBc.mjs';
3
+ import { o as DecisionContext, q as IntentCategory, I as IRenderRule, G as RenderDecision, p as IRendererStrategy } from './index-CAGGPyI7.mjs';
4
+ export { V 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, W as DocumentChunker, D as DocumentUploadProps, E as EmbeddingFailedException, X as LicenseConfigResolver, L as LicenseTierConfig, r as LicenseValidationError, s as LicenseValidationRequest, t as LicenseValidationResponse, u as LicenseValidator, M as MessageBubbleProps, Y as Pipeline, 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-CAGGPyI7.mjs';
5
+ import { I as IProviderValidator, a as IProviderHealthChecker, H as HealthCheckResult } from './index-37V810a-.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-37V810a-.mjs';
7
7
  import 'react';
8
8
  import 'next/server';
9
9
 
@@ -533,16 +533,107 @@ declare const VECTOR_PROFILES: {
533
533
 
534
534
  /**
535
535
  * DocumentParser — handles text extraction from various file formats.
536
- * Supported: .txt, .md, .json, .csv, .pdf, .docx, .doc, .xlsx, .xls
536
+ * Supported:
537
+ * - PowerPoint: .pptx, .ppt, .odp
538
+ * - Word: .docx, .doc, .odt, .rtf
539
+ * - Excel: .xlsx, .xls, .ods, .csv, .tsv
540
+ * - PDF: .pdf
541
+ * - Text & Code: .txt, .md, .json, .yaml, .yml, .xml, .html, .htm, .log, .epub
537
542
  */
538
543
  declare class DocumentParser {
544
+ /**
545
+ * Fast Magic-Bytes sniffer for instant file format identification (<1ms).
546
+ */
547
+ static sniffMagicBytes(buffer: Buffer): 'pdf' | 'zip' | 'ole2' | 'json' | 'text' | null;
548
+ /**
549
+ * Convert spreadsheet sheets into high-fidelity, context-preserved tabular text.
550
+ * Every row retains its column and section context so vector embeddings achieve 100% semantic retrieval precision.
551
+ */
552
+ private static formatSheetToContextualText;
539
553
  /**
540
554
  * Extract text from a File or Buffer based on its type.
541
555
  */
542
- static parse(file: File | Buffer, fileName: string, mimeType: string): Promise<string>;
556
+ static parse(file: File | Buffer, fileName: string, mimeType?: string): Promise<string>;
557
+ /**
558
+ * Helper to strip XML tags and normalize inner text content.
559
+ */
560
+ private static stripXmlTags;
561
+ /**
562
+ * Helper to strip HTML / XML tags while removing script and style blocks completely.
563
+ */
564
+ private static stripHtmlAndXml;
565
+ /**
566
+ * Safe text extraction from non-OpenXML / legacy Excel spreadsheets (.xls, BIFF8, HTML tables, XML Spreadsheet 2003).
567
+ */
568
+ private static parseLegacyExcelOrFallback;
569
+ /**
570
+ * Dynamically infer document domain and schema from extracted text, filename, and format.
571
+ */
572
+ static inferDocumentDomainAndSchema(text: string, fileName?: string, mimeType?: string): {
573
+ domain: 'finance' | 'ecommerce' | 'timeseries' | 'legal' | 'healthcare' | 'tabular' | 'general';
574
+ schema?: Record<string, string>;
575
+ isCatalog: boolean;
576
+ isFinancial: boolean;
577
+ };
543
578
  private static readAsText;
544
579
  }
545
580
 
581
+ /**
582
+ * PromptOptimizer — Intelligent query normalizer and prompt enhancement engine.
583
+ *
584
+ * Solves user prompt failures where the model or vector retrieval is unable to
585
+ * process poorly phrased, ambiguous, typo-ridden, pronoun-heavy, or underspecified queries.
586
+ *
587
+ * Responsibilities:
588
+ * 1. Syntax & Text Normalization: Strips non-printable artifacts, fixes unclosed delimiters, normalizes colloquial abbreviations.
589
+ * 2. Pronoun & Coreference Resolution: Resolves pronouns ('it', 'they', 'this', 'that') against conversation history.
590
+ * 3. Short & Underspecified Query Expansion: Expands one-word/vague queries into clear semantic questions for high-recall RAG.
591
+ * 4. LLM-Assisted Query Enhancement: Optional deep reformulation using the fast router LLM for multi-turn RAG reasoning.
592
+ */
593
+
594
+ interface PromptOptimizationOptions {
595
+ /** Whether to resolve pronouns and context from conversation history */
596
+ resolveHistory?: boolean;
597
+ /** Whether to expand short/underspecified keywords into complete questions */
598
+ expandKeywords?: boolean;
599
+ /** Optional LLM provider for deep reformulation on complex queries */
600
+ llmProvider?: ILLMProvider;
601
+ }
602
+ interface OptimizedPromptResult {
603
+ /** The final optimized prompt to send to the RAG retrieval and LLM synthesis */
604
+ optimizedPrompt: string;
605
+ /** The original raw user prompt */
606
+ originalPrompt: string;
607
+ /** Whether the prompt was modified during optimization */
608
+ wasModified: boolean;
609
+ /** List of optimization operations performed */
610
+ transformations: string[];
611
+ }
612
+ declare class PromptOptimizer {
613
+ private static readonly COMMON_ABBREVIATIONS;
614
+ private static readonly TOPIC_EXPANSIONS;
615
+ /**
616
+ * Optimizes a user prompt synchronously using fast heuristic rules and history resolution.
617
+ */
618
+ static optimize(rawPrompt: string, history?: ChatMessage[], options?: PromptOptimizationOptions): OptimizedPromptResult;
619
+ /**
620
+ * Cleans text artifacts, fixes unclosed quotes/parentheses, and collapses whitespace.
621
+ */
622
+ private static cleanText;
623
+ /**
624
+ * Replaces shorthand chat abbreviations with clear natural language.
625
+ */
626
+ private static expandAbbreviations;
627
+ /**
628
+ * Resolves ambiguous pronouns ('it', 'this', 'they', 'the last one') against recent chat history.
629
+ */
630
+ private static resolveCoreferences;
631
+ /**
632
+ * Deep LLM-powered prompt optimizer for complex, multi-hop, or highly ambiguous user queries.
633
+ */
634
+ static optimizeWithLLM(rawPrompt: string, history?: ChatMessage[], llmProvider?: ILLMProvider): Promise<OptimizedPromptResult>;
635
+ }
636
+
546
637
  interface DataSignals {
547
638
  rowCount: number;
548
639
  hasNumericFields: boolean;
@@ -1421,4 +1512,4 @@ declare function initializeTelemetryService(projectId: string, licenseKey: strin
1421
1512
  */
1422
1513
  declare function shutdownTelemetryService(): Promise<void>;
1423
1514
 
1424
- 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, PRESETS, PineconeProvider, PostgreSQLProvider, 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 };
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 };
package/dist/server.d.ts CHANGED
@@ -1,9 +1,9 @@
1
- import { p as RagConfig, v as UniversalRagConfig, V as VectorDBConfig, w as UpsertDocument, y as VectorMatch, G as GraphDBConfig, H as GraphNode, J as Edge, K as GraphSearchResult, L as LLMConfig, f as EmbeddingConfig, I as ILLMProvider, x as VectorDBProvider, i as LLMProvider, g as EmbeddingProvider, R as RAGConfig, u as UIConfig, U as UITransformationResponse, C as ChatMessage, d as ChatOptions, E as EmbedOptions, h as IngestDocument, e as ChatResponse } from './ILLMProvider-DwFj0h2u.js';
2
- export { A as AuthMode, M as BarChartData, N as CarouselProduct, Q as IRetriever, j as LatencyBreakdown, S as LineChartDataPoint, X as MessageRole, Y as MetricCardData, O as ObservabilityTrace, Z as PieChartData, P as Product, k as ProjectAiSettings, l as ProjectAuthSettings, m as ProjectBrandingSettings, c as ProjectChatSettings, n as ProjectTelemetrySettings, o as ProjectWidgetSettings, q as RagMessage, r as RetrievalConfig, _ as RetrievalResult, s as RetrievedChunk, $ as RetrivoraChunkMetadata, a0 as RetrivoraIngestedDocument, a1 as ScatterPlotDataPoint, a2 as SuggestionsResponse, a3 as TableData, T as ThemeMode, t as TokenUsage, a as UseRagChatOptions, b as UseRagChatReturn, a4 as VisualizationType, W as WidgetPosition, z as WorkflowConfig, B as createDefaultProjectSettings, D as normalizeProjectSettings, F as projectSettingsToUiConfig } from './ILLMProvider-DwFj0h2u.js';
3
- import { o as DecisionContext, q as IntentCategory, I as IRenderRule, G as RenderDecision, p as IRendererStrategy } from './index-Xci6GfpI.js';
4
- export { V 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, W as DocumentChunker, D as DocumentUploadProps, E as EmbeddingFailedException, X as LicenseConfigResolver, L as LicenseTierConfig, r as LicenseValidationError, s as LicenseValidationRequest, t as LicenseValidationResponse, u as LicenseValidator, M as MessageBubbleProps, Y as Pipeline, 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-Xci6GfpI.js';
5
- import { I as IProviderValidator, a as IProviderHealthChecker, H as HealthCheckResult } from './index-Cb0GsT16.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-Cb0GsT16.js';
1
+ import { p as RagConfig, v as UniversalRagConfig, V as VectorDBConfig, w as UpsertDocument, y as VectorMatch, G as GraphDBConfig, H as GraphNode, J as Edge, K as GraphSearchResult, L as LLMConfig, f as EmbeddingConfig, I as ILLMProvider, x as VectorDBProvider, i as LLMProvider, g as EmbeddingProvider, R as RAGConfig, u as UIConfig, C as ChatMessage, U as UITransformationResponse, d as ChatOptions, E as EmbedOptions, h as IngestDocument, e as ChatResponse } from './ILLMProvider-B2N3lMBc.js';
2
+ export { A as AuthMode, M as BarChartData, N as CarouselProduct, Q as IRetriever, j as LatencyBreakdown, S as LineChartDataPoint, X as MessageRole, Y as MetricCardData, O as ObservabilityTrace, Z as PieChartData, P as Product, k as ProjectAiSettings, l as ProjectAuthSettings, m as ProjectBrandingSettings, c as ProjectChatSettings, n as ProjectTelemetrySettings, o as ProjectWidgetSettings, q as RagMessage, r as RetrievalConfig, _ as RetrievalResult, s as RetrievedChunk, $ as RetrivoraChunkMetadata, a0 as RetrivoraIngestedDocument, a1 as ScatterPlotDataPoint, a2 as SuggestionsResponse, a3 as TableData, T as ThemeMode, t as TokenUsage, a as UseRagChatOptions, b as UseRagChatReturn, a4 as VisualizationType, W as WidgetPosition, z as WorkflowConfig, B as createDefaultProjectSettings, D as normalizeProjectSettings, F as projectSettingsToUiConfig } from './ILLMProvider-B2N3lMBc.js';
3
+ import { o as DecisionContext, q as IntentCategory, I as IRenderRule, G as RenderDecision, p as IRendererStrategy } from './index-DdQxoIpu.js';
4
+ export { V 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, W as DocumentChunker, D as DocumentUploadProps, E as EmbeddingFailedException, X as LicenseConfigResolver, L as LicenseTierConfig, r as LicenseValidationError, s as LicenseValidationRequest, t as LicenseValidationResponse, u as LicenseValidator, M as MessageBubbleProps, Y as Pipeline, 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-DdQxoIpu.js';
5
+ import { I as IProviderValidator, a as IProviderHealthChecker, H as HealthCheckResult } from './index-BxzDv2jd.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-BxzDv2jd.js';
7
7
  import 'react';
8
8
  import 'next/server';
9
9
 
@@ -533,16 +533,107 @@ declare const VECTOR_PROFILES: {
533
533
 
534
534
  /**
535
535
  * DocumentParser — handles text extraction from various file formats.
536
- * Supported: .txt, .md, .json, .csv, .pdf, .docx, .doc, .xlsx, .xls
536
+ * Supported:
537
+ * - PowerPoint: .pptx, .ppt, .odp
538
+ * - Word: .docx, .doc, .odt, .rtf
539
+ * - Excel: .xlsx, .xls, .ods, .csv, .tsv
540
+ * - PDF: .pdf
541
+ * - Text & Code: .txt, .md, .json, .yaml, .yml, .xml, .html, .htm, .log, .epub
537
542
  */
538
543
  declare class DocumentParser {
544
+ /**
545
+ * Fast Magic-Bytes sniffer for instant file format identification (<1ms).
546
+ */
547
+ static sniffMagicBytes(buffer: Buffer): 'pdf' | 'zip' | 'ole2' | 'json' | 'text' | null;
548
+ /**
549
+ * Convert spreadsheet sheets into high-fidelity, context-preserved tabular text.
550
+ * Every row retains its column and section context so vector embeddings achieve 100% semantic retrieval precision.
551
+ */
552
+ private static formatSheetToContextualText;
539
553
  /**
540
554
  * Extract text from a File or Buffer based on its type.
541
555
  */
542
- static parse(file: File | Buffer, fileName: string, mimeType: string): Promise<string>;
556
+ static parse(file: File | Buffer, fileName: string, mimeType?: string): Promise<string>;
557
+ /**
558
+ * Helper to strip XML tags and normalize inner text content.
559
+ */
560
+ private static stripXmlTags;
561
+ /**
562
+ * Helper to strip HTML / XML tags while removing script and style blocks completely.
563
+ */
564
+ private static stripHtmlAndXml;
565
+ /**
566
+ * Safe text extraction from non-OpenXML / legacy Excel spreadsheets (.xls, BIFF8, HTML tables, XML Spreadsheet 2003).
567
+ */
568
+ private static parseLegacyExcelOrFallback;
569
+ /**
570
+ * Dynamically infer document domain and schema from extracted text, filename, and format.
571
+ */
572
+ static inferDocumentDomainAndSchema(text: string, fileName?: string, mimeType?: string): {
573
+ domain: 'finance' | 'ecommerce' | 'timeseries' | 'legal' | 'healthcare' | 'tabular' | 'general';
574
+ schema?: Record<string, string>;
575
+ isCatalog: boolean;
576
+ isFinancial: boolean;
577
+ };
543
578
  private static readAsText;
544
579
  }
545
580
 
581
+ /**
582
+ * PromptOptimizer — Intelligent query normalizer and prompt enhancement engine.
583
+ *
584
+ * Solves user prompt failures where the model or vector retrieval is unable to
585
+ * process poorly phrased, ambiguous, typo-ridden, pronoun-heavy, or underspecified queries.
586
+ *
587
+ * Responsibilities:
588
+ * 1. Syntax & Text Normalization: Strips non-printable artifacts, fixes unclosed delimiters, normalizes colloquial abbreviations.
589
+ * 2. Pronoun & Coreference Resolution: Resolves pronouns ('it', 'they', 'this', 'that') against conversation history.
590
+ * 3. Short & Underspecified Query Expansion: Expands one-word/vague queries into clear semantic questions for high-recall RAG.
591
+ * 4. LLM-Assisted Query Enhancement: Optional deep reformulation using the fast router LLM for multi-turn RAG reasoning.
592
+ */
593
+
594
+ interface PromptOptimizationOptions {
595
+ /** Whether to resolve pronouns and context from conversation history */
596
+ resolveHistory?: boolean;
597
+ /** Whether to expand short/underspecified keywords into complete questions */
598
+ expandKeywords?: boolean;
599
+ /** Optional LLM provider for deep reformulation on complex queries */
600
+ llmProvider?: ILLMProvider;
601
+ }
602
+ interface OptimizedPromptResult {
603
+ /** The final optimized prompt to send to the RAG retrieval and LLM synthesis */
604
+ optimizedPrompt: string;
605
+ /** The original raw user prompt */
606
+ originalPrompt: string;
607
+ /** Whether the prompt was modified during optimization */
608
+ wasModified: boolean;
609
+ /** List of optimization operations performed */
610
+ transformations: string[];
611
+ }
612
+ declare class PromptOptimizer {
613
+ private static readonly COMMON_ABBREVIATIONS;
614
+ private static readonly TOPIC_EXPANSIONS;
615
+ /**
616
+ * Optimizes a user prompt synchronously using fast heuristic rules and history resolution.
617
+ */
618
+ static optimize(rawPrompt: string, history?: ChatMessage[], options?: PromptOptimizationOptions): OptimizedPromptResult;
619
+ /**
620
+ * Cleans text artifacts, fixes unclosed quotes/parentheses, and collapses whitespace.
621
+ */
622
+ private static cleanText;
623
+ /**
624
+ * Replaces shorthand chat abbreviations with clear natural language.
625
+ */
626
+ private static expandAbbreviations;
627
+ /**
628
+ * Resolves ambiguous pronouns ('it', 'this', 'they', 'the last one') against recent chat history.
629
+ */
630
+ private static resolveCoreferences;
631
+ /**
632
+ * Deep LLM-powered prompt optimizer for complex, multi-hop, or highly ambiguous user queries.
633
+ */
634
+ static optimizeWithLLM(rawPrompt: string, history?: ChatMessage[], llmProvider?: ILLMProvider): Promise<OptimizedPromptResult>;
635
+ }
636
+
546
637
  interface DataSignals {
547
638
  rowCount: number;
548
639
  hasNumericFields: boolean;
@@ -1421,4 +1512,4 @@ declare function initializeTelemetryService(projectId: string, licenseKey: strin
1421
1512
  */
1422
1513
  declare function shutdownTelemetryService(): Promise<void>;
1423
1514
 
1424
- 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, PRESETS, PineconeProvider, PostgreSQLProvider, 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 };
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 };