@retrivora-ai/rag-engine 1.8.9 → 1.9.1

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 (44) hide show
  1. package/dist/{ILLMProvider-CbUtvWAW.d.mts → ILLMProvider-BQyKZLnd.d.mts} +10 -2
  2. package/dist/{ILLMProvider-CbUtvWAW.d.ts → ILLMProvider-BQyKZLnd.d.ts} +10 -2
  3. package/dist/handlers/index.d.mts +2 -2
  4. package/dist/handlers/index.d.ts +2 -2
  5. package/dist/handlers/index.js +1726 -522
  6. package/dist/handlers/index.mjs +1725 -521
  7. package/dist/{index-DgzcnqZs.d.ts → index-A0GqPsaG.d.ts} +1 -1
  8. package/dist/{index-c_y_5qdw.d.mts → index-CDftK3qs.d.mts} +1 -1
  9. package/dist/index.css +26 -0
  10. package/dist/index.d.mts +2 -2
  11. package/dist/index.d.ts +2 -2
  12. package/dist/index.js +246 -76
  13. package/dist/index.mjs +248 -76
  14. package/dist/server.d.mts +32 -5
  15. package/dist/server.d.ts +32 -5
  16. package/dist/server.js +1735 -733
  17. package/dist/server.mjs +1733 -731
  18. package/package.json +1 -1
  19. package/src/components/MarkdownComponents.tsx +3 -3
  20. package/src/components/MessageBubble.tsx +49 -2
  21. package/src/components/ProductCard.tsx +33 -6
  22. package/src/components/UIDispatcher.tsx +1 -0
  23. package/src/components/VisualizationRenderer.tsx +143 -11
  24. package/src/config/EmbeddingStrategy.ts +5 -4
  25. package/src/config/RagConfig.ts +10 -2
  26. package/src/config/serverConfig.ts +16 -1
  27. package/src/core/LLMRouter.ts +79 -0
  28. package/src/core/Pipeline.ts +262 -45
  29. package/src/core/ProviderRegistry.ts +6 -0
  30. package/src/core/QueryProcessor.ts +98 -0
  31. package/src/handlers/index.ts +8 -5
  32. package/src/hooks/useRagChat.ts +53 -17
  33. package/src/llm/providers/UniversalLLMAdapter.ts +110 -13
  34. package/src/providers/vectordb/ChromaDBProvider.ts +13 -6
  35. package/src/providers/vectordb/MilvusProvider.ts +18 -2
  36. package/src/providers/vectordb/MultiTablePostgresProvider.ts +16 -29
  37. package/src/providers/vectordb/PostgreSQLProvider.ts +4 -15
  38. package/src/providers/vectordb/QdrantProvider.ts +2 -5
  39. package/src/providers/vectordb/RedisProvider.ts +3 -4
  40. package/src/providers/vectordb/WeaviateProvider.ts +41 -3
  41. package/src/types/index.ts +26 -0
  42. package/src/utils/ProductExtractor.ts +5 -3
  43. package/src/utils/UITransformer.ts +1345 -534
  44. package/src/utils/synonyms.ts +2 -0
@@ -125,7 +125,12 @@ export type VisualizationType =
125
125
  | 'pie_chart'
126
126
  | 'bar_chart'
127
127
  | 'line_chart'
128
+ | 'histogram'
129
+ | 'horizontal_bar'
130
+ | 'scatter_plot'
128
131
  | 'radar_chart'
132
+ | 'metric_card'
133
+ | 'geo_map'
129
134
  | 'table'
130
135
  | 'product_carousel'
131
136
  | 'carousel'
@@ -173,6 +178,27 @@ export interface LineChartDataPoint {
173
178
  [key: string]: unknown;
174
179
  }
175
180
 
181
+ /**
182
+ * Scatter plot data point
183
+ */
184
+ export interface ScatterPlotDataPoint {
185
+ x: number;
186
+ y: number;
187
+ label?: string;
188
+ [key: string]: unknown;
189
+ }
190
+
191
+ /**
192
+ * KPI / metric card representation
193
+ */
194
+ export interface MetricCardData {
195
+ label: string;
196
+ value: number;
197
+ operation?: 'sum' | 'average' | 'count' | 'min' | 'max' | 'median';
198
+ unit?: string;
199
+ details?: Record<string, string | number | boolean>;
200
+ }
201
+
176
202
  /**
177
203
  * Table representation
178
204
  */
@@ -199,11 +199,13 @@ export function extractProductsFromSources(sources: VectorMatch[] | undefined, i
199
199
  .filter(s => {
200
200
  const m = s.metadata ?? {};
201
201
  const keys = Object.keys(m).map(k => k.toLowerCase());
202
- const hasProductKey = keys.some(k =>
203
- ['price', 'image', 'img', 'thumbnail', 'images', 'brand', 'product', 'sku', 'category', 'model', 'cost'].includes(k)
202
+ const hasStrongProductKey = keys.some(k =>
203
+ ['price', 'image', 'img', 'thumbnail', 'images', 'product', 'sku', 'cost'].includes(k)
204
204
  );
205
+ const hasProductIdentity = keys.some(k => ['brand', 'model'].includes(k)) &&
206
+ keys.some(k => ['name', 'title', 'product_name', 'product'].includes(k));
205
207
  const hasPricePattern = /\$\s*\d+/.test(s.content);
206
- return hasProductKey || hasPricePattern || m.type === 'product';
208
+ return hasStrongProductKey || hasProductIdentity || hasPricePattern || m.type === 'product';
207
209
  })
208
210
  .map(s => {
209
211
  const m = (s.metadata ?? {}) as Record<string, unknown>;