@retrivora-ai/rag-engine 2.5.5 → 2.5.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/{ILLMProvider-DO5gj-e5.d.mts → ILLMProvider-DwFj0h2u.d.mts} +2 -2
- package/dist/{ILLMProvider-DO5gj-e5.d.ts → ILLMProvider-DwFj0h2u.d.ts} +2 -2
- package/dist/handlers/index.d.mts +2 -2
- package/dist/handlers/index.d.ts +2 -2
- package/dist/handlers/index.js +191 -27
- package/dist/handlers/index.mjs +185 -21
- package/dist/{index-BKOyhayB.d.mts → index-Byv5MaYi.d.mts} +1 -1
- package/dist/{index-DkOhRqEc.d.ts → index-Cb0GsT16.d.ts} +1 -1
- package/dist/{index-DE8qPWpI.d.mts → index-D1jN8KSF.d.mts} +1 -1
- package/dist/{index-8vijDPfT.d.ts → index-DP3_OpuB.d.ts} +1 -1
- package/dist/index.d.mts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/dist/server.d.mts +57 -10
- package/dist/server.d.ts +57 -10
- package/dist/server.js +199 -33
- package/dist/server.mjs +192 -27
- package/package.json +1 -1
package/dist/server.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { p as RagConfig, v as UniversalRagConfig, V as VectorDBConfig, w as UpsertDocument, y as VectorMatch, G as GraphDBConfig, H as GraphNode, J as Edge, K as GraphSearchResult, L as LLMConfig, f as EmbeddingConfig, I as ILLMProvider, x as VectorDBProvider, i as LLMProvider, g as EmbeddingProvider, R as RAGConfig, u as UIConfig, U as UITransformationResponse, C as ChatMessage, d as ChatOptions, E as EmbedOptions, h as IngestDocument, e as ChatResponse } from './ILLMProvider-
|
|
2
|
-
export { A as AuthMode, M as BarChartData, N as CarouselProduct, Q as IRetriever, j as LatencyBreakdown, S as LineChartDataPoint, X as MessageRole, Y as MetricCardData, O as ObservabilityTrace, Z as PieChartData, P as Product, k as ProjectAiSettings, l as ProjectAuthSettings, m as ProjectBrandingSettings, c as ProjectChatSettings, n as ProjectTelemetrySettings, o as ProjectWidgetSettings, q as RagMessage, r as RetrievalConfig, _ as RetrievalResult, s as RetrievedChunk, $ as RetrivoraChunkMetadata, a0 as RetrivoraIngestedDocument, a1 as ScatterPlotDataPoint, a2 as SuggestionsResponse, a3 as TableData, T as ThemeMode, t as TokenUsage, a as UseRagChatOptions, b as UseRagChatReturn, a4 as VisualizationType, W as WidgetPosition, z as WorkflowConfig, B as createDefaultProjectSettings, D as normalizeProjectSettings, F as projectSettingsToUiConfig } from './ILLMProvider-
|
|
3
|
-
import { o as DecisionContext, q as IntentCategory, I as IRenderRule, G as RenderDecision, p as IRendererStrategy } from './index-
|
|
4
|
-
export { V as ArchitectureCardProps, A as AuthenticationException, B as BatchOptions, f as BatchProcessor, g as BatchResult, h as ChartType, e as ChatViewportSize, C as ChatWidgetProps, a as ChatWindowProps, i as Chunk, j as ChunkOptions, c as ClientConfig, m as ConfigFetcher, b as ConfigProviderProps, n as ConfigurationException, W as DocumentChunker, D as DocumentUploadProps, E as EmbeddingFailedException, X as LicenseConfigResolver, L as LicenseTierConfig, r as LicenseValidationError, s as LicenseValidationRequest, t as LicenseValidationResponse, u as LicenseValidator, M as MessageBubbleProps, Y as Pipeline, Z as PipelineStep, P as ProductCardProps, d as ProductCarouselProps, v as ProviderCredentials, w as ProviderNotFoundException, _ as ProviderPill, x as RateLimitException, R as RemoteConfig, y as RemoteEmbeddingConfig, z as RemoteLLMConfig, F as RemoteVectorConfig, $ as RenderSectionDecision, H as RenderType, J as RetrievalException, K as Retrivora, N as RetrivoraError, O as RetrivoraErrorCode, Q as SDKVersionUnsupportedError, T as SDK_VERSION, a0 as Snippet, S as SourceCardProps, a1 as wrapError } from './index-
|
|
5
|
-
import { I as IProviderValidator, a as IProviderHealthChecker, H as HealthCheckResult } from './index-
|
|
6
|
-
export { C as ConfigValidator, b as HandlerOptions, V as ValidationError, c as VectorPlugin, d as createChatHandler, e as createFeedbackHandler, f as createHealthHandler, g as createHistoryHandler, h as createIngestHandler, i as createRagHandler, j as createSessionsHandler, k as createStreamHandler, l as createUploadHandler, s as sseErrorFrame, m as sseFrame, n as sseMetaFrame, o as sseTextFrame } from './index-
|
|
1
|
+
import { p as RagConfig, v as UniversalRagConfig, V as VectorDBConfig, w as UpsertDocument, y as VectorMatch, G as GraphDBConfig, H as GraphNode, J as Edge, K as GraphSearchResult, L as LLMConfig, f as EmbeddingConfig, I as ILLMProvider, x as VectorDBProvider, i as LLMProvider, g as EmbeddingProvider, R as RAGConfig, u as UIConfig, U as UITransformationResponse, C as ChatMessage, d as ChatOptions, E as EmbedOptions, h as IngestDocument, e as ChatResponse } from './ILLMProvider-DwFj0h2u.js';
|
|
2
|
+
export { A as AuthMode, M as BarChartData, N as CarouselProduct, Q as IRetriever, j as LatencyBreakdown, S as LineChartDataPoint, X as MessageRole, Y as MetricCardData, O as ObservabilityTrace, Z as PieChartData, P as Product, k as ProjectAiSettings, l as ProjectAuthSettings, m as ProjectBrandingSettings, c as ProjectChatSettings, n as ProjectTelemetrySettings, o as ProjectWidgetSettings, q as RagMessage, r as RetrievalConfig, _ as RetrievalResult, s as RetrievedChunk, $ as RetrivoraChunkMetadata, a0 as RetrivoraIngestedDocument, a1 as ScatterPlotDataPoint, a2 as SuggestionsResponse, a3 as TableData, T as ThemeMode, t as TokenUsage, a as UseRagChatOptions, b as UseRagChatReturn, a4 as VisualizationType, W as WidgetPosition, z as WorkflowConfig, B as createDefaultProjectSettings, D as normalizeProjectSettings, F as projectSettingsToUiConfig } from './ILLMProvider-DwFj0h2u.js';
|
|
3
|
+
import { o as DecisionContext, q as IntentCategory, I as IRenderRule, G as RenderDecision, p as IRendererStrategy } from './index-DP3_OpuB.js';
|
|
4
|
+
export { V as ArchitectureCardProps, A as AuthenticationException, B as BatchOptions, f as BatchProcessor, g as BatchResult, h as ChartType, e as ChatViewportSize, C as ChatWidgetProps, a as ChatWindowProps, i as Chunk, j as ChunkOptions, c as ClientConfig, m as ConfigFetcher, b as ConfigProviderProps, n as ConfigurationException, W as DocumentChunker, D as DocumentUploadProps, E as EmbeddingFailedException, X as LicenseConfigResolver, L as LicenseTierConfig, r as LicenseValidationError, s as LicenseValidationRequest, t as LicenseValidationResponse, u as LicenseValidator, M as MessageBubbleProps, Y as Pipeline, Z as PipelineStep, P as ProductCardProps, d as ProductCarouselProps, v as ProviderCredentials, w as ProviderNotFoundException, _ as ProviderPill, x as RateLimitException, R as RemoteConfig, y as RemoteEmbeddingConfig, z as RemoteLLMConfig, F as RemoteVectorConfig, $ as RenderSectionDecision, H as RenderType, J as RetrievalException, K as Retrivora, N as RetrivoraError, O as RetrivoraErrorCode, Q as SDKVersionUnsupportedError, T as SDK_VERSION, a0 as Snippet, S as SourceCardProps, a1 as wrapError } from './index-DP3_OpuB.js';
|
|
5
|
+
import { I as IProviderValidator, a as IProviderHealthChecker, H as HealthCheckResult } from './index-Cb0GsT16.js';
|
|
6
|
+
export { C as ConfigValidator, b as HandlerOptions, V as ValidationError, c as VectorPlugin, d as createChatHandler, e as createFeedbackHandler, f as createHealthHandler, g as createHistoryHandler, h as createIngestHandler, i as createRagHandler, j as createSessionsHandler, k as createStreamHandler, l as createUploadHandler, s as sseErrorFrame, m as sseFrame, n as sseMetaFrame, o as sseTextFrame } from './index-Cb0GsT16.js';
|
|
7
7
|
import 'react';
|
|
8
8
|
import 'next/server';
|
|
9
9
|
|
|
@@ -1140,6 +1140,53 @@ declare class UniversalLLMAdapter implements ILLMProvider {
|
|
|
1140
1140
|
ping(): Promise<boolean>;
|
|
1141
1141
|
}
|
|
1142
1142
|
|
|
1143
|
+
interface CustomEmbeddingOptions {
|
|
1144
|
+
/** Base URL of the custom embedding server (e.g., http://localhost:8080/v1 or https://embeddings.mycompany.com) */
|
|
1145
|
+
baseUrl?: string;
|
|
1146
|
+
/** Relative endpoint path for embeddings (default: '/embeddings') */
|
|
1147
|
+
embedPath?: string;
|
|
1148
|
+
/** Endpoint path for health check (default: '/health' or root) */
|
|
1149
|
+
pingPath?: string;
|
|
1150
|
+
/** Prefix to prepend to query texts (e.g., "query: " for BGE/Nomic models) */
|
|
1151
|
+
queryPrefix?: string;
|
|
1152
|
+
/** Prefix to prepend to document texts (e.g., "passage: " or "document: ") */
|
|
1153
|
+
documentPrefix?: string;
|
|
1154
|
+
/** Template string to build custom JSON payload if non-standard (e.g. '{"inputs": {{input}}, "model": "{{model}}"}') */
|
|
1155
|
+
embedPayloadTemplate?: string;
|
|
1156
|
+
/** JSON path to extract embedding float array from response (default: 'data[0].embedding' or 'embedding') */
|
|
1157
|
+
embedExtractPath?: string;
|
|
1158
|
+
/** Custom HTTP headers */
|
|
1159
|
+
headers?: Record<string, string>;
|
|
1160
|
+
/** Timeout in milliseconds (default: 30000) */
|
|
1161
|
+
timeout?: number;
|
|
1162
|
+
}
|
|
1163
|
+
declare class CustomEmbeddingProvider implements ILLMProvider {
|
|
1164
|
+
private readonly http;
|
|
1165
|
+
private readonly model;
|
|
1166
|
+
private readonly baseUrl;
|
|
1167
|
+
private readonly apiKey?;
|
|
1168
|
+
private readonly opts;
|
|
1169
|
+
constructor(config: EmbeddingConfig | LLMConfig);
|
|
1170
|
+
/**
|
|
1171
|
+
* Dummy chat implementation. CustomEmbeddingProvider is dedicated to embedding generation.
|
|
1172
|
+
*/
|
|
1173
|
+
chat(_messages: ChatMessage[], _context?: string, _options?: ChatOptions): Promise<string>;
|
|
1174
|
+
/**
|
|
1175
|
+
* Generate vector embedding for a single string.
|
|
1176
|
+
*/
|
|
1177
|
+
embed(text: string, options?: EmbedOptions): Promise<number[]>;
|
|
1178
|
+
/**
|
|
1179
|
+
* Batch embedding generation for multiple texts.
|
|
1180
|
+
*/
|
|
1181
|
+
batchEmbed(texts: string[], options?: EmbedOptions): Promise<number[][]>;
|
|
1182
|
+
/**
|
|
1183
|
+
* Ping provider endpoint for health check.
|
|
1184
|
+
*/
|
|
1185
|
+
ping(): Promise<boolean>;
|
|
1186
|
+
private extractVector;
|
|
1187
|
+
private extractBatchVectors;
|
|
1188
|
+
}
|
|
1189
|
+
|
|
1143
1190
|
/**
|
|
1144
1191
|
* LicensedRetrivora — End-user facing SDK that only requires:
|
|
1145
1192
|
* - License Key (JWT from Retrivora)
|
|
@@ -1264,7 +1311,7 @@ interface TelemetryEvent {
|
|
|
1264
1311
|
documentName?: string;
|
|
1265
1312
|
documentSize?: number;
|
|
1266
1313
|
chunksGenerated?: number;
|
|
1267
|
-
|
|
1314
|
+
queryLength?: number;
|
|
1268
1315
|
resultCount?: number;
|
|
1269
1316
|
errorCode?: string;
|
|
1270
1317
|
errorMessage?: string;
|
|
@@ -1324,10 +1371,10 @@ declare class TelemetryService {
|
|
|
1324
1371
|
durationMs: number;
|
|
1325
1372
|
}): void;
|
|
1326
1373
|
/**
|
|
1327
|
-
* Record query execution event
|
|
1374
|
+
* Record query execution event (PII-safe)
|
|
1328
1375
|
*/
|
|
1329
1376
|
recordQueryExecuted(data: {
|
|
1330
|
-
|
|
1377
|
+
queryLength: number;
|
|
1331
1378
|
resultCount: number;
|
|
1332
1379
|
durationMs: number;
|
|
1333
1380
|
operationId?: string;
|
|
@@ -1374,4 +1421,4 @@ declare function initializeTelemetryService(projectId: string, licenseKey: strin
|
|
|
1374
1421
|
*/
|
|
1375
1422
|
declare function shutdownTelemetryService(): Promise<void>;
|
|
1376
1423
|
|
|
1377
|
-
export { AnthropicProvider, BaseVectorProvider, CarouselRendererStrategy, ChartRendererStrategy, ChatMessage, ChatOptions, ChatResponse, ChromaDBProvider, ConfigBuilder, ConfigResolver, DecisionContext, DocumentParser, Edge, EmbedOptions, EmbeddingConfig, EmbeddingProvider, EmbeddingStrategy, EmbeddingStrategyResolver, EventType, GraphNode, GraphSearchResult, GroqProvider, HealthCheckResult, ILLMProvider, IProviderHealthChecker, IProviderValidator, IRenderRule, IRendererStrategy, IngestDocument, IntentCategory, IntentClassifier, LLMConfig, LLMFactory, LLMProvider, LLM_PROFILES, type LicensePayload, LicenseVerifier, LicensedRetrivora, type LicensedRetrivoraOptions, MilvusProvider, MixedRendererStrategy, MongoDBProvider, MultiTablePostgresProvider, OllamaProvider, OpenAIProvider, PRESETS, PineconeProvider, PostgreSQLProvider, ProviderHealthCheck, ProviderRegistry, QdrantProvider, QwenProvider, RAGConfig, RagConfig, RedisProvider, RenderDecision, RendererRegistry, Rule1SpecificInfoRule, Rule2ComparisonRule, Rule3ProductDiscoveryRule, Rule4AnalyticalRule, Rule5MixedResponseRule, Rule6SmallResultSetRule, Rule7LargeTableRule, RuleEngine, type RuntimeTierConfig, TableRendererStrategy, type TelemetryEvent, TelemetryService, TextRendererStrategy, UIConfig, UITransformationResponse, UniversalLLMAdapter, UniversalRagConfig, UniversalVectorProvider, UpsertDocument, VECTOR_PROFILES, VectorDBConfig, VectorDBProvider, VectorMatch, VisualizationDecisionEngine, WeaviateProvider, createFromPreset, createRetrivora, decideVisualization, getRagConfig, getRuntimeConfig, getTelemetryService, initializeTelemetryService, injectRuntimeConfig, shutdownTelemetryService };
|
|
1424
|
+
export { AnthropicProvider, BaseVectorProvider, CarouselRendererStrategy, ChartRendererStrategy, ChatMessage, ChatOptions, ChatResponse, ChromaDBProvider, ConfigBuilder, ConfigResolver, type CustomEmbeddingOptions, CustomEmbeddingProvider, DecisionContext, DocumentParser, Edge, EmbedOptions, EmbeddingConfig, EmbeddingProvider, EmbeddingStrategy, EmbeddingStrategyResolver, EventType, GraphNode, GraphSearchResult, GroqProvider, HealthCheckResult, ILLMProvider, IProviderHealthChecker, IProviderValidator, IRenderRule, IRendererStrategy, IngestDocument, IntentCategory, IntentClassifier, LLMConfig, LLMFactory, LLMProvider, LLM_PROFILES, type LicensePayload, LicenseVerifier, LicensedRetrivora, type LicensedRetrivoraOptions, MilvusProvider, MixedRendererStrategy, MongoDBProvider, MultiTablePostgresProvider, OllamaProvider, OpenAIProvider, PRESETS, PineconeProvider, PostgreSQLProvider, ProviderHealthCheck, ProviderRegistry, QdrantProvider, QwenProvider, RAGConfig, RagConfig, RedisProvider, RenderDecision, RendererRegistry, Rule1SpecificInfoRule, Rule2ComparisonRule, Rule3ProductDiscoveryRule, Rule4AnalyticalRule, Rule5MixedResponseRule, Rule6SmallResultSetRule, Rule7LargeTableRule, RuleEngine, type RuntimeTierConfig, TableRendererStrategy, type TelemetryEvent, TelemetryService, TextRendererStrategy, UIConfig, UITransformationResponse, UniversalLLMAdapter, UniversalRagConfig, UniversalVectorProvider, UpsertDocument, VECTOR_PROFILES, VectorDBConfig, VectorDBProvider, VectorMatch, VisualizationDecisionEngine, WeaviateProvider, createFromPreset, createRetrivora, decideVisualization, getRagConfig, getRuntimeConfig, getTelemetryService, initializeTelemetryService, injectRuntimeConfig, shutdownTelemetryService };
|
package/dist/server.js
CHANGED
|
@@ -332,7 +332,7 @@ var init_package = __esm({
|
|
|
332
332
|
"package.json"() {
|
|
333
333
|
package_default = {
|
|
334
334
|
name: "@retrivora-ai/rag-engine",
|
|
335
|
-
version: "2.5.
|
|
335
|
+
version: "2.5.6",
|
|
336
336
|
description: "Retrivora AI is a plug-and-play AI engine for RAG chat experiences \u2014 generic vector DB + LLM provider, embeddable or standalone.",
|
|
337
337
|
author: "Abhinav Alkuchi",
|
|
338
338
|
license: "UNLICENSED",
|
|
@@ -1776,11 +1776,11 @@ var MilvusProvider_exports = {};
|
|
|
1776
1776
|
__export(MilvusProvider_exports, {
|
|
1777
1777
|
MilvusProvider: () => MilvusProvider
|
|
1778
1778
|
});
|
|
1779
|
-
var
|
|
1779
|
+
var import_axios4, MilvusProvider;
|
|
1780
1780
|
var init_MilvusProvider = __esm({
|
|
1781
1781
|
"src/providers/vectordb/MilvusProvider.ts"() {
|
|
1782
1782
|
"use strict";
|
|
1783
|
-
|
|
1783
|
+
import_axios4 = __toESM(require("axios"));
|
|
1784
1784
|
init_BaseVectorProvider();
|
|
1785
1785
|
MilvusProvider = class extends BaseVectorProvider {
|
|
1786
1786
|
constructor(config) {
|
|
@@ -1788,7 +1788,7 @@ var init_MilvusProvider = __esm({
|
|
|
1788
1788
|
const opts = config.options;
|
|
1789
1789
|
const baseUrl = opts.baseUrl || opts.uri || (opts.host ? `http://${opts.host}:${opts.port || 19530}` : void 0);
|
|
1790
1790
|
if (!baseUrl) throw new Error("[MilvusProvider] options.baseUrl (or uri / host+port) is required");
|
|
1791
|
-
this.http =
|
|
1791
|
+
this.http = import_axios4.default.create({
|
|
1792
1792
|
baseURL: baseUrl,
|
|
1793
1793
|
headers: __spreadValues(__spreadValues({
|
|
1794
1794
|
"Content-Type": "application/json"
|
|
@@ -1889,11 +1889,11 @@ var QdrantProvider_exports = {};
|
|
|
1889
1889
|
__export(QdrantProvider_exports, {
|
|
1890
1890
|
QdrantProvider: () => QdrantProvider
|
|
1891
1891
|
});
|
|
1892
|
-
var
|
|
1892
|
+
var import_axios5, import_crypto, QdrantProvider;
|
|
1893
1893
|
var init_QdrantProvider = __esm({
|
|
1894
1894
|
"src/providers/vectordb/QdrantProvider.ts"() {
|
|
1895
1895
|
"use strict";
|
|
1896
|
-
|
|
1896
|
+
import_axios5 = __toESM(require("axios"));
|
|
1897
1897
|
import_crypto = __toESM(require("crypto"));
|
|
1898
1898
|
init_BaseVectorProvider();
|
|
1899
1899
|
QdrantProvider = class extends BaseVectorProvider {
|
|
@@ -1906,7 +1906,7 @@ var init_QdrantProvider = __esm({
|
|
|
1906
1906
|
this.contentField = opts.contentField || "content";
|
|
1907
1907
|
this.metadataField = opts.metadataField || "metadata";
|
|
1908
1908
|
this.isFlatPayload = !!opts.flatPayload;
|
|
1909
|
-
this.http =
|
|
1909
|
+
this.http = import_axios5.default.create({
|
|
1910
1910
|
baseURL: baseUrl,
|
|
1911
1911
|
timeout: 15e3,
|
|
1912
1912
|
// 15s timeout for vector DB operations
|
|
@@ -1974,7 +1974,7 @@ var init_QdrantProvider = __esm({
|
|
|
1974
1974
|
try {
|
|
1975
1975
|
await this.http.get(`/collections/${this.indexName}`);
|
|
1976
1976
|
} catch (err) {
|
|
1977
|
-
if (
|
|
1977
|
+
if (import_axios5.default.isAxiosError(err) && ((_a2 = err.response) == null ? void 0 : _a2.status) === 404) {
|
|
1978
1978
|
const opts = this.config.options;
|
|
1979
1979
|
const dimensionsForCreate = opts.dimensions || 1536;
|
|
1980
1980
|
await this.http.put(`/collections/${this.indexName}`, {
|
|
@@ -2004,7 +2004,7 @@ var init_QdrantProvider = __esm({
|
|
|
2004
2004
|
});
|
|
2005
2005
|
} catch (err) {
|
|
2006
2006
|
let status;
|
|
2007
|
-
if (
|
|
2007
|
+
if (import_axios5.default.isAxiosError(err)) status = (_a2 = err.response) == null ? void 0 : _a2.status;
|
|
2008
2008
|
if (status === 409) return;
|
|
2009
2009
|
console.warn(`[QdrantProvider] \u26A0\uFE0F Could not ensure index for "${fullPath}":`, err instanceof Error ? err.message : String(err));
|
|
2010
2010
|
}
|
|
@@ -2128,11 +2128,11 @@ var ChromaDBProvider_exports = {};
|
|
|
2128
2128
|
__export(ChromaDBProvider_exports, {
|
|
2129
2129
|
ChromaDBProvider: () => ChromaDBProvider
|
|
2130
2130
|
});
|
|
2131
|
-
var
|
|
2131
|
+
var import_axios6, ChromaDBProvider;
|
|
2132
2132
|
var init_ChromaDBProvider = __esm({
|
|
2133
2133
|
"src/providers/vectordb/ChromaDBProvider.ts"() {
|
|
2134
2134
|
"use strict";
|
|
2135
|
-
|
|
2135
|
+
import_axios6 = __toESM(require("axios"));
|
|
2136
2136
|
init_BaseVectorProvider();
|
|
2137
2137
|
ChromaDBProvider = class extends BaseVectorProvider {
|
|
2138
2138
|
constructor(config) {
|
|
@@ -2141,7 +2141,7 @@ var init_ChromaDBProvider = __esm({
|
|
|
2141
2141
|
const opts = config.options;
|
|
2142
2142
|
const baseUrl = opts.baseUrl || (opts.host ? `http://${opts.host}:${opts.port || 8e3}` : void 0);
|
|
2143
2143
|
if (!baseUrl) throw new Error("[ChromaDBProvider] options.baseUrl is required");
|
|
2144
|
-
this.http =
|
|
2144
|
+
this.http = import_axios6.default.create({
|
|
2145
2145
|
baseURL: baseUrl,
|
|
2146
2146
|
headers: { "Content-Type": "application/json" }
|
|
2147
2147
|
});
|
|
@@ -2155,7 +2155,7 @@ var init_ChromaDBProvider = __esm({
|
|
|
2155
2155
|
const { data } = await this.http.get(`/api/v1/collections/${this.indexName}`);
|
|
2156
2156
|
this.collectionId = data.id;
|
|
2157
2157
|
} catch (err) {
|
|
2158
|
-
if (
|
|
2158
|
+
if (import_axios6.default.isAxiosError(err) && ((_a2 = err.response) == null ? void 0 : _a2.status) === 404) {
|
|
2159
2159
|
const { data } = await this.http.post("/api/v1/collections", {
|
|
2160
2160
|
name: this.indexName
|
|
2161
2161
|
});
|
|
@@ -2236,11 +2236,11 @@ var RedisProvider_exports = {};
|
|
|
2236
2236
|
__export(RedisProvider_exports, {
|
|
2237
2237
|
RedisProvider: () => RedisProvider
|
|
2238
2238
|
});
|
|
2239
|
-
var
|
|
2239
|
+
var import_axios7, RedisProvider;
|
|
2240
2240
|
var init_RedisProvider = __esm({
|
|
2241
2241
|
"src/providers/vectordb/RedisProvider.ts"() {
|
|
2242
2242
|
"use strict";
|
|
2243
|
-
|
|
2243
|
+
import_axios7 = __toESM(require("axios"));
|
|
2244
2244
|
init_BaseVectorProvider();
|
|
2245
2245
|
RedisProvider = class extends BaseVectorProvider {
|
|
2246
2246
|
constructor(config) {
|
|
@@ -2248,7 +2248,7 @@ var init_RedisProvider = __esm({
|
|
|
2248
2248
|
const opts = config.options;
|
|
2249
2249
|
const baseUrl = opts.baseUrl || opts.url || (opts.host ? `http://${opts.host}:${opts.port || 6379}` : void 0);
|
|
2250
2250
|
if (!baseUrl) throw new Error("[RedisProvider] options.baseUrl is required");
|
|
2251
|
-
this.http =
|
|
2251
|
+
this.http = import_axios7.default.create({
|
|
2252
2252
|
baseURL: baseUrl,
|
|
2253
2253
|
headers: __spreadValues({
|
|
2254
2254
|
"Content-Type": "application/json"
|
|
@@ -2318,11 +2318,11 @@ var WeaviateProvider_exports = {};
|
|
|
2318
2318
|
__export(WeaviateProvider_exports, {
|
|
2319
2319
|
WeaviateProvider: () => WeaviateProvider
|
|
2320
2320
|
});
|
|
2321
|
-
var
|
|
2321
|
+
var import_axios8, WeaviateProvider;
|
|
2322
2322
|
var init_WeaviateProvider = __esm({
|
|
2323
2323
|
"src/providers/vectordb/WeaviateProvider.ts"() {
|
|
2324
2324
|
"use strict";
|
|
2325
|
-
|
|
2325
|
+
import_axios8 = __toESM(require("axios"));
|
|
2326
2326
|
init_BaseVectorProvider();
|
|
2327
2327
|
WeaviateProvider = class extends BaseVectorProvider {
|
|
2328
2328
|
constructor(config) {
|
|
@@ -2330,7 +2330,7 @@ var init_WeaviateProvider = __esm({
|
|
|
2330
2330
|
const opts = config.options;
|
|
2331
2331
|
const baseUrl = opts.baseUrl || opts.url;
|
|
2332
2332
|
if (!baseUrl) throw new Error("[WeaviateProvider] options.baseUrl is required");
|
|
2333
|
-
this.http =
|
|
2333
|
+
this.http = import_axios8.default.create({
|
|
2334
2334
|
baseURL: baseUrl,
|
|
2335
2335
|
headers: __spreadValues(__spreadValues({
|
|
2336
2336
|
"Content-Type": "application/json"
|
|
@@ -2470,11 +2470,11 @@ var UniversalVectorProvider_exports = {};
|
|
|
2470
2470
|
__export(UniversalVectorProvider_exports, {
|
|
2471
2471
|
UniversalVectorProvider: () => UniversalVectorProvider
|
|
2472
2472
|
});
|
|
2473
|
-
var
|
|
2473
|
+
var import_axios9, UniversalVectorProvider;
|
|
2474
2474
|
var init_UniversalVectorProvider = __esm({
|
|
2475
2475
|
"src/providers/vectordb/UniversalVectorProvider.ts"() {
|
|
2476
2476
|
"use strict";
|
|
2477
|
-
|
|
2477
|
+
import_axios9 = __toESM(require("axios"));
|
|
2478
2478
|
init_BaseVectorProvider();
|
|
2479
2479
|
init_templateUtils();
|
|
2480
2480
|
UniversalVectorProvider = class extends BaseVectorProvider {
|
|
@@ -2487,7 +2487,7 @@ var init_UniversalVectorProvider = __esm({
|
|
|
2487
2487
|
}
|
|
2488
2488
|
async initialize() {
|
|
2489
2489
|
var _a2;
|
|
2490
|
-
this.http =
|
|
2490
|
+
this.http = import_axios9.default.create({
|
|
2491
2491
|
baseURL: this.opts.baseUrl,
|
|
2492
2492
|
headers: __spreadValues({
|
|
2493
2493
|
"Content-Type": "application/json"
|
|
@@ -2718,6 +2718,7 @@ __export(server_exports, {
|
|
|
2718
2718
|
ConfigResolver: () => ConfigResolver,
|
|
2719
2719
|
ConfigValidator: () => ConfigValidator,
|
|
2720
2720
|
ConfigurationException: () => ConfigurationException,
|
|
2721
|
+
CustomEmbeddingProvider: () => CustomEmbeddingProvider,
|
|
2721
2722
|
DocumentChunker: () => DocumentChunker,
|
|
2722
2723
|
DocumentParser: () => DocumentParser,
|
|
2723
2724
|
EmbeddingFailedException: () => EmbeddingFailedException,
|
|
@@ -3166,7 +3167,9 @@ var LLM_PROVIDERS = [
|
|
|
3166
3167
|
"qwen",
|
|
3167
3168
|
"rest",
|
|
3168
3169
|
"universal_rest",
|
|
3169
|
-
"custom"
|
|
3170
|
+
"custom",
|
|
3171
|
+
"custom_embedding",
|
|
3172
|
+
"local_embedding"
|
|
3170
3173
|
];
|
|
3171
3174
|
var EMBEDDING_PROVIDERS = [
|
|
3172
3175
|
"openai",
|
|
@@ -3175,7 +3178,9 @@ var EMBEDDING_PROVIDERS = [
|
|
|
3175
3178
|
"qwen",
|
|
3176
3179
|
"rest",
|
|
3177
3180
|
"universal_rest",
|
|
3178
|
-
"custom"
|
|
3181
|
+
"custom",
|
|
3182
|
+
"custom_embedding",
|
|
3183
|
+
"local_embedding"
|
|
3179
3184
|
];
|
|
3180
3185
|
var PROVIDERS_WITH_EMBEDDINGS = [
|
|
3181
3186
|
"openai",
|
|
@@ -3183,7 +3188,10 @@ var PROVIDERS_WITH_EMBEDDINGS = [
|
|
|
3183
3188
|
"gemini",
|
|
3184
3189
|
"qwen",
|
|
3185
3190
|
"rest",
|
|
3186
|
-
"universal_rest"
|
|
3191
|
+
"universal_rest",
|
|
3192
|
+
"custom",
|
|
3193
|
+
"custom_embedding",
|
|
3194
|
+
"local_embedding"
|
|
3187
3195
|
];
|
|
3188
3196
|
|
|
3189
3197
|
// src/config/serverConfig.ts
|
|
@@ -3929,8 +3937,8 @@ var OllamaProvider = class {
|
|
|
3929
3937
|
const baseUrl = config.baseUrl || "http://localhost:11434";
|
|
3930
3938
|
const modelName = config.model;
|
|
3931
3939
|
try {
|
|
3932
|
-
const
|
|
3933
|
-
const { data } = await
|
|
3940
|
+
const axios11 = (await import("axios")).default;
|
|
3941
|
+
const { data } = await axios11.get(`${baseUrl}/api/tags`);
|
|
3934
3942
|
const models = data.models || [];
|
|
3935
3943
|
const hasModel = models.some((m) => m.name === modelName || m.name.startsWith(`${modelName}:`));
|
|
3936
3944
|
return {
|
|
@@ -5047,6 +5055,158 @@ ${context != null ? context : "None"}` },
|
|
|
5047
5055
|
}
|
|
5048
5056
|
};
|
|
5049
5057
|
|
|
5058
|
+
// src/llm/providers/CustomEmbeddingProvider.ts
|
|
5059
|
+
var import_axios3 = __toESM(require("axios"));
|
|
5060
|
+
init_templateUtils();
|
|
5061
|
+
var CustomEmbeddingProvider = class {
|
|
5062
|
+
constructor(config) {
|
|
5063
|
+
var _a2, _b;
|
|
5064
|
+
this.model = config.model || "custom-embedding-model";
|
|
5065
|
+
this.apiKey = config.apiKey;
|
|
5066
|
+
const options = (_a2 = config.options) != null ? _a2 : {};
|
|
5067
|
+
this.opts = {
|
|
5068
|
+
baseUrl: config.baseUrl || options.baseUrl,
|
|
5069
|
+
embedPath: options.embedPath || "/embeddings",
|
|
5070
|
+
pingPath: options.pingPath || "/health",
|
|
5071
|
+
queryPrefix: options.queryPrefix || "",
|
|
5072
|
+
documentPrefix: options.documentPrefix || "",
|
|
5073
|
+
embedPayloadTemplate: options.embedPayloadTemplate,
|
|
5074
|
+
embedExtractPath: options.embedExtractPath,
|
|
5075
|
+
headers: options.headers || {},
|
|
5076
|
+
timeout: options.timeout || 3e4
|
|
5077
|
+
};
|
|
5078
|
+
this.baseUrl = (_b = this.opts.baseUrl) != null ? _b : "";
|
|
5079
|
+
if (!this.baseUrl) {
|
|
5080
|
+
throw new Error("[CustomEmbeddingProvider] baseUrl is required in config or config.options");
|
|
5081
|
+
}
|
|
5082
|
+
const headers = __spreadValues(__spreadValues({
|
|
5083
|
+
"Content-Type": "application/json"
|
|
5084
|
+
}, this.apiKey ? { Authorization: `Bearer ${this.apiKey}` } : {}), this.opts.headers || {});
|
|
5085
|
+
this.http = import_axios3.default.create({
|
|
5086
|
+
baseURL: this.baseUrl.replace(/\/$/, ""),
|
|
5087
|
+
headers,
|
|
5088
|
+
timeout: this.opts.timeout
|
|
5089
|
+
});
|
|
5090
|
+
}
|
|
5091
|
+
/**
|
|
5092
|
+
* Dummy chat implementation. CustomEmbeddingProvider is dedicated to embedding generation.
|
|
5093
|
+
*/
|
|
5094
|
+
async chat(_messages, _context, _options) {
|
|
5095
|
+
throw new Error("[CustomEmbeddingProvider] chat() is not supported on a dedicated embedding provider.");
|
|
5096
|
+
}
|
|
5097
|
+
/**
|
|
5098
|
+
* Generate vector embedding for a single string.
|
|
5099
|
+
*/
|
|
5100
|
+
async embed(text, options) {
|
|
5101
|
+
var _a2;
|
|
5102
|
+
const taskType = (_a2 = options == null ? void 0 : options.taskType) != null ? _a2 : "document";
|
|
5103
|
+
const prefix = taskType === "query" ? this.opts.queryPrefix : this.opts.documentPrefix;
|
|
5104
|
+
const formattedText = prefix ? `${prefix}${text}` : text;
|
|
5105
|
+
const modelToUse = (options == null ? void 0 : options.model) || this.model;
|
|
5106
|
+
const path2 = this.opts.embedPath || "/embeddings";
|
|
5107
|
+
let payload;
|
|
5108
|
+
if (this.opts.embedPayloadTemplate) {
|
|
5109
|
+
payload = buildPayload(this.opts.embedPayloadTemplate, {
|
|
5110
|
+
input: formattedText,
|
|
5111
|
+
model: modelToUse
|
|
5112
|
+
});
|
|
5113
|
+
} else {
|
|
5114
|
+
payload = {
|
|
5115
|
+
model: modelToUse,
|
|
5116
|
+
input: formattedText
|
|
5117
|
+
};
|
|
5118
|
+
}
|
|
5119
|
+
try {
|
|
5120
|
+
const { data } = await this.http.post(path2, payload);
|
|
5121
|
+
const vector = this.extractVector(data);
|
|
5122
|
+
if (vector) return vector;
|
|
5123
|
+
throw new Error(`[CustomEmbeddingProvider] Failed to extract embedding vector from response at ${path2}`);
|
|
5124
|
+
} catch (err) {
|
|
5125
|
+
console.error("[CustomEmbeddingProvider] Embedding request failed:", {
|
|
5126
|
+
baseUrl: this.baseUrl,
|
|
5127
|
+
path: path2,
|
|
5128
|
+
model: modelToUse,
|
|
5129
|
+
error: (err == null ? void 0 : err.message) || err
|
|
5130
|
+
});
|
|
5131
|
+
throw err;
|
|
5132
|
+
}
|
|
5133
|
+
}
|
|
5134
|
+
/**
|
|
5135
|
+
* Batch embedding generation for multiple texts.
|
|
5136
|
+
*/
|
|
5137
|
+
async batchEmbed(texts, options) {
|
|
5138
|
+
var _a2;
|
|
5139
|
+
if (!Array.isArray(texts) || texts.length === 0) return [];
|
|
5140
|
+
const taskType = (_a2 = options == null ? void 0 : options.taskType) != null ? _a2 : "document";
|
|
5141
|
+
const prefix = taskType === "query" ? this.opts.queryPrefix : this.opts.documentPrefix;
|
|
5142
|
+
const formattedTexts = prefix ? texts.map((t) => `${prefix}${t}`) : texts;
|
|
5143
|
+
const modelToUse = (options == null ? void 0 : options.model) || this.model;
|
|
5144
|
+
const path2 = this.opts.embedPath || "/embeddings";
|
|
5145
|
+
if (!this.opts.embedPayloadTemplate) {
|
|
5146
|
+
try {
|
|
5147
|
+
const payload = {
|
|
5148
|
+
model: modelToUse,
|
|
5149
|
+
input: formattedTexts
|
|
5150
|
+
};
|
|
5151
|
+
const { data } = await this.http.post(path2, payload);
|
|
5152
|
+
const batchVectors = this.extractBatchVectors(data);
|
|
5153
|
+
if (batchVectors && batchVectors.length === texts.length) {
|
|
5154
|
+
return batchVectors;
|
|
5155
|
+
}
|
|
5156
|
+
} catch (e) {
|
|
5157
|
+
}
|
|
5158
|
+
}
|
|
5159
|
+
return Promise.all(texts.map((text) => this.embed(text, options)));
|
|
5160
|
+
}
|
|
5161
|
+
/**
|
|
5162
|
+
* Ping provider endpoint for health check.
|
|
5163
|
+
*/
|
|
5164
|
+
async ping() {
|
|
5165
|
+
try {
|
|
5166
|
+
const pingPath = this.opts.pingPath || "/health";
|
|
5167
|
+
const res = await this.http.get(pingPath);
|
|
5168
|
+
return res.status >= 200 && res.status < 300;
|
|
5169
|
+
} catch (e) {
|
|
5170
|
+
try {
|
|
5171
|
+
const embedPath = this.opts.embedPath || "/embeddings";
|
|
5172
|
+
await this.http.post(embedPath, { input: "ping", model: this.model });
|
|
5173
|
+
return true;
|
|
5174
|
+
} catch (e2) {
|
|
5175
|
+
return false;
|
|
5176
|
+
}
|
|
5177
|
+
}
|
|
5178
|
+
}
|
|
5179
|
+
extractVector(data) {
|
|
5180
|
+
if (!data) return void 0;
|
|
5181
|
+
if (this.opts.embedExtractPath) {
|
|
5182
|
+
const extracted = resolvePath(data, this.opts.embedExtractPath);
|
|
5183
|
+
if (Array.isArray(extracted) && typeof extracted[0] === "number") {
|
|
5184
|
+
return extracted;
|
|
5185
|
+
}
|
|
5186
|
+
}
|
|
5187
|
+
const directVector = resolvePath(data, "data[0].embedding") || resolvePath(data, "embedding") || resolvePath(data, "embeddings[0]") || resolvePath(data, "data[0].vector") || resolvePath(data, "vector");
|
|
5188
|
+
if (Array.isArray(directVector) && typeof directVector[0] === "number") {
|
|
5189
|
+
return directVector;
|
|
5190
|
+
}
|
|
5191
|
+
if (Array.isArray(data) && typeof data[0] === "number") {
|
|
5192
|
+
return data;
|
|
5193
|
+
}
|
|
5194
|
+
return void 0;
|
|
5195
|
+
}
|
|
5196
|
+
extractBatchVectors(data) {
|
|
5197
|
+
if (!data) return void 0;
|
|
5198
|
+
if (typeof data === "object" && data !== null && Array.isArray(data.data)) {
|
|
5199
|
+
const list = data.data;
|
|
5200
|
+
const vectors = list.map((item) => (item == null ? void 0 : item.embedding) || (item == null ? void 0 : item.vector)).filter((v) => Array.isArray(v));
|
|
5201
|
+
if (vectors.length > 0) return vectors;
|
|
5202
|
+
}
|
|
5203
|
+
if (Array.isArray(data) && Array.isArray(data[0]) && typeof data[0][0] === "number") {
|
|
5204
|
+
return data;
|
|
5205
|
+
}
|
|
5206
|
+
return void 0;
|
|
5207
|
+
}
|
|
5208
|
+
};
|
|
5209
|
+
|
|
5050
5210
|
// src/llm/LLMFactory.ts
|
|
5051
5211
|
var customProviders = /* @__PURE__ */ new Map();
|
|
5052
5212
|
var LLMFactory = class _LLMFactory {
|
|
@@ -5089,6 +5249,8 @@ var LLMFactory = class _LLMFactory {
|
|
|
5089
5249
|
"rest",
|
|
5090
5250
|
"universal_rest",
|
|
5091
5251
|
"custom",
|
|
5252
|
+
"custom_embedding",
|
|
5253
|
+
"local_embedding",
|
|
5092
5254
|
...Array.from(customProviders.keys())
|
|
5093
5255
|
];
|
|
5094
5256
|
}
|
|
@@ -5107,6 +5269,9 @@ var LLMFactory = class _LLMFactory {
|
|
|
5107
5269
|
return new GroqProvider(llmConfig, embeddingConfig);
|
|
5108
5270
|
case "qwen":
|
|
5109
5271
|
return new QwenProvider(llmConfig, embeddingConfig);
|
|
5272
|
+
case "custom_embedding":
|
|
5273
|
+
case "local_embedding":
|
|
5274
|
+
return new CustomEmbeddingProvider(llmConfig);
|
|
5110
5275
|
case "rest":
|
|
5111
5276
|
case "universal_rest":
|
|
5112
5277
|
case "custom":
|
|
@@ -12582,7 +12747,7 @@ _LicenseValidator.SUCCESS_CACHE_TTL_MS = 5 * 60 * 1e3;
|
|
|
12582
12747
|
var LicenseValidator = _LicenseValidator;
|
|
12583
12748
|
|
|
12584
12749
|
// src/config/LicenseConfigResolver.ts
|
|
12585
|
-
var
|
|
12750
|
+
var import_axios10 = __toESM(require("axios"));
|
|
12586
12751
|
var LicenseConfigResolver = class {
|
|
12587
12752
|
/**
|
|
12588
12753
|
* Validate and resolve configuration from license key
|
|
@@ -12606,7 +12771,7 @@ var LicenseConfigResolver = class {
|
|
|
12606
12771
|
*/
|
|
12607
12772
|
static async fetchTierConfig(licenseKey, projectId) {
|
|
12608
12773
|
try {
|
|
12609
|
-
const response = await
|
|
12774
|
+
const response = await import_axios10.default.post(
|
|
12610
12775
|
this.RETRIVORA_CONFIG_URL,
|
|
12611
12776
|
{ licenseKey, projectId },
|
|
12612
12777
|
{
|
|
@@ -12637,7 +12802,7 @@ var LicenseConfigResolver = class {
|
|
|
12637
12802
|
*/
|
|
12638
12803
|
static async fetchProviderCredentials(licenseKey, projectId) {
|
|
12639
12804
|
try {
|
|
12640
|
-
const response = await
|
|
12805
|
+
const response = await import_axios10.default.post(
|
|
12641
12806
|
this.RETRIVORA_CREDENTIALS_URL,
|
|
12642
12807
|
{ licenseKey, projectId },
|
|
12643
12808
|
{
|
|
@@ -12835,12 +13000,12 @@ var _TelemetryService = class _TelemetryService {
|
|
|
12835
13000
|
});
|
|
12836
13001
|
}
|
|
12837
13002
|
/**
|
|
12838
|
-
* Record query execution event
|
|
13003
|
+
* Record query execution event (PII-safe)
|
|
12839
13004
|
*/
|
|
12840
13005
|
recordQueryExecuted(data) {
|
|
12841
13006
|
this.recordEvent({
|
|
12842
13007
|
eventType: "query_executed" /* QUERY_EXECUTED */,
|
|
12843
|
-
|
|
13008
|
+
queryLength: data.queryLength,
|
|
12844
13009
|
resultCount: data.resultCount,
|
|
12845
13010
|
durationMs: data.durationMs,
|
|
12846
13011
|
operationId: data.operationId
|
|
@@ -13086,7 +13251,7 @@ var LicensedRetrivora = class {
|
|
|
13086
13251
|
const durationMs = Date.now() - startTime;
|
|
13087
13252
|
if (telemetry) {
|
|
13088
13253
|
telemetry.recordQueryExecuted({
|
|
13089
|
-
queryText,
|
|
13254
|
+
queryLength: queryText.length,
|
|
13090
13255
|
resultCount: ((_a2 = response.sources) == null ? void 0 : _a2.length) || 0,
|
|
13091
13256
|
durationMs,
|
|
13092
13257
|
operationId
|
|
@@ -13168,6 +13333,7 @@ async function createRetrivora(options) {
|
|
|
13168
13333
|
ConfigResolver,
|
|
13169
13334
|
ConfigValidator,
|
|
13170
13335
|
ConfigurationException,
|
|
13336
|
+
CustomEmbeddingProvider,
|
|
13171
13337
|
DocumentChunker,
|
|
13172
13338
|
DocumentParser,
|
|
13173
13339
|
EmbeddingFailedException,
|