@retrivora-ai/rag-engine 1.4.4 → 1.4.6
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-FQ7OYZLF.mjs → chunk-C4KDS26Q.mjs} +9 -6
- package/dist/handlers/index.js +9 -6
- package/dist/handlers/index.mjs +1 -1
- package/dist/server.js +9 -6
- package/dist/server.mjs +1 -1
- package/package.json +1 -1
- package/src/config/serverConfig.ts +1 -1
- package/src/core/LangChainAgent.ts +3 -1
- package/src/core/Pipeline.ts +4 -2
|
@@ -153,7 +153,7 @@ function getEnvConfig(env = process.env, base) {
|
|
|
153
153
|
apiKey: (_$ = llmApiKeyByProvider[llmProvider]) != null ? _$ : "",
|
|
154
154
|
baseUrl: readString(env, "LLM_BASE_URL"),
|
|
155
155
|
systemPrompt: readString(env, "LLM_SYSTEM_PROMPT"),
|
|
156
|
-
maxTokens: readNumber(env, "LLM_MAX_TOKENS",
|
|
156
|
+
maxTokens: readNumber(env, "LLM_MAX_TOKENS", 4096),
|
|
157
157
|
temperature: readNumber(env, "LLM_TEMPERATURE", 0.7),
|
|
158
158
|
options: {
|
|
159
159
|
profile: readString(env, "LLM_UNIVERSAL_PROFILE")
|
|
@@ -1704,11 +1704,13 @@ When presenting structured data, statistics, or comparisons, decide if it is bes
|
|
|
1704
1704
|
2. NO math expressions (e.g., use 100, NOT 50+50).
|
|
1705
1705
|
3. dataKeys MUST exactly match the property names in the data objects.
|
|
1706
1706
|
4. data objects MUST be FLAT (no nested objects or arrays).
|
|
1707
|
-
5. DO NOT output naked JSON
|
|
1707
|
+
5. DO NOT output naked JSON or markdown tables for visualizations.
|
|
1708
|
+
6. ALWAYS wrap your visualization data in a \`\`\`chart ... \`\`\` code block.
|
|
1708
1709
|
\`\`\`chart
|
|
1709
1710
|
{
|
|
1710
1711
|
"type": "bar" | "line" | "pie",
|
|
1711
1712
|
"xAxisKey": "name",
|
|
1713
|
+
"name": "Distribution Chart",
|
|
1712
1714
|
"dataKeys": ["value"],
|
|
1713
1715
|
"data": [{"name": "A", "value": 10}]
|
|
1714
1716
|
}
|
|
@@ -2255,7 +2257,7 @@ var Pipeline = class {
|
|
|
2255
2257
|
this.reranker = new Reranker();
|
|
2256
2258
|
}
|
|
2257
2259
|
async initialize() {
|
|
2258
|
-
var _a
|
|
2260
|
+
var _a;
|
|
2259
2261
|
if (this.initialised) return;
|
|
2260
2262
|
const chartInstruction = `
|
|
2261
2263
|
|
|
@@ -2267,7 +2269,8 @@ When presenting structured data, statistics, or comparisons, decide if it is bes
|
|
|
2267
2269
|
2. NO math expressions (e.g., use 100, NOT 50+50).
|
|
2268
2270
|
3. dataKeys MUST exactly match the property names in the data objects.
|
|
2269
2271
|
4. data objects MUST be FLAT (no nested objects or arrays).
|
|
2270
|
-
5. DO NOT output naked JSON
|
|
2272
|
+
5. DO NOT output naked JSON or markdown tables for visualizations.
|
|
2273
|
+
6. ALWAYS wrap your visualization data in a \`\`\`chart ... \`\`\` code block.
|
|
2271
2274
|
\`\`\`chart
|
|
2272
2275
|
{
|
|
2273
2276
|
"type": "bar" | "line" | "pie",
|
|
@@ -2276,7 +2279,7 @@ When presenting structured data, statistics, or comparisons, decide if it is bes
|
|
|
2276
2279
|
"data": [{"name": "A", "value": 10}]
|
|
2277
2280
|
}
|
|
2278
2281
|
\`\`\``;
|
|
2279
|
-
if (!
|
|
2282
|
+
if (!this.config.llm.systemPrompt || !this.config.llm.systemPrompt.includes("```chart")) {
|
|
2280
2283
|
this.config.llm.systemPrompt = (this.config.llm.systemPrompt || "") + chartInstruction;
|
|
2281
2284
|
}
|
|
2282
2285
|
console.log(`[Pipeline] Initializing with provider: ${this.config.vectorDb.provider}...`);
|
|
@@ -2293,7 +2296,7 @@ When presenting structured data, statistics, or comparisons, decide if it is bes
|
|
|
2293
2296
|
this.entityExtractor = new EntityExtractor(this.llmProvider);
|
|
2294
2297
|
}
|
|
2295
2298
|
await this.vectorDB.initialize();
|
|
2296
|
-
if (((
|
|
2299
|
+
if (((_a = this.config.rag) == null ? void 0 : _a.architecture) === "agentic") {
|
|
2297
2300
|
this.agent = new LangChainAgent(this, this.config);
|
|
2298
2301
|
await this.agent.initialize(this.llmProvider);
|
|
2299
2302
|
}
|
package/dist/handlers/index.js
CHANGED
|
@@ -1760,7 +1760,7 @@ function getEnvConfig(env = process.env, base) {
|
|
|
1760
1760
|
apiKey: (_$ = llmApiKeyByProvider[llmProvider]) != null ? _$ : "",
|
|
1761
1761
|
baseUrl: readString(env, "LLM_BASE_URL"),
|
|
1762
1762
|
systemPrompt: readString(env, "LLM_SYSTEM_PROMPT"),
|
|
1763
|
-
maxTokens: readNumber(env, "LLM_MAX_TOKENS",
|
|
1763
|
+
maxTokens: readNumber(env, "LLM_MAX_TOKENS", 4096),
|
|
1764
1764
|
temperature: readNumber(env, "LLM_TEMPERATURE", 0.7),
|
|
1765
1765
|
options: {
|
|
1766
1766
|
profile: readString(env, "LLM_UNIVERSAL_PROFILE")
|
|
@@ -3273,11 +3273,13 @@ When presenting structured data, statistics, or comparisons, decide if it is bes
|
|
|
3273
3273
|
2. NO math expressions (e.g., use 100, NOT 50+50).
|
|
3274
3274
|
3. dataKeys MUST exactly match the property names in the data objects.
|
|
3275
3275
|
4. data objects MUST be FLAT (no nested objects or arrays).
|
|
3276
|
-
5. DO NOT output naked JSON
|
|
3276
|
+
5. DO NOT output naked JSON or markdown tables for visualizations.
|
|
3277
|
+
6. ALWAYS wrap your visualization data in a \`\`\`chart ... \`\`\` code block.
|
|
3277
3278
|
\`\`\`chart
|
|
3278
3279
|
{
|
|
3279
3280
|
"type": "bar" | "line" | "pie",
|
|
3280
3281
|
"xAxisKey": "name",
|
|
3282
|
+
"name": "Distribution Chart",
|
|
3281
3283
|
"dataKeys": ["value"],
|
|
3282
3284
|
"data": [{"name": "A", "value": 10}]
|
|
3283
3285
|
}
|
|
@@ -3818,7 +3820,7 @@ var Pipeline = class {
|
|
|
3818
3820
|
this.reranker = new Reranker();
|
|
3819
3821
|
}
|
|
3820
3822
|
async initialize() {
|
|
3821
|
-
var _a
|
|
3823
|
+
var _a;
|
|
3822
3824
|
if (this.initialised) return;
|
|
3823
3825
|
const chartInstruction = `
|
|
3824
3826
|
|
|
@@ -3830,7 +3832,8 @@ When presenting structured data, statistics, or comparisons, decide if it is bes
|
|
|
3830
3832
|
2. NO math expressions (e.g., use 100, NOT 50+50).
|
|
3831
3833
|
3. dataKeys MUST exactly match the property names in the data objects.
|
|
3832
3834
|
4. data objects MUST be FLAT (no nested objects or arrays).
|
|
3833
|
-
5. DO NOT output naked JSON
|
|
3835
|
+
5. DO NOT output naked JSON or markdown tables for visualizations.
|
|
3836
|
+
6. ALWAYS wrap your visualization data in a \`\`\`chart ... \`\`\` code block.
|
|
3834
3837
|
\`\`\`chart
|
|
3835
3838
|
{
|
|
3836
3839
|
"type": "bar" | "line" | "pie",
|
|
@@ -3839,7 +3842,7 @@ When presenting structured data, statistics, or comparisons, decide if it is bes
|
|
|
3839
3842
|
"data": [{"name": "A", "value": 10}]
|
|
3840
3843
|
}
|
|
3841
3844
|
\`\`\``;
|
|
3842
|
-
if (!
|
|
3845
|
+
if (!this.config.llm.systemPrompt || !this.config.llm.systemPrompt.includes("```chart")) {
|
|
3843
3846
|
this.config.llm.systemPrompt = (this.config.llm.systemPrompt || "") + chartInstruction;
|
|
3844
3847
|
}
|
|
3845
3848
|
console.log(`[Pipeline] Initializing with provider: ${this.config.vectorDb.provider}...`);
|
|
@@ -3856,7 +3859,7 @@ When presenting structured data, statistics, or comparisons, decide if it is bes
|
|
|
3856
3859
|
this.entityExtractor = new EntityExtractor(this.llmProvider);
|
|
3857
3860
|
}
|
|
3858
3861
|
await this.vectorDB.initialize();
|
|
3859
|
-
if (((
|
|
3862
|
+
if (((_a = this.config.rag) == null ? void 0 : _a.architecture) === "agentic") {
|
|
3860
3863
|
this.agent = new LangChainAgent(this, this.config);
|
|
3861
3864
|
await this.agent.initialize(this.llmProvider);
|
|
3862
3865
|
}
|
package/dist/handlers/index.mjs
CHANGED
package/dist/server.js
CHANGED
|
@@ -1806,7 +1806,7 @@ function getEnvConfig(env = process.env, base) {
|
|
|
1806
1806
|
apiKey: (_$ = llmApiKeyByProvider[llmProvider]) != null ? _$ : "",
|
|
1807
1807
|
baseUrl: readString(env, "LLM_BASE_URL"),
|
|
1808
1808
|
systemPrompt: readString(env, "LLM_SYSTEM_PROMPT"),
|
|
1809
|
-
maxTokens: readNumber(env, "LLM_MAX_TOKENS",
|
|
1809
|
+
maxTokens: readNumber(env, "LLM_MAX_TOKENS", 4096),
|
|
1810
1810
|
temperature: readNumber(env, "LLM_TEMPERATURE", 0.7),
|
|
1811
1811
|
options: {
|
|
1812
1812
|
profile: readString(env, "LLM_UNIVERSAL_PROFILE")
|
|
@@ -3358,11 +3358,13 @@ When presenting structured data, statistics, or comparisons, decide if it is bes
|
|
|
3358
3358
|
2. NO math expressions (e.g., use 100, NOT 50+50).
|
|
3359
3359
|
3. dataKeys MUST exactly match the property names in the data objects.
|
|
3360
3360
|
4. data objects MUST be FLAT (no nested objects or arrays).
|
|
3361
|
-
5. DO NOT output naked JSON
|
|
3361
|
+
5. DO NOT output naked JSON or markdown tables for visualizations.
|
|
3362
|
+
6. ALWAYS wrap your visualization data in a \`\`\`chart ... \`\`\` code block.
|
|
3362
3363
|
\`\`\`chart
|
|
3363
3364
|
{
|
|
3364
3365
|
"type": "bar" | "line" | "pie",
|
|
3365
3366
|
"xAxisKey": "name",
|
|
3367
|
+
"name": "Distribution Chart",
|
|
3366
3368
|
"dataKeys": ["value"],
|
|
3367
3369
|
"data": [{"name": "A", "value": 10}]
|
|
3368
3370
|
}
|
|
@@ -3909,7 +3911,7 @@ var Pipeline = class {
|
|
|
3909
3911
|
this.reranker = new Reranker();
|
|
3910
3912
|
}
|
|
3911
3913
|
async initialize() {
|
|
3912
|
-
var _a
|
|
3914
|
+
var _a;
|
|
3913
3915
|
if (this.initialised) return;
|
|
3914
3916
|
const chartInstruction = `
|
|
3915
3917
|
|
|
@@ -3921,7 +3923,8 @@ When presenting structured data, statistics, or comparisons, decide if it is bes
|
|
|
3921
3923
|
2. NO math expressions (e.g., use 100, NOT 50+50).
|
|
3922
3924
|
3. dataKeys MUST exactly match the property names in the data objects.
|
|
3923
3925
|
4. data objects MUST be FLAT (no nested objects or arrays).
|
|
3924
|
-
5. DO NOT output naked JSON
|
|
3926
|
+
5. DO NOT output naked JSON or markdown tables for visualizations.
|
|
3927
|
+
6. ALWAYS wrap your visualization data in a \`\`\`chart ... \`\`\` code block.
|
|
3925
3928
|
\`\`\`chart
|
|
3926
3929
|
{
|
|
3927
3930
|
"type": "bar" | "line" | "pie",
|
|
@@ -3930,7 +3933,7 @@ When presenting structured data, statistics, or comparisons, decide if it is bes
|
|
|
3930
3933
|
"data": [{"name": "A", "value": 10}]
|
|
3931
3934
|
}
|
|
3932
3935
|
\`\`\``;
|
|
3933
|
-
if (!
|
|
3936
|
+
if (!this.config.llm.systemPrompt || !this.config.llm.systemPrompt.includes("```chart")) {
|
|
3934
3937
|
this.config.llm.systemPrompt = (this.config.llm.systemPrompt || "") + chartInstruction;
|
|
3935
3938
|
}
|
|
3936
3939
|
console.log(`[Pipeline] Initializing with provider: ${this.config.vectorDb.provider}...`);
|
|
@@ -3947,7 +3950,7 @@ When presenting structured data, statistics, or comparisons, decide if it is bes
|
|
|
3947
3950
|
this.entityExtractor = new EntityExtractor(this.llmProvider);
|
|
3948
3951
|
}
|
|
3949
3952
|
await this.vectorDB.initialize();
|
|
3950
|
-
if (((
|
|
3953
|
+
if (((_a = this.config.rag) == null ? void 0 : _a.architecture) === "agentic") {
|
|
3951
3954
|
this.agent = new LangChainAgent(this, this.config);
|
|
3952
3955
|
await this.agent.initialize(this.llmProvider);
|
|
3953
3956
|
}
|
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.6",
|
|
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",
|
|
@@ -146,7 +146,7 @@ export function getEnvConfig(env: Record<string, string | undefined> = process.e
|
|
|
146
146
|
apiKey: llmApiKeyByProvider[llmProvider] ?? '',
|
|
147
147
|
baseUrl: readString(env, 'LLM_BASE_URL'),
|
|
148
148
|
systemPrompt: readString(env, 'LLM_SYSTEM_PROMPT'),
|
|
149
|
-
maxTokens: readNumber(env, 'LLM_MAX_TOKENS',
|
|
149
|
+
maxTokens: readNumber(env, 'LLM_MAX_TOKENS', 4096),
|
|
150
150
|
temperature: readNumber(env, 'LLM_TEMPERATURE', 0.7),
|
|
151
151
|
options: {
|
|
152
152
|
profile: readString(env, 'LLM_UNIVERSAL_PROFILE'),
|
|
@@ -58,11 +58,13 @@ export class LangChainAgent {
|
|
|
58
58
|
2. NO math expressions (e.g., use 100, NOT 50+50).
|
|
59
59
|
3. dataKeys MUST exactly match the property names in the data objects.
|
|
60
60
|
4. data objects MUST be FLAT (no nested objects or arrays).
|
|
61
|
-
5. DO NOT output naked JSON
|
|
61
|
+
5. DO NOT output naked JSON or markdown tables for visualizations.
|
|
62
|
+
6. ALWAYS wrap your visualization data in a \`\`\`chart ... \`\`\` code block.
|
|
62
63
|
\`\`\`chart
|
|
63
64
|
{
|
|
64
65
|
"type": "bar" | "line" | "pie",
|
|
65
66
|
"xAxisKey": "name",
|
|
67
|
+
"name": "Distribution Chart",
|
|
66
68
|
"dataKeys": ["value"],
|
|
67
69
|
"data": [{"name": "A", "value": 10}]
|
|
68
70
|
}
|
package/src/core/Pipeline.ts
CHANGED
|
@@ -108,7 +108,8 @@ export class Pipeline {
|
|
|
108
108
|
2. NO math expressions (e.g., use 100, NOT 50+50).
|
|
109
109
|
3. dataKeys MUST exactly match the property names in the data objects.
|
|
110
110
|
4. data objects MUST be FLAT (no nested objects or arrays).
|
|
111
|
-
5. DO NOT output naked JSON
|
|
111
|
+
5. DO NOT output naked JSON or markdown tables for visualizations.
|
|
112
|
+
6. ALWAYS wrap your visualization data in a \`\`\`chart ... \`\`\` code block.
|
|
112
113
|
\`\`\`chart
|
|
113
114
|
{
|
|
114
115
|
"type": "bar" | "line" | "pie",
|
|
@@ -118,7 +119,8 @@ export class Pipeline {
|
|
|
118
119
|
}
|
|
119
120
|
\`\`\``;
|
|
120
121
|
|
|
121
|
-
if (
|
|
122
|
+
// Inject chart instructions if not already present (including when systemPrompt is undefined)
|
|
123
|
+
if (!this.config.llm.systemPrompt || !this.config.llm.systemPrompt.includes('```chart')) {
|
|
122
124
|
this.config.llm.systemPrompt = (this.config.llm.systemPrompt || '') + chartInstruction;
|
|
123
125
|
}
|
|
124
126
|
|