@retrivora-ai/rag-engine 1.4.6 → 1.4.7

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.
@@ -2261,25 +2261,18 @@ var Pipeline = class {
2261
2261
  if (this.initialised) return;
2262
2262
  const chartInstruction = `
2263
2263
 
2264
- When presenting structured data, statistics, or comparisons, decide if it is best presented as a table or a chart.
2265
- - For tables: use standard Markdown tables.
2266
- - For charts (bar, line, pie): You MUST output a fenced code block with the language 'chart'.
2267
- - CRITICAL RULES:
2268
- 1. Use ONLY valid JSON (double quotes, no trailing commas).
2269
- 2. NO math expressions (e.g., use 100, NOT 50+50).
2270
- 3. dataKeys MUST exactly match the property names in the data objects.
2271
- 4. data objects MUST be FLAT (no nested objects or arrays).
2272
- 5. DO NOT output naked JSON or markdown tables for visualizations.
2273
- 6. ALWAYS wrap your visualization data in a \`\`\`chart ... \`\`\` code block.
2274
- \`\`\`chart
2275
- {
2276
- "type": "bar" | "line" | "pie",
2277
- "xAxisKey": "name",
2278
- "dataKeys": ["value"],
2279
- "data": [{"name": "A", "value": 10}]
2280
- }
2281
- \`\`\``;
2282
- if (!this.config.llm.systemPrompt || !this.config.llm.systemPrompt.includes("```chart")) {
2264
+ ### VISUALIZATION PROTOCOL:
2265
+ When requested to show data visually (charts, graphs, or comparisons), you MUST use this format:
2266
+ 1. Wrap the data in a fenced code block with the language 'chart'.
2267
+ 2. Use ONLY valid JSON matching this schema:
2268
+ {
2269
+ "type": "bar" | "line" | "pie",
2270
+ "xAxisKey": "property_for_label",
2271
+ "dataKeys": ["property_for_value"],
2272
+ "data": [{ "property_for_label": "A", "property_for_value": 10 }]
2273
+ }
2274
+ 3. RULES: Data objects MUST be FLAT (no nesting). No math expressions in JSON. NEVER draw charts with text or markdown tables.`;
2275
+ if (!this.config.llm.systemPrompt || !this.config.llm.systemPrompt.includes("chart")) {
2283
2276
  this.config.llm.systemPrompt = (this.config.llm.systemPrompt || "") + chartInstruction;
2284
2277
  }
2285
2278
  console.log(`[Pipeline] Initializing with provider: ${this.config.vectorDb.provider}...`);
@@ -3824,25 +3824,18 @@ var Pipeline = class {
3824
3824
  if (this.initialised) return;
3825
3825
  const chartInstruction = `
3826
3826
 
3827
- When presenting structured data, statistics, or comparisons, decide if it is best presented as a table or a chart.
3828
- - For tables: use standard Markdown tables.
3829
- - For charts (bar, line, pie): You MUST output a fenced code block with the language 'chart'.
3830
- - CRITICAL RULES:
3831
- 1. Use ONLY valid JSON (double quotes, no trailing commas).
3832
- 2. NO math expressions (e.g., use 100, NOT 50+50).
3833
- 3. dataKeys MUST exactly match the property names in the data objects.
3834
- 4. data objects MUST be FLAT (no nested objects or arrays).
3835
- 5. DO NOT output naked JSON or markdown tables for visualizations.
3836
- 6. ALWAYS wrap your visualization data in a \`\`\`chart ... \`\`\` code block.
3837
- \`\`\`chart
3838
- {
3839
- "type": "bar" | "line" | "pie",
3840
- "xAxisKey": "name",
3841
- "dataKeys": ["value"],
3842
- "data": [{"name": "A", "value": 10}]
3843
- }
3844
- \`\`\``;
3845
- if (!this.config.llm.systemPrompt || !this.config.llm.systemPrompt.includes("```chart")) {
3827
+ ### VISUALIZATION PROTOCOL:
3828
+ When requested to show data visually (charts, graphs, or comparisons), you MUST use this format:
3829
+ 1. Wrap the data in a fenced code block with the language 'chart'.
3830
+ 2. Use ONLY valid JSON matching this schema:
3831
+ {
3832
+ "type": "bar" | "line" | "pie",
3833
+ "xAxisKey": "property_for_label",
3834
+ "dataKeys": ["property_for_value"],
3835
+ "data": [{ "property_for_label": "A", "property_for_value": 10 }]
3836
+ }
3837
+ 3. RULES: Data objects MUST be FLAT (no nesting). No math expressions in JSON. NEVER draw charts with text or markdown tables.`;
3838
+ if (!this.config.llm.systemPrompt || !this.config.llm.systemPrompt.includes("chart")) {
3846
3839
  this.config.llm.systemPrompt = (this.config.llm.systemPrompt || "") + chartInstruction;
3847
3840
  }
3848
3841
  console.log(`[Pipeline] Initializing with provider: ${this.config.vectorDb.provider}...`);
@@ -9,7 +9,7 @@ import {
9
9
  sseFrame,
10
10
  sseMetaFrame,
11
11
  sseTextFrame
12
- } from "../chunk-C4KDS26Q.mjs";
12
+ } from "../chunk-YCL23GST.mjs";
13
13
  import "../chunk-YLTMFW4M.mjs";
14
14
  import "../chunk-X4TOT24V.mjs";
15
15
  export {
package/dist/server.js CHANGED
@@ -3915,25 +3915,18 @@ var Pipeline = class {
3915
3915
  if (this.initialised) return;
3916
3916
  const chartInstruction = `
3917
3917
 
3918
- When presenting structured data, statistics, or comparisons, decide if it is best presented as a table or a chart.
3919
- - For tables: use standard Markdown tables.
3920
- - For charts (bar, line, pie): You MUST output a fenced code block with the language 'chart'.
3921
- - CRITICAL RULES:
3922
- 1. Use ONLY valid JSON (double quotes, no trailing commas).
3923
- 2. NO math expressions (e.g., use 100, NOT 50+50).
3924
- 3. dataKeys MUST exactly match the property names in the data objects.
3925
- 4. data objects MUST be FLAT (no nested objects or arrays).
3926
- 5. DO NOT output naked JSON or markdown tables for visualizations.
3927
- 6. ALWAYS wrap your visualization data in a \`\`\`chart ... \`\`\` code block.
3928
- \`\`\`chart
3929
- {
3930
- "type": "bar" | "line" | "pie",
3931
- "xAxisKey": "name",
3932
- "dataKeys": ["value"],
3933
- "data": [{"name": "A", "value": 10}]
3934
- }
3935
- \`\`\``;
3936
- if (!this.config.llm.systemPrompt || !this.config.llm.systemPrompt.includes("```chart")) {
3918
+ ### VISUALIZATION PROTOCOL:
3919
+ When requested to show data visually (charts, graphs, or comparisons), you MUST use this format:
3920
+ 1. Wrap the data in a fenced code block with the language 'chart'.
3921
+ 2. Use ONLY valid JSON matching this schema:
3922
+ {
3923
+ "type": "bar" | "line" | "pie",
3924
+ "xAxisKey": "property_for_label",
3925
+ "dataKeys": ["property_for_value"],
3926
+ "data": [{ "property_for_label": "A", "property_for_value": 10 }]
3927
+ }
3928
+ 3. RULES: Data objects MUST be FLAT (no nesting). No math expressions in JSON. NEVER draw charts with text or markdown tables.`;
3929
+ if (!this.config.llm.systemPrompt || !this.config.llm.systemPrompt.includes("chart")) {
3937
3930
  this.config.llm.systemPrompt = (this.config.llm.systemPrompt || "") + chartInstruction;
3938
3931
  }
3939
3932
  console.log(`[Pipeline] Initializing with provider: ${this.config.vectorDb.provider}...`);
package/dist/server.mjs CHANGED
@@ -39,7 +39,7 @@ import {
39
39
  sseFrame,
40
40
  sseMetaFrame,
41
41
  sseTextFrame
42
- } from "./chunk-C4KDS26Q.mjs";
42
+ } from "./chunk-YCL23GST.mjs";
43
43
  import "./chunk-YLTMFW4M.mjs";
44
44
  import {
45
45
  PineconeProvider
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@retrivora-ai/rag-engine",
3
- "version": "1.4.6",
3
+ "version": "1.4.7",
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",
@@ -99,28 +99,21 @@ export class Pipeline {
99
99
  async initialize(): Promise<void> {
100
100
  if (this.initialised) return;
101
101
 
102
- // Augment system prompt with Chart/Table instructions if not already present
103
- const chartInstruction = `\n\nWhen presenting structured data, statistics, or comparisons, decide if it is best presented as a table or a chart.
104
- - For tables: use standard Markdown tables.
105
- - For charts (bar, line, pie): You MUST output a fenced code block with the language 'chart'.
106
- - CRITICAL RULES:
107
- 1. Use ONLY valid JSON (double quotes, no trailing commas).
108
- 2. NO math expressions (e.g., use 100, NOT 50+50).
109
- 3. dataKeys MUST exactly match the property names in the data objects.
110
- 4. data objects MUST be FLAT (no nested objects or arrays).
111
- 5. DO NOT output naked JSON or markdown tables for visualizations.
112
- 6. ALWAYS wrap your visualization data in a \`\`\`chart ... \`\`\` code block.
113
- \`\`\`chart
114
- {
115
- "type": "bar" | "line" | "pie",
116
- "xAxisKey": "name",
117
- "dataKeys": ["value"],
118
- "data": [{"name": "A", "value": 10}]
119
- }
120
- \`\`\``;
102
+ // Augment system prompt with a Universal Visualization Protocol
103
+ const chartInstruction = `\n\n### VISUALIZATION PROTOCOL:
104
+ When requested to show data visually (charts, graphs, or comparisons), you MUST use this format:
105
+ 1. Wrap the data in a fenced code block with the language 'chart'.
106
+ 2. Use ONLY valid JSON matching this schema:
107
+ {
108
+ "type": "bar" | "line" | "pie",
109
+ "xAxisKey": "property_for_label",
110
+ "dataKeys": ["property_for_value"],
111
+ "data": [{ "property_for_label": "A", "property_for_value": 10 }]
112
+ }
113
+ 3. RULES: Data objects MUST be FLAT (no nesting). No math expressions in JSON. NEVER draw charts with text or markdown tables.`;
121
114
 
122
115
  // Inject chart instructions if not already present (including when systemPrompt is undefined)
123
- if (!this.config.llm.systemPrompt || !this.config.llm.systemPrompt.includes('```chart')) {
116
+ if (!this.config.llm.systemPrompt || !this.config.llm.systemPrompt.includes('chart')) {
124
117
  this.config.llm.systemPrompt = (this.config.llm.systemPrompt || '') + chartInstruction;
125
118
  }
126
119