@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.
- package/dist/{chunk-C4KDS26Q.mjs → chunk-YCL23GST.mjs} +12 -19
- package/dist/handlers/index.js +12 -19
- package/dist/handlers/index.mjs +1 -1
- package/dist/server.js +12 -19
- package/dist/server.mjs +1 -1
- package/package.json +1 -1
- package/src/core/Pipeline.ts +13 -20
|
@@ -2261,25 +2261,18 @@ var Pipeline = class {
|
|
|
2261
2261
|
if (this.initialised) return;
|
|
2262
2262
|
const chartInstruction = `
|
|
2263
2263
|
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
|
|
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}...`);
|
package/dist/handlers/index.js
CHANGED
|
@@ -3824,25 +3824,18 @@ var Pipeline = class {
|
|
|
3824
3824
|
if (this.initialised) return;
|
|
3825
3825
|
const chartInstruction = `
|
|
3826
3826
|
|
|
3827
|
-
|
|
3828
|
-
|
|
3829
|
-
|
|
3830
|
-
|
|
3831
|
-
|
|
3832
|
-
|
|
3833
|
-
|
|
3834
|
-
|
|
3835
|
-
|
|
3836
|
-
|
|
3837
|
-
|
|
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}...`);
|
package/dist/handlers/index.mjs
CHANGED
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
|
-
|
|
3919
|
-
|
|
3920
|
-
|
|
3921
|
-
|
|
3922
|
-
|
|
3923
|
-
|
|
3924
|
-
|
|
3925
|
-
|
|
3926
|
-
|
|
3927
|
-
|
|
3928
|
-
|
|
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
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@retrivora-ai/rag-engine",
|
|
3
|
-
"version": "1.4.
|
|
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",
|
package/src/core/Pipeline.ts
CHANGED
|
@@ -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
|
|
103
|
-
const chartInstruction = `\n\
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
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('
|
|
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
|
|