@retrivora-ai/rag-engine 2.4.2 → 2.4.5

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 (140) hide show
  1. package/dist/{BatchProcessor-zbQMaZHm.d.mts → BatchProcessor-Csy_K1qQ.d.mts} +2 -0
  2. package/dist/{BatchProcessor-D42E706a.d.ts → BatchProcessor-Dg18zZGk.d.ts} +2 -0
  3. package/dist/handlers/index.js +31 -5
  4. package/dist/handlers/index.mjs +31 -5
  5. package/dist/index.d.mts +3 -3
  6. package/dist/index.d.ts +3 -3
  7. package/dist/index.js +41 -21
  8. package/dist/index.min.css +2 -0
  9. package/dist/index.mjs +41 -21
  10. package/dist/server.d.mts +2 -2
  11. package/dist/server.d.ts +2 -2
  12. package/dist/server.js +32 -5
  13. package/dist/server.mjs +32 -5
  14. package/package.json +5 -4
  15. package/src/LicensedRetrivora.ts +0 -278
  16. package/src/app/api/chat/route.ts +0 -4
  17. package/src/app/api/health/route.ts +0 -5
  18. package/src/app/api/ingest/route.ts +0 -27
  19. package/src/app/api/suggestions/route.ts +0 -5
  20. package/src/app/api/upload/route.ts +0 -5
  21. package/src/app/constants.tsx +0 -270
  22. package/src/app/favicon.ico +0 -0
  23. package/src/app/globals.css +0 -449
  24. package/src/app/layout.tsx +0 -22
  25. package/src/app/page.tsx +0 -64
  26. package/src/app/types.ts +0 -30
  27. package/src/browser.tsx +0 -139
  28. package/src/components/ChatWidget.tsx +0 -393
  29. package/src/components/ChatWindow.tsx +0 -952
  30. package/src/components/CodeViewer.tsx +0 -56
  31. package/src/components/ConfigProvider.tsx +0 -123
  32. package/src/components/DocumentUpload.tsx +0 -354
  33. package/src/components/DynamicChart.tsx +0 -297
  34. package/src/components/HourglassLoader.tsx +0 -87
  35. package/src/components/MarkdownComponents.tsx +0 -186
  36. package/src/components/MessageBubble.tsx +0 -498
  37. package/src/components/ObservabilityPanel.tsx +0 -374
  38. package/src/components/ProductCard.tsx +0 -107
  39. package/src/components/ProductCarousel.tsx +0 -97
  40. package/src/components/SourceCard.tsx +0 -61
  41. package/src/components/ThemeProvider.tsx +0 -8
  42. package/src/components/ThemeToggle.tsx +0 -29
  43. package/src/components/ThinkingBlock.tsx +0 -75
  44. package/src/components/UIDispatcher.tsx +0 -342
  45. package/src/components/VisualizationRenderer.tsx +0 -621
  46. package/src/components/constants.tsx +0 -503
  47. package/src/config/ConfigBuilder.ts +0 -285
  48. package/src/config/EmbeddingStrategy.ts +0 -148
  49. package/src/config/LicenseConfigResolver.ts +0 -298
  50. package/src/config/RagConfig.ts +0 -328
  51. package/src/config/UniversalProfiles.ts +0 -82
  52. package/src/config/constants.ts +0 -64
  53. package/src/config/serverConfig.ts +0 -378
  54. package/src/config/uiConstants.ts +0 -47
  55. package/src/core/BatchProcessor.ts +0 -385
  56. package/src/core/CircuitBreaker.ts +0 -118
  57. package/src/core/ConfigFetcher.ts +0 -220
  58. package/src/core/ConfigResolver.ts +0 -165
  59. package/src/core/ConfigValidator.ts +0 -197
  60. package/src/core/DatabaseStorage.ts +0 -526
  61. package/src/core/FreeTierLimitsGuard.ts +0 -281
  62. package/src/core/LLMRouter.ts +0 -79
  63. package/src/core/LangChainAgent.ts +0 -132
  64. package/src/core/LicenseValidator.ts +0 -284
  65. package/src/core/LicenseVerifier.ts +0 -261
  66. package/src/core/MultiAgentCoordinator.ts +0 -239
  67. package/src/core/Pipeline.ts +0 -1279
  68. package/src/core/PluginManager.ts +0 -277
  69. package/src/core/ProjectSettings.ts +0 -247
  70. package/src/core/ProviderHealthCheck.ts +0 -133
  71. package/src/core/ProviderInterfaces.ts +0 -37
  72. package/src/core/ProviderRegistry.ts +0 -156
  73. package/src/core/QueryProcessor.ts +0 -399
  74. package/src/core/Retrivora.ts +0 -98
  75. package/src/core/VectorPlugin.ts +0 -193
  76. package/src/core/mcp.ts +0 -261
  77. package/src/exceptions/index.ts +0 -131
  78. package/src/handlers/index.ts +0 -1625
  79. package/src/hooks/useHydrated.ts +0 -13
  80. package/src/hooks/useProjectSettings.ts +0 -105
  81. package/src/hooks/useRagChat.ts +0 -436
  82. package/src/hooks/useStoredMessages.ts +0 -64
  83. package/src/index.css +0 -4269
  84. package/src/index.ts +0 -137
  85. package/src/lib/plugin.ts +0 -24
  86. package/src/llm/ILLMProvider.ts +0 -60
  87. package/src/llm/LLMFactory.ts +0 -141
  88. package/src/llm/providers/AnthropicProvider.ts +0 -215
  89. package/src/llm/providers/GeminiProvider.ts +0 -311
  90. package/src/llm/providers/GroqProvider.ts +0 -184
  91. package/src/llm/providers/OllamaProvider.ts +0 -232
  92. package/src/llm/providers/OpenAIProvider.ts +0 -188
  93. package/src/llm/providers/QwenProvider.ts +0 -199
  94. package/src/llm/providers/UniversalLLMAdapter.ts +0 -422
  95. package/src/llm/utils.ts +0 -46
  96. package/src/providers/graphdb/BaseGraphProvider.ts +0 -43
  97. package/src/providers/graphdb/SimpleGraphProvider.ts +0 -66
  98. package/src/providers/vectordb/BaseVectorProvider.ts +0 -98
  99. package/src/providers/vectordb/ChromaDBProvider.ts +0 -130
  100. package/src/providers/vectordb/MilvusProvider.ts +0 -134
  101. package/src/providers/vectordb/MongoDBProvider.ts +0 -250
  102. package/src/providers/vectordb/MultiTablePostgresProvider.ts +0 -461
  103. package/src/providers/vectordb/PineconeProvider.ts +0 -295
  104. package/src/providers/vectordb/PostgreSQLProvider.ts +0 -227
  105. package/src/providers/vectordb/QdrantProvider.ts +0 -294
  106. package/src/providers/vectordb/RedisProvider.ts +0 -105
  107. package/src/providers/vectordb/UniversalVectorProvider.ts +0 -221
  108. package/src/providers/vectordb/WeaviateProvider.ts +0 -172
  109. package/src/rag/DocumentChunker.ts +0 -144
  110. package/src/rag/EntityExtractor.ts +0 -90
  111. package/src/rag/LlamaIndexIngestor.ts +0 -60
  112. package/src/rag/Reranker.ts +0 -106
  113. package/src/rendering/IntentClassifier.ts +0 -167
  114. package/src/rendering/RendererRegistry.ts +0 -164
  115. package/src/rendering/RuleEngine.ts +0 -67
  116. package/src/rendering/VisualizationDecisionEngine.ts +0 -164
  117. package/src/rendering/__tests__/VisualizationDecisionEngine.test.ts +0 -237
  118. package/src/rendering/index.ts +0 -12
  119. package/src/rendering/rules/Rule1SpecificInfoRule.ts +0 -28
  120. package/src/rendering/rules/Rule2ComparisonRule.ts +0 -24
  121. package/src/rendering/rules/Rule3ProductDiscoveryRule.ts +0 -28
  122. package/src/rendering/rules/Rule4AnalyticalRule.ts +0 -38
  123. package/src/rendering/rules/Rule5MixedResponseRule.ts +0 -29
  124. package/src/rendering/rules/Rule6SmallResultSetRule.ts +0 -24
  125. package/src/rendering/rules/Rule7LargeTableRule.ts +0 -35
  126. package/src/rendering/types.ts +0 -96
  127. package/src/server.ts +0 -156
  128. package/src/tailwind.css +0 -194
  129. package/src/telemetry/TelemetryService.ts +0 -330
  130. package/src/types/chat.ts +0 -89
  131. package/src/types/index.ts +0 -278
  132. package/src/types/pdf-parse.d.ts +0 -13
  133. package/src/types/props.ts +0 -169
  134. package/src/utils/DocumentParser.ts +0 -111
  135. package/src/utils/ProductExtractor.ts +0 -350
  136. package/src/utils/SchemaMapper.ts +0 -176
  137. package/src/utils/UITransformer.ts +0 -1812
  138. package/src/utils/synonyms.ts +0 -80
  139. package/src/utils/templateUtils.ts +0 -78
  140. package/src/version.ts +0 -6
