@retrivora-ai/rag-engine 1.4.9 → 1.5.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/{chunk-FHNGNXXS.mjs → chunk-NXEX6XM6.mjs} +8 -12
- package/dist/handlers/index.js +8 -12
- package/dist/handlers/index.mjs +1 -1
- package/dist/index.js +1 -3
- package/dist/index.mjs +1 -3
- package/dist/server.js +8 -12
- package/dist/server.mjs +1 -1
- package/package.json +1 -1
- package/src/components/MessageBubble.tsx +1 -10
- package/src/core/Pipeline.ts +8 -12
|
@@ -2263,18 +2263,14 @@ var Pipeline = class {
|
|
|
2263
2263
|
const chartInstruction = `
|
|
2264
2264
|
|
|
2265
2265
|
${CHART_MARKER}
|
|
2266
|
-
###
|
|
2267
|
-
You
|
|
2268
|
-
1.
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
{
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
"dataKeys": ["key_for_values"],
|
|
2275
|
-
"data": [ { "key_for_labels": "Category A", "key_for_values": 100 }, ... ]
|
|
2276
|
-
}
|
|
2277
|
-
4. RULES: Valid JSON only. No math. No text-based charts. No markdown tables for graphs. If showing a chart, DO NOT output a "products" JSON carousel.`;
|
|
2266
|
+
### DATA REPRESENTATION TOOLBOX:
|
|
2267
|
+
You have two specialized formats for structured data. Choose the one (or both) that provides the most value to the user:
|
|
2268
|
+
1. \`\`\`chart\`\`\` block: Best for statistics, distributions, and comparisons.
|
|
2269
|
+
Format: { "type": "bar" | "line" | "pie", "data": [ { "label": "X", "value": 10 } ] }
|
|
2270
|
+
2. \`\`\`json\`\`\` (products) block: Best for listing or browsing specific items.
|
|
2271
|
+
Format: { "type": "products", "data": [...] }
|
|
2272
|
+
|
|
2273
|
+
RULES: Output MUST be valid JSON. Data objects MUST be FLAT. Never draw charts with text or markdown tables.`;
|
|
2278
2274
|
if (!((_a = this.config.llm.systemPrompt) == null ? void 0 : _a.includes(CHART_MARKER))) {
|
|
2279
2275
|
this.config.llm.systemPrompt = (this.config.llm.systemPrompt || "") + chartInstruction;
|
|
2280
2276
|
}
|
package/dist/handlers/index.js
CHANGED
|
@@ -3826,18 +3826,14 @@ var Pipeline = class {
|
|
|
3826
3826
|
const chartInstruction = `
|
|
3827
3827
|
|
|
3828
3828
|
${CHART_MARKER}
|
|
3829
|
-
###
|
|
3830
|
-
You
|
|
3831
|
-
1.
|
|
3832
|
-
|
|
3833
|
-
|
|
3834
|
-
{
|
|
3835
|
-
|
|
3836
|
-
|
|
3837
|
-
"dataKeys": ["key_for_values"],
|
|
3838
|
-
"data": [ { "key_for_labels": "Category A", "key_for_values": 100 }, ... ]
|
|
3839
|
-
}
|
|
3840
|
-
4. RULES: Valid JSON only. No math. No text-based charts. No markdown tables for graphs. If showing a chart, DO NOT output a "products" JSON carousel.`;
|
|
3829
|
+
### DATA REPRESENTATION TOOLBOX:
|
|
3830
|
+
You have two specialized formats for structured data. Choose the one (or both) that provides the most value to the user:
|
|
3831
|
+
1. \`\`\`chart\`\`\` block: Best for statistics, distributions, and comparisons.
|
|
3832
|
+
Format: { "type": "bar" | "line" | "pie", "data": [ { "label": "X", "value": 10 } ] }
|
|
3833
|
+
2. \`\`\`json\`\`\` (products) block: Best for listing or browsing specific items.
|
|
3834
|
+
Format: { "type": "products", "data": [...] }
|
|
3835
|
+
|
|
3836
|
+
RULES: Output MUST be valid JSON. Data objects MUST be FLAT. Never draw charts with text or markdown tables.`;
|
|
3841
3837
|
if (!((_a = this.config.llm.systemPrompt) == null ? void 0 : _a.includes(CHART_MARKER))) {
|
|
3842
3838
|
this.config.llm.systemPrompt = (this.config.llm.systemPrompt || "") + chartInstruction;
|
|
3843
3839
|
}
|
package/dist/handlers/index.mjs
CHANGED
package/dist/index.js
CHANGED
|
@@ -504,9 +504,7 @@ function MessageBubble({
|
|
|
504
504
|
});
|
|
505
505
|
}, [sources, isUser]);
|
|
506
506
|
const { productsFromContent, cleanContent } = import_react5.default.useMemo(() => {
|
|
507
|
-
if (isUser)
|
|
508
|
-
const isVisualization = message.content.includes("```chart") || message.content.toLowerCase().includes("pie chart") || message.content.toLowerCase().includes("bar chart") || message.content.toLowerCase().includes("distribution");
|
|
509
|
-
if (isVisualization) {
|
|
507
|
+
if (isUser) {
|
|
510
508
|
return { productsFromContent: [], cleanContent: message.content };
|
|
511
509
|
}
|
|
512
510
|
const jsonRegex = /```json\s*([\s\S]*?)\s*```/g;
|
package/dist/index.mjs
CHANGED
|
@@ -467,9 +467,7 @@ function MessageBubble({
|
|
|
467
467
|
});
|
|
468
468
|
}, [sources, isUser]);
|
|
469
469
|
const { productsFromContent, cleanContent } = React5.useMemo(() => {
|
|
470
|
-
if (isUser)
|
|
471
|
-
const isVisualization = message.content.includes("```chart") || message.content.toLowerCase().includes("pie chart") || message.content.toLowerCase().includes("bar chart") || message.content.toLowerCase().includes("distribution");
|
|
472
|
-
if (isVisualization) {
|
|
470
|
+
if (isUser) {
|
|
473
471
|
return { productsFromContent: [], cleanContent: message.content };
|
|
474
472
|
}
|
|
475
473
|
const jsonRegex = /```json\s*([\s\S]*?)\s*```/g;
|
package/dist/server.js
CHANGED
|
@@ -3917,18 +3917,14 @@ var Pipeline = class {
|
|
|
3917
3917
|
const chartInstruction = `
|
|
3918
3918
|
|
|
3919
3919
|
${CHART_MARKER}
|
|
3920
|
-
###
|
|
3921
|
-
You
|
|
3922
|
-
1.
|
|
3923
|
-
|
|
3924
|
-
|
|
3925
|
-
{
|
|
3926
|
-
|
|
3927
|
-
|
|
3928
|
-
"dataKeys": ["key_for_values"],
|
|
3929
|
-
"data": [ { "key_for_labels": "Category A", "key_for_values": 100 }, ... ]
|
|
3930
|
-
}
|
|
3931
|
-
4. RULES: Valid JSON only. No math. No text-based charts. No markdown tables for graphs. If showing a chart, DO NOT output a "products" JSON carousel.`;
|
|
3920
|
+
### DATA REPRESENTATION TOOLBOX:
|
|
3921
|
+
You have two specialized formats for structured data. Choose the one (or both) that provides the most value to the user:
|
|
3922
|
+
1. \`\`\`chart\`\`\` block: Best for statistics, distributions, and comparisons.
|
|
3923
|
+
Format: { "type": "bar" | "line" | "pie", "data": [ { "label": "X", "value": 10 } ] }
|
|
3924
|
+
2. \`\`\`json\`\`\` (products) block: Best for listing or browsing specific items.
|
|
3925
|
+
Format: { "type": "products", "data": [...] }
|
|
3926
|
+
|
|
3927
|
+
RULES: Output MUST be valid JSON. Data objects MUST be FLAT. Never draw charts with text or markdown tables.`;
|
|
3932
3928
|
if (!((_a = this.config.llm.systemPrompt) == null ? void 0 : _a.includes(CHART_MARKER))) {
|
|
3933
3929
|
this.config.llm.systemPrompt = (this.config.llm.systemPrompt || "") + chartInstruction;
|
|
3934
3930
|
}
|
package/dist/server.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@retrivora-ai/rag-engine",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.1",
|
|
4
4
|
"description": "Retrivora AI is a plug-and-play AI engine for RAG chat experiences — generic vector DB + LLM provider, embeddable or standalone.",
|
|
5
5
|
"author": "Abhinav Alkuchi",
|
|
6
6
|
"license": "MIT",
|
|
@@ -311,16 +311,7 @@ export function MessageBubble({
|
|
|
311
311
|
|
|
312
312
|
// ── Products + cleaned content from structured JSON blocks in the message ──
|
|
313
313
|
const { productsFromContent, cleanContent } = React.useMemo(() => {
|
|
314
|
-
if (isUser)
|
|
315
|
-
|
|
316
|
-
// If the message contains a chart or refers to visualization, suppress the product carousel
|
|
317
|
-
const isVisualization =
|
|
318
|
-
message.content.includes('```chart') ||
|
|
319
|
-
message.content.toLowerCase().includes('pie chart') ||
|
|
320
|
-
message.content.toLowerCase().includes('bar chart') ||
|
|
321
|
-
message.content.toLowerCase().includes('distribution');
|
|
322
|
-
|
|
323
|
-
if (isVisualization) {
|
|
314
|
+
if (isUser) {
|
|
324
315
|
return { productsFromContent: [] as Product[], cleanContent: message.content };
|
|
325
316
|
}
|
|
326
317
|
|
package/src/core/Pipeline.ts
CHANGED
|
@@ -103,18 +103,14 @@ export class Pipeline {
|
|
|
103
103
|
// We use a unique marker to ensure this is only injected once but is ALWAYS present.
|
|
104
104
|
const CHART_MARKER = '<!-- VIZ_PROTOCOL_V1 -->';
|
|
105
105
|
const chartInstruction = `\n\n${CHART_MARKER}
|
|
106
|
-
###
|
|
107
|
-
You
|
|
108
|
-
1.
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
{
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
"dataKeys": ["key_for_values"],
|
|
115
|
-
"data": [ { "key_for_labels": "Category A", "key_for_values": 100 }, ... ]
|
|
116
|
-
}
|
|
117
|
-
4. RULES: Valid JSON only. No math. No text-based charts. No markdown tables for graphs. If showing a chart, DO NOT output a "products" JSON carousel.`;
|
|
106
|
+
### DATA REPRESENTATION TOOLBOX:
|
|
107
|
+
You have two specialized formats for structured data. Choose the one (or both) that provides the most value to the user:
|
|
108
|
+
1. \`\`\`chart\`\`\` block: Best for statistics, distributions, and comparisons.
|
|
109
|
+
Format: { "type": "bar" | "line" | "pie", "data": [ { "label": "X", "value": 10 } ] }
|
|
110
|
+
2. \`\`\`json\`\`\` (products) block: Best for listing or browsing specific items.
|
|
111
|
+
Format: { "type": "products", "data": [...] }
|
|
112
|
+
|
|
113
|
+
RULES: Output MUST be valid JSON. Data objects MUST be FLAT. Never draw charts with text or markdown tables.`;
|
|
118
114
|
|
|
119
115
|
if (!this.config.llm.systemPrompt?.includes(CHART_MARKER)) {
|
|
120
116
|
this.config.llm.systemPrompt = (this.config.llm.systemPrompt || '') + chartInstruction;
|