@retrivora-ai/rag-engine 2.4.3 → 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 (139) 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 +27 -4
  4. package/dist/handlers/index.mjs +27 -4
  5. package/dist/index.d.mts +3 -3
  6. package/dist/index.d.ts +3 -3
  7. package/dist/index.js +12 -10
  8. package/dist/index.mjs +12 -10
  9. package/dist/server.d.mts +2 -2
  10. package/dist/server.d.ts +2 -2
  11. package/dist/server.js +28 -4
  12. package/dist/server.mjs +28 -4
  13. package/package.json +1 -3
  14. package/src/LicensedRetrivora.ts +0 -278
  15. package/src/app/api/chat/route.ts +0 -4
  16. package/src/app/api/health/route.ts +0 -5
  17. package/src/app/api/ingest/route.ts +0 -27
  18. package/src/app/api/suggestions/route.ts +0 -5
  19. package/src/app/api/upload/route.ts +0 -5
  20. package/src/app/constants.tsx +0 -270
  21. package/src/app/favicon.ico +0 -0
  22. package/src/app/globals.css +0 -449
  23. package/src/app/layout.tsx +0 -22
  24. package/src/app/page.tsx +0 -64
  25. package/src/app/types.ts +0 -30
  26. package/src/browser.tsx +0 -127
  27. package/src/components/ChatWidget.tsx +0 -393
  28. package/src/components/ChatWindow.tsx +0 -952
  29. package/src/components/CodeViewer.tsx +0 -56
  30. package/src/components/ConfigProvider.tsx +0 -141
  31. package/src/components/DocumentUpload.tsx +0 -354
  32. package/src/components/DynamicChart.tsx +0 -297
  33. package/src/components/HourglassLoader.tsx +0 -87
  34. package/src/components/MarkdownComponents.tsx +0 -186
  35. package/src/components/MessageBubble.tsx +0 -498
  36. package/src/components/ObservabilityPanel.tsx +0 -374
  37. package/src/components/ProductCard.tsx +0 -107
  38. package/src/components/ProductCarousel.tsx +0 -97
  39. package/src/components/SourceCard.tsx +0 -61
  40. package/src/components/ThemeProvider.tsx +0 -8
  41. package/src/components/ThemeToggle.tsx +0 -29
  42. package/src/components/ThinkingBlock.tsx +0 -75
  43. package/src/components/UIDispatcher.tsx +0 -342
  44. package/src/components/VisualizationRenderer.tsx +0 -621
  45. package/src/components/constants.tsx +0 -503
  46. package/src/config/ConfigBuilder.ts +0 -285
  47. package/src/config/EmbeddingStrategy.ts +0 -148
  48. package/src/config/LicenseConfigResolver.ts +0 -298
  49. package/src/config/RagConfig.ts +0 -328
  50. package/src/config/UniversalProfiles.ts +0 -82
  51. package/src/config/constants.ts +0 -64
  52. package/src/config/serverConfig.ts +0 -378
  53. package/src/config/uiConstants.ts +0 -47
  54. package/src/core/BatchProcessor.ts +0 -385
  55. package/src/core/CircuitBreaker.ts +0 -118
  56. package/src/core/ConfigFetcher.ts +0 -220
  57. package/src/core/ConfigResolver.ts +0 -165
  58. package/src/core/ConfigValidator.ts +0 -197
  59. package/src/core/DatabaseStorage.ts +0 -526
  60. package/src/core/FreeTierLimitsGuard.ts +0 -281
  61. package/src/core/LLMRouter.ts +0 -79
  62. package/src/core/LangChainAgent.ts +0 -132
  63. package/src/core/LicenseValidator.ts +0 -284
  64. package/src/core/LicenseVerifier.ts +0 -261
  65. package/src/core/MultiAgentCoordinator.ts +0 -239
  66. package/src/core/Pipeline.ts +0 -1279
  67. package/src/core/PluginManager.ts +0 -277
  68. package/src/core/ProjectSettings.ts +0 -247
  69. package/src/core/ProviderHealthCheck.ts +0 -133
  70. package/src/core/ProviderInterfaces.ts +0 -37
  71. package/src/core/ProviderRegistry.ts +0 -156
  72. package/src/core/QueryProcessor.ts +0 -399
  73. package/src/core/Retrivora.ts +0 -98
  74. package/src/core/VectorPlugin.ts +0 -193
  75. package/src/core/mcp.ts +0 -261
  76. package/src/exceptions/index.ts +0 -131
  77. package/src/handlers/index.ts +0 -1625
  78. package/src/hooks/useHydrated.ts +0 -13
  79. package/src/hooks/useProjectSettings.ts +0 -105
  80. package/src/hooks/useRagChat.ts +0 -436
  81. package/src/hooks/useStoredMessages.ts +0 -64
  82. package/src/index.css +0 -4269
  83. package/src/index.ts +0 -137
  84. package/src/lib/plugin.ts +0 -24
  85. package/src/llm/ILLMProvider.ts +0 -60
  86. package/src/llm/LLMFactory.ts +0 -141
  87. package/src/llm/providers/AnthropicProvider.ts +0 -215
  88. package/src/llm/providers/GeminiProvider.ts +0 -311
  89. package/src/llm/providers/GroqProvider.ts +0 -184
  90. package/src/llm/providers/OllamaProvider.ts +0 -232
  91. package/src/llm/providers/OpenAIProvider.ts +0 -188
  92. package/src/llm/providers/QwenProvider.ts +0 -199
  93. package/src/llm/providers/UniversalLLMAdapter.ts +0 -422
  94. package/src/llm/utils.ts +0 -46
  95. package/src/providers/graphdb/BaseGraphProvider.ts +0 -43
  96. package/src/providers/graphdb/SimpleGraphProvider.ts +0 -66
  97. package/src/providers/vectordb/BaseVectorProvider.ts +0 -98
  98. package/src/providers/vectordb/ChromaDBProvider.ts +0 -130
  99. package/src/providers/vectordb/MilvusProvider.ts +0 -134
  100. package/src/providers/vectordb/MongoDBProvider.ts +0 -250
  101. package/src/providers/vectordb/MultiTablePostgresProvider.ts +0 -461
  102. package/src/providers/vectordb/PineconeProvider.ts +0 -295
  103. package/src/providers/vectordb/PostgreSQLProvider.ts +0 -227
  104. package/src/providers/vectordb/QdrantProvider.ts +0 -294
  105. package/src/providers/vectordb/RedisProvider.ts +0 -105
  106. package/src/providers/vectordb/UniversalVectorProvider.ts +0 -221
  107. package/src/providers/vectordb/WeaviateProvider.ts +0 -172
  108. package/src/rag/DocumentChunker.ts +0 -144
  109. package/src/rag/EntityExtractor.ts +0 -90
  110. package/src/rag/LlamaIndexIngestor.ts +0 -60
  111. package/src/rag/Reranker.ts +0 -106
  112. package/src/rendering/IntentClassifier.ts +0 -167
  113. package/src/rendering/RendererRegistry.ts +0 -164
  114. package/src/rendering/RuleEngine.ts +0 -67
  115. package/src/rendering/VisualizationDecisionEngine.ts +0 -164
  116. package/src/rendering/__tests__/VisualizationDecisionEngine.test.ts +0 -237
  117. package/src/rendering/index.ts +0 -12
  118. package/src/rendering/rules/Rule1SpecificInfoRule.ts +0 -28
  119. package/src/rendering/rules/Rule2ComparisonRule.ts +0 -24
  120. package/src/rendering/rules/Rule3ProductDiscoveryRule.ts +0 -28
  121. package/src/rendering/rules/Rule4AnalyticalRule.ts +0 -38
  122. package/src/rendering/rules/Rule5MixedResponseRule.ts +0 -29
  123. package/src/rendering/rules/Rule6SmallResultSetRule.ts +0 -24
  124. package/src/rendering/rules/Rule7LargeTableRule.ts +0 -35
  125. package/src/rendering/types.ts +0 -96
  126. package/src/server.ts +0 -156
  127. package/src/tailwind.css +0 -194
  128. package/src/telemetry/TelemetryService.ts +0 -330
  129. package/src/types/chat.ts +0 -89
  130. package/src/types/index.ts +0 -278
  131. package/src/types/pdf-parse.d.ts +0 -13
  132. package/src/types/props.ts +0 -169
  133. package/src/utils/DocumentParser.ts +0 -111
  134. package/src/utils/ProductExtractor.ts +0 -350
  135. package/src/utils/SchemaMapper.ts +0 -176
  136. package/src/utils/UITransformer.ts +0 -1812
  137. package/src/utils/synonyms.ts +0 -80
  138. package/src/utils/templateUtils.ts +0 -78
  139. 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';