@@ -1,80 +0,0 @@
1
- /**
2
- * Shared synonym map used by UITransformer and MessageBubble to resolve
3
- * schema-agnostic field names from vector metadata.
4
- */
5
- export const FIELD_SYNONYMS: Record<string, string[]> = {
6
- name: ['product', 'item', 'title', 'label', 'heading', 'subject', 'product name', 'item name'],
7
- price: ['cost', 'amount', 'msrp', 'price', 'rate', 'value', 'price_usd', 'variant price'],
8
- brand: ['manufacturer', 'vendor', 'make', 'company', 'brand_name', 'supplier'],
9
- image: ['imageUrl', 'thumbnail', 'img', 'url', 'photo', 'picture', 'media', 'image_url',
10
- 'main_image', 'product_image', 'thumb', 'image src', 'variant image'],
11
- stock: ['inventory', 'quantity', 'count', 'availability', 'stock_level', 'inStock',
12
- 'is_available', 'in stock', 'status', 'variant inventory qty'],
13
- category: ['product_category', 'product category', 'category_name', 'category name',
14
- 'department', 'collection', 'type'],
15
- description: ['summary', 'content', 'body', 'text', 'info', 'details', 'body (html)', 'seo description'],
16
- link: ['url', 'href', 'product_url', 'page_url', 'link'],
17
- };
18
-
19
- /**
20
- * Dynamically registers new synonyms into the global FIELD_SYNONYMS dictionary.
21
- * You can call this during your app initialization to support custom schema fields.
22
- */
23
- export function addSynonyms(customSynonyms: Record<string, string[]>) {
24
- for (const [key, aliases] of Object.entries(customSynonyms)) {
25
- if (!FIELD_SYNONYMS[key]) {
26
- FIELD_SYNONYMS[key] = [];
27
- }
28
- const existing = new Set(FIELD_SYNONYMS[key].map(s => s.toLowerCase()));
29
-
30
- for (const alias of aliases) {
31
- if (!existing.has(alias.toLowerCase())) {
32
- FIELD_SYNONYMS[key].push(alias);
33
- existing.add(alias.toLowerCase());
34
- }
35
- }
36
- }
37
- }
38
-
39
- /**
40
- * Robustly extract a value from metadata by checking exact, case-insensitive,
41
- * and synonym-based key matches.
42
- */
43
- export function resolveMetadataValue(
44
- meta: Record<string, unknown>,
45
- uiKey: string,
46
- ): unknown {
47
- const synonyms = FIELD_SYNONYMS[uiKey] ?? [];
48
-
49
- const keys = Object.keys(meta);
50
- const systemKeys = ['namespace', 'filename', 'filesize', 'filetype', 'docid', 'uploadedat', 'dimension', 'chunkindex'];
51
-
52
- // 1. Exact case-insensitive match for primary key
53
- let match = keys.find((k) => k.toLowerCase() === uiKey.toLowerCase());
54
- if (match !== undefined) return meta[match];
55
-
56
- // 2. Exact case-insensitive match for synonyms
57
- match = keys.find((k) => synonyms.map(s => s.toLowerCase()).includes(k.toLowerCase()));
58
- if (match !== undefined) return meta[match];
59
-
60
- const isBlacklisted = (kl: string) => {
61
- return systemKeys.includes(kl) || kl.startsWith('option1') || kl.startsWith('option2') || kl.startsWith('option3');
62
- };
63
-
64
- // 3. Partial match (substring) strictly for primary key
65
- match = keys.find((k) => {
66
- const kl = k.toLowerCase();
67
- if (isBlacklisted(kl)) return false;
68
- return kl.includes(uiKey.toLowerCase());
69
- });
70
- if (match !== undefined) return meta[match];
71
-
72
- // 4. Partial match (substring) for synonyms
73
- match = keys.find((k) => {
74
- const kl = k.toLowerCase();
75
- if (isBlacklisted(kl)) return false;
76
- return synonyms.some((sk) => kl.includes(sk.toLowerCase()) || sk.toLowerCase().includes(kl));
77
- });
78
-
79
- return match !== undefined ? meta[match] : undefined;
80
- }
@@ -1,78 +0,0 @@
1
- /**
2
- * Utility functions for Universal Configuration Adapters.
3
- * Handles JSON path extraction and payload templating.
4
- */
5
-
6
- /**
7
- * Resolves a dot-notation or bracket-notation path on an object.
8
- * Example: resolvePath({ a: { b: [10, 20] } }, 'a.b[1]') => 20
9
- */
10
- function isRecord(value: unknown): value is Record<string, unknown> {
11
- return typeof value === 'object' && value !== null;
12
- }
13
-
14
- export function resolvePath(obj: unknown, path: string): unknown {
15
- if (!path || !obj) return undefined;
16
- return path
17
- .replace(/\[(\w+)\]/g, '.$1') // convert indexes to properties
18
- .replace(/^\./, '') // strip a leading dot
19
- .split('.')
20
- .reduce<unknown>((current, segment) => {
21
- if (!isRecord(current) && !Array.isArray(current)) {
22
- return undefined;
23
- }
24
-
25
- return current[segment as keyof typeof current];
26
- }, obj);
27
- }
28
-
29
- /**
30
- * Replaces mustache-style variables in a JSON template string.
31
- * It handles both quoted "{{key}}" and unquoted {{key}} replacements.
32
- *
33
- * Note: To avoid JSON syntax errors, variables should be used as standalone
34
- * values in the template, e.g., { "query": {{vector}} } or { "text": "{{content}}" }.
35
- * Inline string concatenation like { "text": "Context: {{content}}" } is not supported
36
- * for complex objects or escaped strings.
37
- */
38
- export function buildPayload(template: string, vars: Record<string, unknown>): unknown {
39
- let raw = template;
40
- for (const [key, val] of Object.entries(vars)) {
41
- // stringify handles quoting and escaping for us
42
- const stringifiedVal = val === undefined ? 'null' : JSON.stringify(val);
43
-
44
- // Replace exact quoted occurrences first: "{{key}}" -> "escaped string" or [array]
45
- raw = raw.replace(new RegExp(`"\\{\\{${key}\\}\\}"`, 'g'), stringifiedVal);
46
-
47
- // Replace unquoted occurrences: {{key}} -> "escaped string" or [array]
48
- raw = raw.replace(new RegExp(`\\{\\{${key}\\}\\}`, 'g'), stringifiedVal);
49
- }
50
-
51
- try {
52
- return JSON.parse(raw) as unknown;
53
- } catch (err) {
54
- throw new Error(`Failed to parse payload template: ${(err as Error).message}\nRaw payload: ${raw}`);
55
- }
56
- }
57
-
58
- /**
59
- * Merges two objects, ignoring undefined, null, or empty string values in the override.
60
- */
61
- export function mergeDefined<T extends object>(
62
- base: T | undefined | null,
63
- override?: Partial<T>
64
- ): T {
65
- const merged = { ...(base || {}) } as T;
66
-
67
- if (!override) {
68
- return merged;
69
- }
70
-
71
- for (const [key, value] of Object.entries(override)) {
72
- if (value !== undefined && value !== null && value !== '') {
73
- (merged as Record<string, unknown>)[key] = value;
74
- }
75
- }
76
-
77
- return merged;
78
- }
package/src/version.ts DELETED
@@ -1,6 +0,0 @@
1
- import pkg from '../package.json';
2
-
3
- /**
4
- * Dynamically resolved SDK Version from package.json
5
- */
6
- export const SDK_VERSION: string = pkg.version || '2.1.3';