@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.
- package/dist/{ILLMProvider-CbUtvWAW.d.mts → ILLMProvider-BQyKZLnd.d.mts} +10 -2
- package/dist/{ILLMProvider-CbUtvWAW.d.ts → ILLMProvider-BQyKZLnd.d.ts} +10 -2
- package/dist/handlers/index.d.mts +2 -2
- package/dist/handlers/index.d.ts +2 -2
- package/dist/handlers/index.js +1726 -522
- package/dist/handlers/index.mjs +1725 -521
- package/dist/{index-DgzcnqZs.d.ts → index-A0GqPsaG.d.ts} +1 -1
- package/dist/{index-c_y_5qdw.d.mts → index-CDftK3qs.d.mts} +1 -1
- package/dist/index.css +26 -0
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +246 -76
- package/dist/index.mjs +248 -76
- package/dist/server.d.mts +32 -5
- package/dist/server.d.ts +32 -5
- package/dist/server.js +1735 -733
- package/dist/server.mjs +1733 -731
- package/package.json +1 -1
- package/src/components/MarkdownComponents.tsx +3 -3
- package/src/components/MessageBubble.tsx +49 -2
- package/src/components/ProductCard.tsx +33 -6
- package/src/components/UIDispatcher.tsx +1 -0
- package/src/components/VisualizationRenderer.tsx +143 -11
- package/src/config/EmbeddingStrategy.ts +5 -4
- package/src/config/RagConfig.ts +10 -2
- package/src/config/serverConfig.ts +16 -1
- package/src/core/LLMRouter.ts +79 -0
- package/src/core/Pipeline.ts +262 -45
- package/src/core/ProviderRegistry.ts +6 -0
- package/src/core/QueryProcessor.ts +98 -0
- package/src/handlers/index.ts +8 -5
- package/src/hooks/useRagChat.ts +53 -17
- package/src/llm/providers/UniversalLLMAdapter.ts +110 -13
- package/src/providers/vectordb/ChromaDBProvider.ts +13 -6
- package/src/providers/vectordb/MilvusProvider.ts +18 -2
- package/src/providers/vectordb/MultiTablePostgresProvider.ts +16 -29
- package/src/providers/vectordb/PostgreSQLProvider.ts +4 -15
- package/src/providers/vectordb/QdrantProvider.ts +2 -5
- package/src/providers/vectordb/RedisProvider.ts +3 -4
- package/src/providers/vectordb/WeaviateProvider.ts +41 -3
- package/src/types/index.ts +26 -0
- package/src/utils/ProductExtractor.ts +5 -3
- package/src/utils/UITransformer.ts +1345 -534
- package/src/utils/synonyms.ts +2 -0
package/src/types/index.ts
CHANGED
|
@@ -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
|
|
203
|
-
['price', 'image', 'img', 'thumbnail', 'images', '
|
|
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
|
|
208
|
+
return hasStrongProductKey || hasProductIdentity || hasPricePattern || m.type === 'product';
|
|
207
209
|
})
|
|
208
210
|
.map(s => {
|
|
209
211
|
const m = (s.metadata ?? {}) as Record<string, unknown>;
|