@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.
@@ -312,7 +312,7 @@ var init_package = __esm({
312
312
  "package.json"() {
313
313
  package_default = {
314
314
  name: "@retrivora-ai/rag-engine",
315
- version: "2.5.5",
315
+ version: "2.5.6",
316
316
  description: "Retrivora AI is a plug-and-play AI engine for RAG chat experiences \u2014 generic vector DB + LLM provider, embeddable or standalone.",
317
317
  author: "Abhinav Alkuchi",
318
318
  license: "UNLICENSED",
@@ -1756,7 +1756,7 @@ var MilvusProvider_exports = {};
1756
1756
  __export(MilvusProvider_exports, {
1757
1757
  MilvusProvider: () => MilvusProvider
1758
1758
  });
1759
- import axios3 from "axios";
1759
+ import axios4 from "axios";
1760
1760
  var MilvusProvider;
1761
1761
  var init_MilvusProvider = __esm({
1762
1762
  "src/providers/vectordb/MilvusProvider.ts"() {
@@ -1768,7 +1768,7 @@ var init_MilvusProvider = __esm({
1768
1768
  const opts = config.options;
1769
1769
  const baseUrl = opts.baseUrl || opts.uri || (opts.host ? `http://${opts.host}:${opts.port || 19530}` : void 0);
1770
1770
  if (!baseUrl) throw new Error("[MilvusProvider] options.baseUrl (or uri / host+port) is required");
1771
- this.http = axios3.create({
1771
+ this.http = axios4.create({
1772
1772
  baseURL: baseUrl,
1773
1773
  headers: __spreadValues(__spreadValues({
1774
1774
  "Content-Type": "application/json"
@@ -1869,7 +1869,7 @@ var QdrantProvider_exports = {};
1869
1869
  __export(QdrantProvider_exports, {
1870
1870
  QdrantProvider: () => QdrantProvider
1871
1871
  });
1872
- import axios4 from "axios";
1872
+ import axios5 from "axios";
1873
1873
  import crypto from "crypto";
1874
1874
  var QdrantProvider;
1875
1875
  var init_QdrantProvider = __esm({
@@ -1886,7 +1886,7 @@ var init_QdrantProvider = __esm({
1886
1886
  this.contentField = opts.contentField || "content";
1887
1887
  this.metadataField = opts.metadataField || "metadata";
1888
1888
  this.isFlatPayload = !!opts.flatPayload;
1889
- this.http = axios4.create({
1889
+ this.http = axios5.create({
1890
1890
  baseURL: baseUrl,
1891
1891
  timeout: 15e3,
1892
1892
  // 15s timeout for vector DB operations
@@ -1954,7 +1954,7 @@ var init_QdrantProvider = __esm({
1954
1954
  try {
1955
1955
  await this.http.get(`/collections/${this.indexName}`);
1956
1956
  } catch (err) {
1957
- if (axios4.isAxiosError(err) && ((_a2 = err.response) == null ? void 0 : _a2.status) === 404) {
1957
+ if (axios5.isAxiosError(err) && ((_a2 = err.response) == null ? void 0 : _a2.status) === 404) {
1958
1958
  const opts = this.config.options;
1959
1959
  const dimensionsForCreate = opts.dimensions || 1536;
1960
1960
  await this.http.put(`/collections/${this.indexName}`, {
@@ -1984,7 +1984,7 @@ var init_QdrantProvider = __esm({
1984
1984
  });
1985
1985
  } catch (err) {
1986
1986
  let status;
1987
- if (axios4.isAxiosError(err)) status = (_a2 = err.response) == null ? void 0 : _a2.status;
1987
+ if (axios5.isAxiosError(err)) status = (_a2 = err.response) == null ? void 0 : _a2.status;
1988
1988
  if (status === 409) return;
1989
1989
  console.warn(`[QdrantProvider] \u26A0\uFE0F Could not ensure index for "${fullPath}":`, err instanceof Error ? err.message : String(err));
1990
1990
  }
@@ -2108,7 +2108,7 @@ var ChromaDBProvider_exports = {};
2108
2108
  __export(ChromaDBProvider_exports, {
2109
2109
  ChromaDBProvider: () => ChromaDBProvider
2110
2110
  });
2111
- import axios5 from "axios";
2111
+ import axios6 from "axios";
2112
2112
  var ChromaDBProvider;
2113
2113
  var init_ChromaDBProvider = __esm({
2114
2114
  "src/providers/vectordb/ChromaDBProvider.ts"() {
@@ -2121,7 +2121,7 @@ var init_ChromaDBProvider = __esm({
2121
2121
  const opts = config.options;
2122
2122
  const baseUrl = opts.baseUrl || (opts.host ? `http://${opts.host}:${opts.port || 8e3}` : void 0);
2123
2123
  if (!baseUrl) throw new Error("[ChromaDBProvider] options.baseUrl is required");
2124
- this.http = axios5.create({
2124
+ this.http = axios6.create({
2125
2125
  baseURL: baseUrl,
2126
2126
  headers: { "Content-Type": "application/json" }
2127
2127
  });
@@ -2135,7 +2135,7 @@ var init_ChromaDBProvider = __esm({
2135
2135
  const { data } = await this.http.get(`/api/v1/collections/${this.indexName}`);
2136
2136
  this.collectionId = data.id;
2137
2137
  } catch (err) {
2138
- if (axios5.isAxiosError(err) && ((_a2 = err.response) == null ? void 0 : _a2.status) === 404) {
2138
+ if (axios6.isAxiosError(err) && ((_a2 = err.response) == null ? void 0 : _a2.status) === 404) {
2139
2139
  const { data } = await this.http.post("/api/v1/collections", {
2140
2140
  name: this.indexName
2141
2141
  });
@@ -2216,7 +2216,7 @@ var RedisProvider_exports = {};
2216
2216
  __export(RedisProvider_exports, {
2217
2217
  RedisProvider: () => RedisProvider
2218
2218
  });
2219
- import axios6 from "axios";
2219
+ import axios7 from "axios";
2220
2220
  var RedisProvider;
2221
2221
  var init_RedisProvider = __esm({
2222
2222
  "src/providers/vectordb/RedisProvider.ts"() {
@@ -2228,7 +2228,7 @@ var init_RedisProvider = __esm({
2228
2228
  const opts = config.options;
2229
2229
  const baseUrl = opts.baseUrl || opts.url || (opts.host ? `http://${opts.host}:${opts.port || 6379}` : void 0);
2230
2230
  if (!baseUrl) throw new Error("[RedisProvider] options.baseUrl is required");
2231
- this.http = axios6.create({
2231
+ this.http = axios7.create({
2232
2232
  baseURL: baseUrl,
2233
2233
  headers: __spreadValues({
2234
2234
  "Content-Type": "application/json"
@@ -2298,7 +2298,7 @@ var WeaviateProvider_exports = {};
2298
2298
  __export(WeaviateProvider_exports, {
2299
2299
  WeaviateProvider: () => WeaviateProvider
2300
2300
  });
2301
- import axios7 from "axios";
2301
+ import axios8 from "axios";
2302
2302
  var WeaviateProvider;
2303
2303
  var init_WeaviateProvider = __esm({
2304
2304
  "src/providers/vectordb/WeaviateProvider.ts"() {
@@ -2310,7 +2310,7 @@ var init_WeaviateProvider = __esm({
2310
2310
  const opts = config.options;
2311
2311
  const baseUrl = opts.baseUrl || opts.url;
2312
2312
  if (!baseUrl) throw new Error("[WeaviateProvider] options.baseUrl is required");
2313
- this.http = axios7.create({
2313
+ this.http = axios8.create({
2314
2314
  baseURL: baseUrl,
2315
2315
  headers: __spreadValues(__spreadValues({
2316
2316
  "Content-Type": "application/json"
@@ -2450,7 +2450,7 @@ var UniversalVectorProvider_exports = {};
2450
2450
  __export(UniversalVectorProvider_exports, {
2451
2451
  UniversalVectorProvider: () => UniversalVectorProvider
2452
2452
  });
2453
- import axios8 from "axios";
2453
+ import axios9 from "axios";
2454
2454
  var UniversalVectorProvider;
2455
2455
  var init_UniversalVectorProvider = __esm({
2456
2456
  "src/providers/vectordb/UniversalVectorProvider.ts"() {
@@ -2467,7 +2467,7 @@ var init_UniversalVectorProvider = __esm({
2467
2467
  }
2468
2468
  async initialize() {
2469
2469
  var _a2;
2470
- this.http = axios8.create({
2470
+ this.http = axios9.create({
2471
2471
  baseURL: this.opts.baseUrl,
2472
2472
  headers: __spreadValues({
2473
2473
  "Content-Type": "application/json"
@@ -3040,7 +3040,9 @@ var LLM_PROVIDERS = [
3040
3040
  "qwen",
3041
3041
  "rest",
3042
3042
  "universal_rest",
3043
- "custom"
3043
+ "custom",
3044
+ "custom_embedding",
3045
+ "local_embedding"
3044
3046
  ];
3045
3047
  var EMBEDDING_PROVIDERS = [
3046
3048
  "openai",
@@ -3049,7 +3051,9 @@ var EMBEDDING_PROVIDERS = [
3049
3051
  "qwen",
3050
3052
  "rest",
3051
3053
  "universal_rest",
3052
- "custom"
3054
+ "custom",
3055
+ "custom_embedding",
3056
+ "local_embedding"
3053
3057
  ];
3054
3058
  var PROVIDERS_WITH_EMBEDDINGS = [
3055
3059
  "openai",
@@ -3057,7 +3061,10 @@ var PROVIDERS_WITH_EMBEDDINGS = [
3057
3061
  "gemini",
3058
3062
  "qwen",
3059
3063
  "rest",
3060
- "universal_rest"
3064
+ "universal_rest",
3065
+ "custom",
3066
+ "custom_embedding",
3067
+ "local_embedding"
3061
3068
  ];
3062
3069
 
3063
3070
  // src/config/serverConfig.ts
@@ -3794,8 +3801,8 @@ var OllamaProvider = class {
3794
3801
  const baseUrl = config.baseUrl || "http://localhost:11434";
3795
3802
  const modelName = config.model;
3796
3803
  try {
3797
- const axios9 = (await import("axios")).default;
3798
- const { data } = await axios9.get(`${baseUrl}/api/tags`);
3804
+ const axios10 = (await import("axios")).default;
3805
+ const { data } = await axios10.get(`${baseUrl}/api/tags`);
3799
3806
  const models = data.models || [];
3800
3807
  const hasModel = models.some((m) => m.name === modelName || m.name.startsWith(`${modelName}:`));
3801
3808
  return {
@@ -4873,6 +4880,158 @@ ${context != null ? context : "None"}` },
4873
4880
  }
4874
4881
  };
4875
4882
 
4883
+ // src/llm/providers/CustomEmbeddingProvider.ts
4884
+ init_templateUtils();
4885
+ import axios3 from "axios";
4886
+ var CustomEmbeddingProvider = class {
4887
+ constructor(config) {
4888
+ var _a2, _b;
4889
+ this.model = config.model || "custom-embedding-model";
4890
+ this.apiKey = config.apiKey;
4891
+ const options = (_a2 = config.options) != null ? _a2 : {};
4892
+ this.opts = {
4893
+ baseUrl: config.baseUrl || options.baseUrl,
4894
+ embedPath: options.embedPath || "/embeddings",
4895
+ pingPath: options.pingPath || "/health",
4896
+ queryPrefix: options.queryPrefix || "",
4897
+ documentPrefix: options.documentPrefix || "",
4898
+ embedPayloadTemplate: options.embedPayloadTemplate,
4899
+ embedExtractPath: options.embedExtractPath,
4900
+ headers: options.headers || {},
4901
+ timeout: options.timeout || 3e4
4902
+ };
4903
+ this.baseUrl = (_b = this.opts.baseUrl) != null ? _b : "";
4904
+ if (!this.baseUrl) {
4905
+ throw new Error("[CustomEmbeddingProvider] baseUrl is required in config or config.options");
4906
+ }
4907
+ const headers = __spreadValues(__spreadValues({
4908
+ "Content-Type": "application/json"
4909
+ }, this.apiKey ? { Authorization: `Bearer ${this.apiKey}` } : {}), this.opts.headers || {});
4910
+ this.http = axios3.create({
4911
+ baseURL: this.baseUrl.replace(/\/$/, ""),
4912
+ headers,
4913
+ timeout: this.opts.timeout
4914
+ });
4915
+ }
4916
+ /**
4917
+ * Dummy chat implementation. CustomEmbeddingProvider is dedicated to embedding generation.
4918
+ */
4919
+ async chat(_messages, _context, _options) {
4920
+ throw new Error("[CustomEmbeddingProvider] chat() is not supported on a dedicated embedding provider.");
4921
+ }
4922
+ /**
4923
+ * Generate vector embedding for a single string.
4924
+ */
4925
+ async embed(text, options) {
4926
+ var _a2;
4927
+ const taskType = (_a2 = options == null ? void 0 : options.taskType) != null ? _a2 : "document";
4928
+ const prefix = taskType === "query" ? this.opts.queryPrefix : this.opts.documentPrefix;
4929
+ const formattedText = prefix ? `${prefix}${text}` : text;
4930
+ const modelToUse = (options == null ? void 0 : options.model) || this.model;
4931
+ const path2 = this.opts.embedPath || "/embeddings";
4932
+ let payload;
4933
+ if (this.opts.embedPayloadTemplate) {
4934
+ payload = buildPayload(this.opts.embedPayloadTemplate, {
4935
+ input: formattedText,
4936
+ model: modelToUse
4937
+ });
4938
+ } else {
4939
+ payload = {
4940
+ model: modelToUse,
4941
+ input: formattedText
4942
+ };
4943
+ }
4944
+ try {
4945
+ const { data } = await this.http.post(path2, payload);
4946
+ const vector = this.extractVector(data);
4947
+ if (vector) return vector;
4948
+ throw new Error(`[CustomEmbeddingProvider] Failed to extract embedding vector from response at ${path2}`);
4949
+ } catch (err) {
4950
+ console.error("[CustomEmbeddingProvider] Embedding request failed:", {
4951
+ baseUrl: this.baseUrl,
4952
+ path: path2,
4953
+ model: modelToUse,
4954
+ error: (err == null ? void 0 : err.message) || err
4955
+ });
4956
+ throw err;
4957
+ }
4958
+ }
4959
+ /**
4960
+ * Batch embedding generation for multiple texts.
4961
+ */
4962
+ async batchEmbed(texts, options) {
4963
+ var _a2;
4964
+ if (!Array.isArray(texts) || texts.length === 0) return [];
4965
+ const taskType = (_a2 = options == null ? void 0 : options.taskType) != null ? _a2 : "document";
4966
+ const prefix = taskType === "query" ? this.opts.queryPrefix : this.opts.documentPrefix;
4967
+ const formattedTexts = prefix ? texts.map((t) => `${prefix}${t}`) : texts;
4968
+ const modelToUse = (options == null ? void 0 : options.model) || this.model;
4969
+ const path2 = this.opts.embedPath || "/embeddings";
4970
+ if (!this.opts.embedPayloadTemplate) {
4971
+ try {
4972
+ const payload = {
4973
+ model: modelToUse,
4974
+ input: formattedTexts
4975
+ };
4976
+ const { data } = await this.http.post(path2, payload);
4977
+ const batchVectors = this.extractBatchVectors(data);
4978
+ if (batchVectors && batchVectors.length === texts.length) {
4979
+ return batchVectors;
4980
+ }
4981
+ } catch (e) {
4982
+ }
4983
+ }
4984
+ return Promise.all(texts.map((text) => this.embed(text, options)));
4985
+ }
4986
+ /**
4987
+ * Ping provider endpoint for health check.
4988
+ */
4989
+ async ping() {
4990
+ try {
4991
+ const pingPath = this.opts.pingPath || "/health";
4992
+ const res = await this.http.get(pingPath);
4993
+ return res.status >= 200 && res.status < 300;
4994
+ } catch (e) {
4995
+ try {
4996
+ const embedPath = this.opts.embedPath || "/embeddings";
4997
+ await this.http.post(embedPath, { input: "ping", model: this.model });
4998
+ return true;
4999
+ } catch (e2) {
5000
+ return false;
5001
+ }
5002
+ }
5003
+ }
5004
+ extractVector(data) {
5005
+ if (!data) return void 0;
5006
+ if (this.opts.embedExtractPath) {
5007
+ const extracted = resolvePath(data, this.opts.embedExtractPath);
5008
+ if (Array.isArray(extracted) && typeof extracted[0] === "number") {
5009
+ return extracted;
5010
+ }
5011
+ }
5012
+ const directVector = resolvePath(data, "data[0].embedding") || resolvePath(data, "embedding") || resolvePath(data, "embeddings[0]") || resolvePath(data, "data[0].vector") || resolvePath(data, "vector");
5013
+ if (Array.isArray(directVector) && typeof directVector[0] === "number") {
5014
+ return directVector;
5015
+ }
5016
+ if (Array.isArray(data) && typeof data[0] === "number") {
5017
+ return data;
5018
+ }
5019
+ return void 0;
5020
+ }
5021
+ extractBatchVectors(data) {
5022
+ if (!data) return void 0;
5023
+ if (typeof data === "object" && data !== null && Array.isArray(data.data)) {
5024
+ const list = data.data;
5025
+ const vectors = list.map((item) => (item == null ? void 0 : item.embedding) || (item == null ? void 0 : item.vector)).filter((v) => Array.isArray(v));
5026
+ if (vectors.length > 0) return vectors;
5027
+ }
5028
+ if (Array.isArray(data) && Array.isArray(data[0]) && typeof data[0][0] === "number") {
5029
+ return data;
5030
+ }
5031
+ return void 0;
5032
+ }
5033
+ };
5034
+
4876
5035
  // src/llm/LLMFactory.ts
4877
5036
  var customProviders = /* @__PURE__ */ new Map();
4878
5037
  var LLMFactory = class _LLMFactory {
@@ -4915,6 +5074,8 @@ var LLMFactory = class _LLMFactory {
4915
5074
  "rest",
4916
5075
  "universal_rest",
4917
5076
  "custom",
5077
+ "custom_embedding",
5078
+ "local_embedding",
4918
5079
  ...Array.from(customProviders.keys())
4919
5080
  ];
4920
5081
  }
@@ -4933,6 +5094,9 @@ var LLMFactory = class _LLMFactory {
4933
5094
  return new GroqProvider(llmConfig, embeddingConfig);
4934
5095
  case "qwen":
4935
5096
  return new QwenProvider(llmConfig, embeddingConfig);
5097
+ case "custom_embedding":
5098
+ case "local_embedding":
5099
+ return new CustomEmbeddingProvider(llmConfig);
4936
5100
  case "rest":
4937
5101
  case "universal_rest":
4938
5102
  case "custom":
@@ -1,5 +1,5 @@
1
1
  import { CSSProperties, MouseEvent, ReactNode, ElementType } from 'react';
2
- import { W as WidgetPosition, P as Product, u as UIConfig, c as ProjectChatSettings, q as RagMessage, y as VectorMatch, p as RagConfig, I as ILLMProvider, h as IngestDocument, C as ChatMessage, e as ChatResponse, _ as RetrievalResult, v as UniversalRagConfig, U as UITransformationResponse, L as LLMConfig, f as EmbeddingConfig, V as VectorDBConfig } from './ILLMProvider-DO5gj-e5.mjs';
2
+ import { W as WidgetPosition, P as Product, u as UIConfig, c as ProjectChatSettings, q as RagMessage, y as VectorMatch, p as RagConfig, I as ILLMProvider, h as IngestDocument, C as ChatMessage, e as ChatResponse, _ as RetrievalResult, v as UniversalRagConfig, U as UITransformationResponse, L as LLMConfig, f as EmbeddingConfig, V as VectorDBConfig } from './ILLMProvider-DwFj0h2u.mjs';
3
3
 
4
4
  interface ArchitectureCardProps {
5
5
  icon: ReactNode;
@@ -1,5 +1,5 @@
1
1
  import { NextRequest } from 'next/server';
2
- import { p as RagConfig, I as ILLMProvider, C as ChatMessage, e as ChatResponse, h as IngestDocument } from './ILLMProvider-DO5gj-e5.js';
2
+ import { p as RagConfig, I as ILLMProvider, C as ChatMessage, e as ChatResponse, h as IngestDocument } from './ILLMProvider-DwFj0h2u.js';
3
3
 
4
4
  interface ValidationError {
5
5
  field: string;
@@ -1,5 +1,5 @@
1
1
  import { NextRequest } from 'next/server';
2
- import { p as RagConfig, I as ILLMProvider, C as ChatMessage, e as ChatResponse, h as IngestDocument } from './ILLMProvider-DO5gj-e5.mjs';
2
+ import { p as RagConfig, I as ILLMProvider, C as ChatMessage, e as ChatResponse, h as IngestDocument } from './ILLMProvider-DwFj0h2u.mjs';
3
3
 
4
4
  interface ValidationError {
5
5
  field: string;
@@ -1,5 +1,5 @@
1
1
  import { CSSProperties, MouseEvent, ReactNode, ElementType } from 'react';
2
- import { W as WidgetPosition, P as Product, u as UIConfig, c as ProjectChatSettings, q as RagMessage, y as VectorMatch, p as RagConfig, I as ILLMProvider, h as IngestDocument, C as ChatMessage, e as ChatResponse, _ as RetrievalResult, v as UniversalRagConfig, U as UITransformationResponse, L as LLMConfig, f as EmbeddingConfig, V as VectorDBConfig } from './ILLMProvider-DO5gj-e5.js';
2
+ import { W as WidgetPosition, P as Product, u as UIConfig, c as ProjectChatSettings, q as RagMessage, y as VectorMatch, p as RagConfig, I as ILLMProvider, h as IngestDocument, C as ChatMessage, e as ChatResponse, _ as RetrievalResult, v as UniversalRagConfig, U as UITransformationResponse, L as LLMConfig, f as EmbeddingConfig, V as VectorDBConfig } from './ILLMProvider-DwFj0h2u.js';
3
3
 
4
4
  interface ArchitectureCardProps {
5
5
  icon: ReactNode;
package/dist/index.d.mts CHANGED
@@ -1,8 +1,8 @@
1
1
  import React from 'react';
2
- import { C as ChatWidgetProps, a as ChatWindowProps, D as DocumentUploadProps, M as MessageBubbleProps, S as SourceCardProps, b as ConfigProviderProps, c as ClientConfig, P as ProductCardProps, d as ProductCarouselProps, e as ChatViewportSize, R as RemoteConfig } from './index-BKOyhayB.mjs';
3
- export { A as AuthenticationException, B as BatchOptions, f as BatchProcessor, g as BatchResult, h as ChartType, i as Chunk, j as ChunkOptions, k as CircuitBreaker, l as CircuitBreakerOptions, m as ConfigFetcher, n as ConfigurationException, o as DecisionContext, E as EmbeddingFailedException, I as IRenderRule, p as IRendererStrategy, q as IntentCategory, L as LicenseTierConfig, r as LicenseValidationError, s as LicenseValidationRequest, t as LicenseValidationResponse, u as LicenseValidator, v as ProviderCredentials, w as ProviderNotFoundException, x as RateLimitException, y as RemoteEmbeddingConfig, z as RemoteLLMConfig, F as RemoteVectorConfig, G as RenderDecision, H as RenderType, J as RetrievalException, K as Retrivora, N as RetrivoraError, O as RetrivoraErrorCode, Q as SDKVersionUnsupportedError, T as SDK_VERSION, U as isTransientError } from './index-BKOyhayB.mjs';
4
- import { O as ObservabilityTrace, P as Product, U as UITransformationResponse, a as UseRagChatOptions, b as UseRagChatReturn, c as ProjectChatSettings } from './ILLMProvider-DO5gj-e5.mjs';
5
- export { A as AuthMode, C as ChatMessage, d as ChatOptions, e as ChatResponse, E as EmbedOptions, f as EmbeddingConfig, g as EmbeddingProvider, I as ILLMProvider, h as IngestDocument, L as LLMConfig, i as LLMProvider, j as LatencyBreakdown, k as ProjectAiSettings, l as ProjectAuthSettings, m as ProjectBrandingSettings, n as ProjectTelemetrySettings, o as ProjectWidgetSettings, R as RAGConfig, p as RagConfig, q as RagMessage, r as RetrievalConfig, s as RetrievedChunk, T as ThemeMode, t as TokenUsage, u as UIConfig, v as UniversalRagConfig, w as UpsertDocument, V as VectorDBConfig, x as VectorDBProvider, y as VectorMatch, W as WidgetPosition, z as WorkflowConfig, B as createDefaultProjectSettings, D as normalizeProjectSettings, F as projectSettingsToUiConfig } from './ILLMProvider-DO5gj-e5.mjs';
2
+ import { C as ChatWidgetProps, a as ChatWindowProps, D as DocumentUploadProps, M as MessageBubbleProps, S as SourceCardProps, b as ConfigProviderProps, c as ClientConfig, P as ProductCardProps, d as ProductCarouselProps, e as ChatViewportSize, R as RemoteConfig } from './index-Byv5MaYi.mjs';
3
+ export { A as AuthenticationException, B as BatchOptions, f as BatchProcessor, g as BatchResult, h as ChartType, i as Chunk, j as ChunkOptions, k as CircuitBreaker, l as CircuitBreakerOptions, m as ConfigFetcher, n as ConfigurationException, o as DecisionContext, E as EmbeddingFailedException, I as IRenderRule, p as IRendererStrategy, q as IntentCategory, L as LicenseTierConfig, r as LicenseValidationError, s as LicenseValidationRequest, t as LicenseValidationResponse, u as LicenseValidator, v as ProviderCredentials, w as ProviderNotFoundException, x as RateLimitException, y as RemoteEmbeddingConfig, z as RemoteLLMConfig, F as RemoteVectorConfig, G as RenderDecision, H as RenderType, J as RetrievalException, K as Retrivora, N as RetrivoraError, O as RetrivoraErrorCode, Q as SDKVersionUnsupportedError, T as SDK_VERSION, U as isTransientError } from './index-Byv5MaYi.mjs';
4
+ import { O as ObservabilityTrace, P as Product, U as UITransformationResponse, a as UseRagChatOptions, b as UseRagChatReturn, c as ProjectChatSettings } from './ILLMProvider-DwFj0h2u.mjs';
5
+ export { A as AuthMode, C as ChatMessage, d as ChatOptions, e as ChatResponse, E as EmbedOptions, f as EmbeddingConfig, g as EmbeddingProvider, I as ILLMProvider, h as IngestDocument, L as LLMConfig, i as LLMProvider, j as LatencyBreakdown, k as ProjectAiSettings, l as ProjectAuthSettings, m as ProjectBrandingSettings, n as ProjectTelemetrySettings, o as ProjectWidgetSettings, R as RAGConfig, p as RagConfig, q as RagMessage, r as RetrievalConfig, s as RetrievedChunk, T as ThemeMode, t as TokenUsage, u as UIConfig, v as UniversalRagConfig, w as UpsertDocument, V as VectorDBConfig, x as VectorDBProvider, y as VectorMatch, W as WidgetPosition, z as WorkflowConfig, B as createDefaultProjectSettings, D as normalizeProjectSettings, F as projectSettingsToUiConfig } from './ILLMProvider-DwFj0h2u.mjs';
6
6
 
7
7
  /**
8
8
  * ChatWidget — Floating Action Button (FAB) that toggles the chat window.
package/dist/index.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import React from 'react';
2
- import { C as ChatWidgetProps, a as ChatWindowProps, D as DocumentUploadProps, M as MessageBubbleProps, S as SourceCardProps, b as ConfigProviderProps, c as ClientConfig, P as ProductCardProps, d as ProductCarouselProps, e as ChatViewportSize, R as RemoteConfig } from './index-8vijDPfT.js';
3
- export { A as AuthenticationException, B as BatchOptions, f as BatchProcessor, g as BatchResult, h as ChartType, i as Chunk, j as ChunkOptions, k as CircuitBreaker, l as CircuitBreakerOptions, m as ConfigFetcher, n as ConfigurationException, o as DecisionContext, E as EmbeddingFailedException, I as IRenderRule, p as IRendererStrategy, q as IntentCategory, L as LicenseTierConfig, r as LicenseValidationError, s as LicenseValidationRequest, t as LicenseValidationResponse, u as LicenseValidator, v as ProviderCredentials, w as ProviderNotFoundException, x as RateLimitException, y as RemoteEmbeddingConfig, z as RemoteLLMConfig, F as RemoteVectorConfig, G as RenderDecision, H as RenderType, J as RetrievalException, K as Retrivora, N as RetrivoraError, O as RetrivoraErrorCode, Q as SDKVersionUnsupportedError, T as SDK_VERSION, U as isTransientError } from './index-8vijDPfT.js';
4
- import { O as ObservabilityTrace, P as Product, U as UITransformationResponse, a as UseRagChatOptions, b as UseRagChatReturn, c as ProjectChatSettings } from './ILLMProvider-DO5gj-e5.js';
5
- export { A as AuthMode, C as ChatMessage, d as ChatOptions, e as ChatResponse, E as EmbedOptions, f as EmbeddingConfig, g as EmbeddingProvider, I as ILLMProvider, h as IngestDocument, L as LLMConfig, i as LLMProvider, j as LatencyBreakdown, k as ProjectAiSettings, l as ProjectAuthSettings, m as ProjectBrandingSettings, n as ProjectTelemetrySettings, o as ProjectWidgetSettings, R as RAGConfig, p as RagConfig, q as RagMessage, r as RetrievalConfig, s as RetrievedChunk, T as ThemeMode, t as TokenUsage, u as UIConfig, v as UniversalRagConfig, w as UpsertDocument, V as VectorDBConfig, x as VectorDBProvider, y as VectorMatch, W as WidgetPosition, z as WorkflowConfig, B as createDefaultProjectSettings, D as normalizeProjectSettings, F as projectSettingsToUiConfig } from './ILLMProvider-DO5gj-e5.js';
2
+ import { C as ChatWidgetProps, a as ChatWindowProps, D as DocumentUploadProps, M as MessageBubbleProps, S as SourceCardProps, b as ConfigProviderProps, c as ClientConfig, P as ProductCardProps, d as ProductCarouselProps, e as ChatViewportSize, R as RemoteConfig } from './index-DP3_OpuB.js';
3
+ export { A as AuthenticationException, B as BatchOptions, f as BatchProcessor, g as BatchResult, h as ChartType, i as Chunk, j as ChunkOptions, k as CircuitBreaker, l as CircuitBreakerOptions, m as ConfigFetcher, n as ConfigurationException, o as DecisionContext, E as EmbeddingFailedException, I as IRenderRule, p as IRendererStrategy, q as IntentCategory, L as LicenseTierConfig, r as LicenseValidationError, s as LicenseValidationRequest, t as LicenseValidationResponse, u as LicenseValidator, v as ProviderCredentials, w as ProviderNotFoundException, x as RateLimitException, y as RemoteEmbeddingConfig, z as RemoteLLMConfig, F as RemoteVectorConfig, G as RenderDecision, H as RenderType, J as RetrievalException, K as Retrivora, N as RetrivoraError, O as RetrivoraErrorCode, Q as SDKVersionUnsupportedError, T as SDK_VERSION, U as isTransientError } from './index-DP3_OpuB.js';
4
+ import { O as ObservabilityTrace, P as Product, U as UITransformationResponse, a as UseRagChatOptions, b as UseRagChatReturn, c as ProjectChatSettings } from './ILLMProvider-DwFj0h2u.js';
5
+ export { A as AuthMode, C as ChatMessage, d as ChatOptions, e as ChatResponse, E as EmbedOptions, f as EmbeddingConfig, g as EmbeddingProvider, I as ILLMProvider, h as IngestDocument, L as LLMConfig, i as LLMProvider, j as LatencyBreakdown, k as ProjectAiSettings, l as ProjectAuthSettings, m as ProjectBrandingSettings, n as ProjectTelemetrySettings, o as ProjectWidgetSettings, R as RAGConfig, p as RagConfig, q as RagMessage, r as RetrievalConfig, s as RetrievedChunk, T as ThemeMode, t as TokenUsage, u as UIConfig, v as UniversalRagConfig, w as UpsertDocument, V as VectorDBConfig, x as VectorDBProvider, y as VectorMatch, W as WidgetPosition, z as WorkflowConfig, B as createDefaultProjectSettings, D as normalizeProjectSettings, F as projectSettingsToUiConfig } from './ILLMProvider-DwFj0h2u.js';
6
6
 
7
7
  /**
8
8
  * ChatWidget — Floating Action Button (FAB) that toggles the chat window.
package/dist/index.js CHANGED
@@ -356,7 +356,7 @@ function projectSettingsToUiConfig(settings) {
356
356
  // package.json
357
357
  var package_default = {
358
358
  name: "@retrivora-ai/rag-engine",
359
- version: "2.5.5",
359
+ version: "2.5.6",
360
360
  description: "Retrivora AI is a plug-and-play AI engine for RAG chat experiences \u2014 generic vector DB + LLM provider, embeddable or standalone.",
361
361
  author: "Abhinav Alkuchi",
362
362
  license: "UNLICENSED",
package/dist/index.mjs CHANGED
@@ -311,7 +311,7 @@ function projectSettingsToUiConfig(settings) {
311
311
  // package.json
312
312
  var package_default = {
313
313
  name: "@retrivora-ai/rag-engine",
314
- version: "2.5.5",
314
+ version: "2.5.6",
315
315
  description: "Retrivora AI is a plug-and-play AI engine for RAG chat experiences \u2014 generic vector DB + LLM provider, embeddable or standalone.",
316
316
  author: "Abhinav Alkuchi",
317
317
  license: "UNLICENSED",
package/dist/server.d.mts 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-DO5gj-e5.mjs';
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-DO5gj-e5.mjs';
3
- import { o as DecisionContext, q as IntentCategory, I as IRenderRule, G as RenderDecision, p as IRendererStrategy } from './index-BKOyhayB.mjs';
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-BKOyhayB.mjs';
5
- import { I as IProviderValidator, a as IProviderHealthChecker, H as HealthCheckResult } from './index-DE8qPWpI.mjs';
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-DE8qPWpI.mjs';
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.mjs';
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.mjs';
3
+ import { o as DecisionContext, q as IntentCategory, I as IRenderRule, G as RenderDecision, p as IRendererStrategy } from './index-Byv5MaYi.mjs';
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-Byv5MaYi.mjs';
5
+ import { I as IProviderValidator, a as IProviderHealthChecker, H as HealthCheckResult } from './index-D1jN8KSF.mjs';
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-D1jN8KSF.mjs';
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
- queryText?: string;
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
- queryText: string;
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 };