@retrivora-ai/rag-engine 2.2.3 → 2.2.5
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/handlers/index.d.mts +1 -1
- package/dist/handlers/index.d.ts +1 -1
- package/dist/handlers/index.js +151 -849
- package/dist/handlers/index.mjs +151 -849
- package/dist/{index-C6ehmP0b.d.ts → index-B5TTZWkx.d.ts} +6 -6
- package/dist/{index-DFc_Ll9z.d.mts → index-DvbtNz7m.d.mts} +6 -6
- package/dist/index.js +3 -14
- package/dist/index.mjs +3 -14
- package/dist/server.d.mts +3 -4
- package/dist/server.d.ts +3 -4
- package/dist/server.js +151 -849
- package/dist/server.mjs +151 -849
- package/package.json +3 -1
- package/src/config/UniversalProfiles.ts +1 -2
- package/src/config/serverConfig.ts +5 -3
- package/src/core/ConfigFetcher.ts +1 -1
- package/src/core/Pipeline.ts +26 -29
- package/src/core/VectorPlugin.ts +2 -2
- package/src/handlers/index.ts +14 -17
- package/src/llm/providers/UniversalLLMAdapter.ts +53 -104
- package/src/utils/SchemaMapper.ts +107 -62
- package/src/utils/UITransformer.ts +22 -22
|
@@ -145,15 +145,15 @@ declare function sseErrorFrame(message: string): string;
|
|
|
145
145
|
/**
|
|
146
146
|
* createChatHandler — factory that returns a Next.js App Router POST handler.
|
|
147
147
|
*/
|
|
148
|
-
declare function createChatHandler(configOrPlugin?: Partial<RagConfig> | VectorPlugin, options?: HandlerOptions): (req:
|
|
148
|
+
declare function createChatHandler(configOrPlugin?: Partial<RagConfig> | VectorPlugin, options?: HandlerOptions): (req: any, context?: any) => Promise<any>;
|
|
149
149
|
/**
|
|
150
150
|
* createStreamHandler — factory for a streaming SSE Next.js App Router POST handler.
|
|
151
151
|
*/
|
|
152
|
-
declare function createStreamHandler(configOrPlugin?: Partial<RagConfig> | VectorPlugin, options?: HandlerOptions): (req:
|
|
152
|
+
declare function createStreamHandler(configOrPlugin?: Partial<RagConfig> | VectorPlugin, options?: HandlerOptions): (req: any, context?: any) => Promise<any>;
|
|
153
153
|
/**
|
|
154
154
|
* createIngestHandler — factory for the document ingestion endpoint.
|
|
155
155
|
*/
|
|
156
|
-
declare function createIngestHandler(configOrPlugin?: Partial<RagConfig> | VectorPlugin, options?: HandlerOptions): (req:
|
|
156
|
+
declare function createIngestHandler(configOrPlugin?: Partial<RagConfig> | VectorPlugin, options?: HandlerOptions): (req: any, context?: any) => Promise<any>;
|
|
157
157
|
/**
|
|
158
158
|
* createHealthHandler — factory for the health-check endpoint.
|
|
159
159
|
*/
|
|
@@ -161,7 +161,7 @@ declare function createHealthHandler(configOrPlugin?: Partial<RagConfig> | Vecto
|
|
|
161
161
|
/**
|
|
162
162
|
* createUploadHandler — factory for the file upload ingestion endpoint.
|
|
163
163
|
*/
|
|
164
|
-
declare function createUploadHandler(configOrPlugin?: Partial<RagConfig> | VectorPlugin, options?: HandlerOptions): (req:
|
|
164
|
+
declare function createUploadHandler(configOrPlugin?: Partial<RagConfig> | VectorPlugin, options?: HandlerOptions): (req: any, context?: any) => Promise<any>;
|
|
165
165
|
/**
|
|
166
166
|
* createSuggestionsHandler — factory for the auto-suggestions endpoint.
|
|
167
167
|
* Supports both POST (JSON body) and GET (URL search parameters).
|
|
@@ -184,8 +184,8 @@ declare function createSessionsHandler(configOrPlugin?: Partial<RagConfig> | Vec
|
|
|
184
184
|
* (e.g. `src/app/api/retrivora/[[...retrivora]]/route.ts`).
|
|
185
185
|
*/
|
|
186
186
|
declare function createRagHandler(configOrPlugin?: Partial<RagConfig> | VectorPlugin, options?: HandlerOptions): {
|
|
187
|
-
GET: (req:
|
|
188
|
-
POST: (req:
|
|
187
|
+
GET: (req: any, context?: any) => Promise<any>;
|
|
188
|
+
POST: (req: any, context?: any) => Promise<any>;
|
|
189
189
|
};
|
|
190
190
|
|
|
191
191
|
export { ConfigValidator as C, type HealthCheckResult as H, type IProviderValidator as I, type ValidationError as V, type IProviderHealthChecker as a, VectorPlugin as b, createChatHandler as c, createFeedbackHandler as d, createHealthHandler as e, createHistoryHandler as f, createIngestHandler as g, createRagHandler as h, createSessionsHandler as i, createStreamHandler as j, createUploadHandler as k, sseFrame as l, sseMetaFrame as m, sseTextFrame as n, type HandlerOptions as o, createSuggestionsHandler as p, sseObservabilityFrame as q, sseUIFrame as r, sseErrorFrame as s };
|
|
@@ -145,15 +145,15 @@ declare function sseErrorFrame(message: string): string;
|
|
|
145
145
|
/**
|
|
146
146
|
* createChatHandler — factory that returns a Next.js App Router POST handler.
|
|
147
147
|
*/
|
|
148
|
-
declare function createChatHandler(configOrPlugin?: Partial<RagConfig> | VectorPlugin, options?: HandlerOptions): (req:
|
|
148
|
+
declare function createChatHandler(configOrPlugin?: Partial<RagConfig> | VectorPlugin, options?: HandlerOptions): (req: any, context?: any) => Promise<any>;
|
|
149
149
|
/**
|
|
150
150
|
* createStreamHandler — factory for a streaming SSE Next.js App Router POST handler.
|
|
151
151
|
*/
|
|
152
|
-
declare function createStreamHandler(configOrPlugin?: Partial<RagConfig> | VectorPlugin, options?: HandlerOptions): (req:
|
|
152
|
+
declare function createStreamHandler(configOrPlugin?: Partial<RagConfig> | VectorPlugin, options?: HandlerOptions): (req: any, context?: any) => Promise<any>;
|
|
153
153
|
/**
|
|
154
154
|
* createIngestHandler — factory for the document ingestion endpoint.
|
|
155
155
|
*/
|
|
156
|
-
declare function createIngestHandler(configOrPlugin?: Partial<RagConfig> | VectorPlugin, options?: HandlerOptions): (req:
|
|
156
|
+
declare function createIngestHandler(configOrPlugin?: Partial<RagConfig> | VectorPlugin, options?: HandlerOptions): (req: any, context?: any) => Promise<any>;
|
|
157
157
|
/**
|
|
158
158
|
* createHealthHandler — factory for the health-check endpoint.
|
|
159
159
|
*/
|
|
@@ -161,7 +161,7 @@ declare function createHealthHandler(configOrPlugin?: Partial<RagConfig> | Vecto
|
|
|
161
161
|
/**
|
|
162
162
|
* createUploadHandler — factory for the file upload ingestion endpoint.
|
|
163
163
|
*/
|
|
164
|
-
declare function createUploadHandler(configOrPlugin?: Partial<RagConfig> | VectorPlugin, options?: HandlerOptions): (req:
|
|
164
|
+
declare function createUploadHandler(configOrPlugin?: Partial<RagConfig> | VectorPlugin, options?: HandlerOptions): (req: any, context?: any) => Promise<any>;
|
|
165
165
|
/**
|
|
166
166
|
* createSuggestionsHandler — factory for the auto-suggestions endpoint.
|
|
167
167
|
* Supports both POST (JSON body) and GET (URL search parameters).
|
|
@@ -184,8 +184,8 @@ declare function createSessionsHandler(configOrPlugin?: Partial<RagConfig> | Vec
|
|
|
184
184
|
* (e.g. `src/app/api/retrivora/[[...retrivora]]/route.ts`).
|
|
185
185
|
*/
|
|
186
186
|
declare function createRagHandler(configOrPlugin?: Partial<RagConfig> | VectorPlugin, options?: HandlerOptions): {
|
|
187
|
-
GET: (req:
|
|
188
|
-
POST: (req:
|
|
187
|
+
GET: (req: any, context?: any) => Promise<any>;
|
|
188
|
+
POST: (req: any, context?: any) => Promise<any>;
|
|
189
189
|
};
|
|
190
190
|
|
|
191
191
|
export { ConfigValidator as C, type HealthCheckResult as H, type IProviderValidator as I, type ValidationError as V, type IProviderHealthChecker as a, VectorPlugin as b, createChatHandler as c, createFeedbackHandler as d, createHealthHandler as e, createHistoryHandler as f, createIngestHandler as g, createRagHandler as h, createSessionsHandler as i, createStreamHandler as j, createUploadHandler as k, sseFrame as l, sseMetaFrame as m, sseTextFrame as n, type HandlerOptions as o, createSuggestionsHandler as p, sseObservabilityFrame as q, sseUIFrame as r, sseErrorFrame as s };
|
package/dist/index.js
CHANGED
|
@@ -3634,7 +3634,7 @@ function ChatWidget({ position = "bottom-right", onAddToCart, apiUrl, retrivoraA
|
|
|
3634
3634
|
// package.json
|
|
3635
3635
|
var package_default = {
|
|
3636
3636
|
name: "@retrivora-ai/rag-engine",
|
|
3637
|
-
version: "2.2.
|
|
3637
|
+
version: "2.2.5",
|
|
3638
3638
|
description: "Retrivora AI is a plug-and-play AI engine for RAG chat experiences \u2014 generic vector DB + LLM provider, embeddable or standalone.",
|
|
3639
3639
|
author: "Abhinav Alkuchi",
|
|
3640
3640
|
license: "UNLICENSED",
|
|
@@ -3671,6 +3671,8 @@ var package_default = {
|
|
|
3671
3671
|
import: "./dist/index.mjs"
|
|
3672
3672
|
},
|
|
3673
3673
|
"./style.css": "./dist/index.css",
|
|
3674
|
+
"./index.css": "./dist/index.css",
|
|
3675
|
+
"./styles.css": "./dist/index.css",
|
|
3674
3676
|
"./handlers": {
|
|
3675
3677
|
types: "./dist/handlers/index.d.ts",
|
|
3676
3678
|
require: "./dist/handlers/index.js",
|
|
@@ -4280,19 +4282,6 @@ var UITransformer = class _UITransformer {
|
|
|
4280
4282
|
if (!retrievedData || retrievedData.length === 0) {
|
|
4281
4283
|
return this.createTextResponse("No data available", "No relevant data found for your query.");
|
|
4282
4284
|
}
|
|
4283
|
-
console.log("[UITransformer.transform] Processing retrievedData:", {
|
|
4284
|
-
userQuery,
|
|
4285
|
-
retrievedCount: retrievedData.length,
|
|
4286
|
-
sample: retrievedData.slice(0, 2).map((item) => {
|
|
4287
|
-
var _a2;
|
|
4288
|
-
return {
|
|
4289
|
-
id: item == null ? void 0 : item.id,
|
|
4290
|
-
contentType: typeof (item == null ? void 0 : item.content),
|
|
4291
|
-
contentSnippet: String((_a2 = item == null ? void 0 : item.content) != null ? _a2 : "").substring(0, 150),
|
|
4292
|
-
metadataKeys: Object.keys((item == null ? void 0 : item.metadata) || {})
|
|
4293
|
-
};
|
|
4294
|
-
})
|
|
4295
|
-
});
|
|
4296
4285
|
const resolvedIntent = intent != null ? intent : this.detectIntentHeuristic(userQuery);
|
|
4297
4286
|
const filteredData = resolvedIntent.filterInStockOnly ? retrievedData.filter((item) => this.determineStockStatus(item)) : retrievedData;
|
|
4298
4287
|
const profile = this.profileData(filteredData);
|
package/dist/index.mjs
CHANGED
|
@@ -3635,7 +3635,7 @@ function ChatWidget({ position = "bottom-right", onAddToCart, apiUrl, retrivoraA
|
|
|
3635
3635
|
// package.json
|
|
3636
3636
|
var package_default = {
|
|
3637
3637
|
name: "@retrivora-ai/rag-engine",
|
|
3638
|
-
version: "2.2.
|
|
3638
|
+
version: "2.2.5",
|
|
3639
3639
|
description: "Retrivora AI is a plug-and-play AI engine for RAG chat experiences \u2014 generic vector DB + LLM provider, embeddable or standalone.",
|
|
3640
3640
|
author: "Abhinav Alkuchi",
|
|
3641
3641
|
license: "UNLICENSED",
|
|
@@ -3672,6 +3672,8 @@ var package_default = {
|
|
|
3672
3672
|
import: "./dist/index.mjs"
|
|
3673
3673
|
},
|
|
3674
3674
|
"./style.css": "./dist/index.css",
|
|
3675
|
+
"./index.css": "./dist/index.css",
|
|
3676
|
+
"./styles.css": "./dist/index.css",
|
|
3675
3677
|
"./handlers": {
|
|
3676
3678
|
types: "./dist/handlers/index.d.ts",
|
|
3677
3679
|
require: "./dist/handlers/index.js",
|
|
@@ -4281,19 +4283,6 @@ var UITransformer = class _UITransformer {
|
|
|
4281
4283
|
if (!retrievedData || retrievedData.length === 0) {
|
|
4282
4284
|
return this.createTextResponse("No data available", "No relevant data found for your query.");
|
|
4283
4285
|
}
|
|
4284
|
-
console.log("[UITransformer.transform] Processing retrievedData:", {
|
|
4285
|
-
userQuery,
|
|
4286
|
-
retrievedCount: retrievedData.length,
|
|
4287
|
-
sample: retrievedData.slice(0, 2).map((item) => {
|
|
4288
|
-
var _a2;
|
|
4289
|
-
return {
|
|
4290
|
-
id: item == null ? void 0 : item.id,
|
|
4291
|
-
contentType: typeof (item == null ? void 0 : item.content),
|
|
4292
|
-
contentSnippet: String((_a2 = item == null ? void 0 : item.content) != null ? _a2 : "").substring(0, 150),
|
|
4293
|
-
metadataKeys: Object.keys((item == null ? void 0 : item.metadata) || {})
|
|
4294
|
-
};
|
|
4295
|
-
})
|
|
4296
|
-
});
|
|
4297
4286
|
const resolvedIntent = intent != null ? intent : this.detectIntentHeuristic(userQuery);
|
|
4298
4287
|
const filteredData = resolvedIntent.filterInStockOnly ? retrievedData.filter((item) => this.determineStockStatus(item)) : retrievedData;
|
|
4299
4288
|
const profile = this.profileData(filteredData);
|
package/dist/server.d.mts
CHANGED
|
@@ -2,8 +2,8 @@ import { V as VectorDBConfig, L as LLMConfig, d as EmbeddingConfig, i as RagConf
|
|
|
2
2
|
export { B as BarChartData, u as CarouselProduct, c as ChatResponse, v as IRetriever, f as IngestDocument, h as LatencyBreakdown, w as LineChartDataPoint, M as MessageRole, x as MetricCardData, O as ObservabilityTrace, P as PieChartData, y as Product, j as RagMessage, k as RetrievalConfig, z as RetrievalResult, l as RetrievedChunk, A as RetrivoraChunkMetadata, D as RetrivoraIngestedDocument, S as ScatterPlotDataPoint, F as SuggestionsResponse, H as TableData, T as TokenUsage, J as UITransformationResponse, U as UseRagChatOptions, a as UseRagChatReturn, K as VisualizationType, W as WorkflowConfig } from './ILLMProvider-BWa68XX5.mjs';
|
|
3
3
|
import { I as IRenderRule, i as DecisionContext, k as IntentCategory, n as RenderDecision } from './index-BbJGyNmW.mjs';
|
|
4
4
|
export { x as ArchitectureCardProps, A as AuthenticationException, y as CarouselRendererStrategy, z as ChartRendererStrategy, e as ChartType, B as ChatViewportSize, C as ChatWidgetProps, a as ChatWindowProps, f as Chunk, g as ChunkOptions, c as ClientConfig, b as ConfigProviderProps, h as ConfigurationException, F as DocumentChunker, D as DocumentUploadProps, E as EmbeddingFailedException, j as IRendererStrategy, l as IntentClassifier, M as MessageBubbleProps, G as MixedRendererStrategy, H as Pipeline, J as PipelineStep, P as ProductCardProps, d as ProductCarouselProps, m as ProviderNotFoundException, K as ProviderPill, R as RateLimitException, L as RenderSectionDecision, o as RenderType, p as RendererRegistry, q as RetrievalException, r as Retrivora, s as RetrivoraError, t as RetrivoraErrorCode, u as RuleEngine, v as SDK_VERSION, N as Snippet, S as SourceCardProps, T as TableRendererStrategy, O as TextRendererStrategy, V as VisualizationDecisionEngine, w as decideVisualization, Q as wrapError } from './index-BbJGyNmW.mjs';
|
|
5
|
-
import { H as HealthCheckResult, I as IProviderValidator, a as IProviderHealthChecker } from './index-
|
|
6
|
-
export { C as ConfigValidator, V as ValidationError, b as VectorPlugin, c as createChatHandler, d as createFeedbackHandler, e as createHealthHandler, f as createHistoryHandler, g as createIngestHandler, h as createRagHandler, i as createSessionsHandler, j as createStreamHandler, k as createUploadHandler, s as sseErrorFrame, l as sseFrame, m as sseMetaFrame, n as sseTextFrame } from './index-
|
|
5
|
+
import { H as HealthCheckResult, I as IProviderValidator, a as IProviderHealthChecker } from './index-DvbtNz7m.mjs';
|
|
6
|
+
export { C as ConfigValidator, V as ValidationError, b as VectorPlugin, c as createChatHandler, d as createFeedbackHandler, e as createHealthHandler, f as createHistoryHandler, g as createIngestHandler, h as createRagHandler, i as createSessionsHandler, j as createStreamHandler, k as createUploadHandler, s as sseErrorFrame, l as sseFrame, m as sseMetaFrame, n as sseTextFrame } from './index-DvbtNz7m.mjs';
|
|
7
7
|
import 'react';
|
|
8
8
|
import 'next/server';
|
|
9
9
|
|
|
@@ -524,11 +524,11 @@ declare const LLM_PROFILES: {
|
|
|
524
524
|
chatPayloadTemplate: string;
|
|
525
525
|
};
|
|
526
526
|
litellm: {
|
|
527
|
-
chatPayloadTemplate: string;
|
|
528
527
|
chatPath: string;
|
|
529
528
|
embedPath: string;
|
|
530
529
|
responseExtractPath: string;
|
|
531
530
|
embedExtractPath: string;
|
|
531
|
+
chatPayloadTemplate: string;
|
|
532
532
|
};
|
|
533
533
|
'anthropic-claude': {
|
|
534
534
|
chatPath: string;
|
|
@@ -1020,7 +1020,6 @@ declare class UniversalLLMAdapter implements ILLMProvider {
|
|
|
1020
1020
|
/**
|
|
1021
1021
|
* Streaming chat using native fetch + ReadableStream.
|
|
1022
1022
|
* Parses OpenAI-compatible SSE frames: `data: {...}\n\n`
|
|
1023
|
-
* Works with vLLM, LMStudio, Together AI, Fireworks, and any OpenAI-compatible API.
|
|
1024
1023
|
*/
|
|
1025
1024
|
chatStream(messages: ChatMessage[], context?: string): AsyncIterable<string>;
|
|
1026
1025
|
embed(text: string): Promise<number[]>;
|
package/dist/server.d.ts
CHANGED
|
@@ -2,8 +2,8 @@ import { V as VectorDBConfig, L as LLMConfig, d as EmbeddingConfig, i as RagConf
|
|
|
2
2
|
export { B as BarChartData, u as CarouselProduct, c as ChatResponse, v as IRetriever, f as IngestDocument, h as LatencyBreakdown, w as LineChartDataPoint, M as MessageRole, x as MetricCardData, O as ObservabilityTrace, P as PieChartData, y as Product, j as RagMessage, k as RetrievalConfig, z as RetrievalResult, l as RetrievedChunk, A as RetrivoraChunkMetadata, D as RetrivoraIngestedDocument, S as ScatterPlotDataPoint, F as SuggestionsResponse, H as TableData, T as TokenUsage, J as UITransformationResponse, U as UseRagChatOptions, a as UseRagChatReturn, K as VisualizationType, W as WorkflowConfig } from './ILLMProvider-BWa68XX5.js';
|
|
3
3
|
import { I as IRenderRule, i as DecisionContext, k as IntentCategory, n as RenderDecision } from './index-BCbeeh74.js';
|
|
4
4
|
export { x as ArchitectureCardProps, A as AuthenticationException, y as CarouselRendererStrategy, z as ChartRendererStrategy, e as ChartType, B as ChatViewportSize, C as ChatWidgetProps, a as ChatWindowProps, f as Chunk, g as ChunkOptions, c as ClientConfig, b as ConfigProviderProps, h as ConfigurationException, F as DocumentChunker, D as DocumentUploadProps, E as EmbeddingFailedException, j as IRendererStrategy, l as IntentClassifier, M as MessageBubbleProps, G as MixedRendererStrategy, H as Pipeline, J as PipelineStep, P as ProductCardProps, d as ProductCarouselProps, m as ProviderNotFoundException, K as ProviderPill, R as RateLimitException, L as RenderSectionDecision, o as RenderType, p as RendererRegistry, q as RetrievalException, r as Retrivora, s as RetrivoraError, t as RetrivoraErrorCode, u as RuleEngine, v as SDK_VERSION, N as Snippet, S as SourceCardProps, T as TableRendererStrategy, O as TextRendererStrategy, V as VisualizationDecisionEngine, w as decideVisualization, Q as wrapError } from './index-BCbeeh74.js';
|
|
5
|
-
import { H as HealthCheckResult, I as IProviderValidator, a as IProviderHealthChecker } from './index-
|
|
6
|
-
export { C as ConfigValidator, V as ValidationError, b as VectorPlugin, c as createChatHandler, d as createFeedbackHandler, e as createHealthHandler, f as createHistoryHandler, g as createIngestHandler, h as createRagHandler, i as createSessionsHandler, j as createStreamHandler, k as createUploadHandler, s as sseErrorFrame, l as sseFrame, m as sseMetaFrame, n as sseTextFrame } from './index-
|
|
5
|
+
import { H as HealthCheckResult, I as IProviderValidator, a as IProviderHealthChecker } from './index-B5TTZWkx.js';
|
|
6
|
+
export { C as ConfigValidator, V as ValidationError, b as VectorPlugin, c as createChatHandler, d as createFeedbackHandler, e as createHealthHandler, f as createHistoryHandler, g as createIngestHandler, h as createRagHandler, i as createSessionsHandler, j as createStreamHandler, k as createUploadHandler, s as sseErrorFrame, l as sseFrame, m as sseMetaFrame, n as sseTextFrame } from './index-B5TTZWkx.js';
|
|
7
7
|
import 'react';
|
|
8
8
|
import 'next/server';
|
|
9
9
|
|
|
@@ -524,11 +524,11 @@ declare const LLM_PROFILES: {
|
|
|
524
524
|
chatPayloadTemplate: string;
|
|
525
525
|
};
|
|
526
526
|
litellm: {
|
|
527
|
-
chatPayloadTemplate: string;
|
|
528
527
|
chatPath: string;
|
|
529
528
|
embedPath: string;
|
|
530
529
|
responseExtractPath: string;
|
|
531
530
|
embedExtractPath: string;
|
|
531
|
+
chatPayloadTemplate: string;
|
|
532
532
|
};
|
|
533
533
|
'anthropic-claude': {
|
|
534
534
|
chatPath: string;
|
|
@@ -1020,7 +1020,6 @@ declare class UniversalLLMAdapter implements ILLMProvider {
|
|
|
1020
1020
|
/**
|
|
1021
1021
|
* Streaming chat using native fetch + ReadableStream.
|
|
1022
1022
|
* Parses OpenAI-compatible SSE frames: `data: {...}\n\n`
|
|
1023
|
-
* Works with vLLM, LMStudio, Together AI, Fireworks, and any OpenAI-compatible API.
|
|
1024
1023
|
*/
|
|
1025
1024
|
chatStream(messages: ChatMessage[], context?: string): AsyncIterable<string>;
|
|
1026
1025
|
embed(text: string): Promise<number[]>;
|