@retrivora-ai/rag-engine 2.4.0 → 2.4.2

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/README.md CHANGED
@@ -116,7 +116,7 @@ async function runIngestion() {
116
116
  ];
117
117
 
118
118
  const results = await retrivora.ingest(documents, 'default-namespace');
119
- console.log(`Successfully ingested ${results.length} documents.`);
119
+ //console.log(`Successfully ingested ${results.length} documents.`);
120
120
  }
121
121
  ```
122
122
 
@@ -317,7 +317,7 @@ var init_package = __esm({
317
317
  "package.json"() {
318
318
  package_default = {
319
319
  name: "@retrivora-ai/rag-engine",
320
- version: "2.4.0",
320
+ version: "2.4.2",
321
321
  description: "Retrivora AI is a plug-and-play AI engine for RAG chat experiences \u2014 generic vector DB + LLM provider, embeddable or standalone.",
322
322
  author: "Abhinav Alkuchi",
323
323
  license: "UNLICENSED",
@@ -512,7 +512,6 @@ var init_ConfigFetcher = __esm({
512
512
  for (const baseUrl of controlPlaneUrls) {
513
513
  try {
514
514
  const url = `${baseUrl}/api/v1/config?projectId=${encodeURIComponent(projectId)}`;
515
- console.log(`[ConfigFetcher] Fetching config from: ${url}`);
516
515
  const res = await fetch(url, {
517
516
  method: "GET",
518
517
  headers: __spreadValues({
@@ -520,7 +519,6 @@ var init_ConfigFetcher = __esm({
520
519
  "x-sdk-version": SDK_VERSION
521
520
  }, licenseKey ? { "x-license-key": licenseKey } : {})
522
521
  });
523
- console.log(`[ConfigFetcher] Response status: ${res.status}`);
524
522
  if (!res.ok) {
525
523
  console.warn(`[ConfigFetcher] Error text: ${await res.text()}`);
526
524
  }
@@ -1239,9 +1237,6 @@ var init_MultiTablePostgresProvider = __esm({
1239
1237
  if (this.tables.length === 0) {
1240
1238
  console.warn('[MultiTablePostgresProvider] No tables with "embedding" columns found in the database.');
1241
1239
  } else {
1242
- console.log(
1243
- `[MultiTablePostgresProvider] Connected. Searching across ${this.tables.length} table(s): ${this.tables.join(", ")}`
1244
- );
1245
1240
  }
1246
1241
  } finally {
1247
1242
  client.release();
@@ -1363,11 +1358,8 @@ var init_MultiTablePostgresProvider = __esm({
1363
1358
  }
1364
1359
  const vectorLiteral = `[${vector.join(",")}]`;
1365
1360
  const allResults = [];
1366
- console.log(`[MultiTablePostgresProvider] --- Starting Multi-Table Search ---`);
1367
1361
  const queryText = _filter == null ? void 0 : _filter.queryText;
1368
1362
  const entityHints = Array.isArray(_filter == null ? void 0 : _filter.keywords) ? _filter.keywords.map((k) => k.trim().toLowerCase()).filter(Boolean) : [];
1369
- console.log(`[MultiTablePostgresProvider] queryText: "${queryText}"`);
1370
- console.log(`[MultiTablePostgresProvider] entityHints: [${entityHints.join(", ")}]`);
1371
1363
  const getDynamicKeywordQuery = () => {
1372
1364
  if (entityHints.length > 0) {
1373
1365
  return entityHints.map((h) => h.replace(/\s+/g, " & ")).join(" & ");
@@ -1455,9 +1447,7 @@ var init_MultiTablePostgresProvider = __esm({
1455
1447
  }
1456
1448
  const result = await this.pool.query(sqlQuery, params);
1457
1449
  if (result.rowCount && result.rowCount > 0) {
1458
- console.log(` \u2705 Table "${table}": Found ${result.rowCount} potential matches. Top score: ${result.rows[0].hybrid_score.toFixed(4)}`);
1459
1450
  } else {
1460
- console.log(` \u26AA Table "${table}": No relevant matches found.`);
1461
1451
  }
1462
1452
  const tableResults = [];
1463
1453
  for (const row of result.rows) {
@@ -1495,9 +1485,6 @@ var init_MultiTablePostgresProvider = __esm({
1495
1485
  var _a4;
1496
1486
  return ((_a4 = res.metadata) == null ? void 0 : _a4.source_table) === bestMatchTable;
1497
1487
  });
1498
- console.log(`[MultiTablePostgresProvider] --- Search Complete ---`);
1499
- console.log(`[MultiTablePostgresProvider] Final top match from "${bestMatchTable}" with score ${finalSorted[0].score.toFixed(4)}`);
1500
- console.log(`[MultiTablePostgresProvider] Restricting recommendations strictly to table: "${bestMatchTable}"`);
1501
1488
  return finalSorted.slice(0, Math.max(topK, 15));
1502
1489
  }
1503
1490
  async delete(_id, _namespace) {
@@ -1875,13 +1862,11 @@ var init_QdrantProvider = __esm({
1875
1862
  if (this.schemaDiscovered) return;
1876
1863
  await this.ping();
1877
1864
  await this.ensureCollection();
1878
- console.log(`[QdrantProvider] \u{1F50D} Discovering schema for collection "${this.indexName}"...`);
1879
1865
  const discoveredFields = await this.discoverSchema();
1880
1866
  const opts = this.config.options;
1881
1867
  const configFields = opts.filterableFields || [];
1882
1868
  const allFields = [.../* @__PURE__ */ new Set([...discoveredFields, ...configFields])];
1883
1869
  if (allFields.length > 0) {
1884
- console.log(`[QdrantProvider] \u{1F6E0} Ensuring indexes for ${allFields.length} discovered fields...`);
1885
1870
  await Promise.all(
1886
1871
  allFields.map(async (fieldInfo) => {
1887
1872
  const [fieldName, schemaType] = fieldInfo.split(":");
@@ -1889,7 +1874,6 @@ var init_QdrantProvider = __esm({
1889
1874
  })
1890
1875
  );
1891
1876
  } else {
1892
- console.log(`[QdrantProvider] \u2139\uFE0F No fields discovered for indexing.`);
1893
1877
  }
1894
1878
  this.schemaDiscovered = true;
1895
1879
  }
@@ -1933,19 +1917,16 @@ var init_QdrantProvider = __esm({
1933
1917
  var _a3;
1934
1918
  try {
1935
1919
  await this.http.get(`/collections/${this.indexName}`);
1936
- console.log(`[QdrantProvider] \u2705 Collection "${this.indexName}" already exists.`);
1937
1920
  } catch (err) {
1938
1921
  if (import_axios4.default.isAxiosError(err) && ((_a3 = err.response) == null ? void 0 : _a3.status) === 404) {
1939
1922
  const opts = this.config.options;
1940
1923
  const dimensionsForCreate = opts.dimensions || 1536;
1941
- console.log(`[QdrantProvider] \u23F3 Creating collection "${this.indexName}" (dimensions: ${dimensionsForCreate})...`);
1942
1924
  await this.http.put(`/collections/${this.indexName}`, {
1943
1925
  vectors: {
1944
1926
  size: dimensionsForCreate,
1945
1927
  distance: "Cosine"
1946
1928
  }
1947
1929
  });
1948
- console.log(`[QdrantProvider] \u2705 Created collection "${this.indexName}"`);
1949
1930
  } else {
1950
1931
  throw err;
1951
1932
  }
@@ -1965,7 +1946,6 @@ var init_QdrantProvider = __esm({
1965
1946
  field_name: fullPath,
1966
1947
  field_schema: schema
1967
1948
  });
1968
- console.log(`[QdrantProvider] \u2705 Ensured ${schema} index for "${fullPath}"`);
1969
1949
  } catch (err) {
1970
1950
  let status;
1971
1951
  if (import_axios4.default.isAxiosError(err)) status = (_a3 = err.response) == null ? void 0 : _a3.status;
@@ -2118,15 +2098,12 @@ var init_ChromaDBProvider = __esm({
2118
2098
  try {
2119
2099
  const { data } = await this.http.get(`/api/v1/collections/${this.indexName}`);
2120
2100
  this.collectionId = data.id;
2121
- console.log(`[ChromaDBProvider] \u2705 Collection "${this.indexName}" found (id: ${this.collectionId})`);
2122
2101
  } catch (err) {
2123
2102
  if (import_axios5.default.isAxiosError(err) && ((_a3 = err.response) == null ? void 0 : _a3.status) === 404) {
2124
- console.log(`[ChromaDBProvider] \u23F3 Collection "${this.indexName}" not found. Creating...`);
2125
2103
  const { data } = await this.http.post("/api/v1/collections", {
2126
2104
  name: this.indexName
2127
2105
  });
2128
2106
  this.collectionId = data.id;
2129
- console.log(`[ChromaDBProvider] \u2705 Created collection "${this.indexName}" (id: ${this.collectionId})`);
2130
2107
  } else {
2131
2108
  throw err;
2132
2109
  }
@@ -2612,7 +2589,6 @@ var init_SimpleGraphProvider = __esm({
2612
2589
  this.edges = [];
2613
2590
  }
2614
2591
  async initialize() {
2615
- console.log("[SimpleGraphProvider] Initialised in-memory graph store.");
2616
2592
  }
2617
2593
  async addNodes(nodes) {
2618
2594
  for (const node of nodes) {
@@ -3135,26 +3111,12 @@ function getEnvConfig(env = process.env, base) {
3135
3111
  const llmModel = (_Ca = (_Ba = (_Aa = readString(env, "LLM_MODEL")) != null ? _Aa : (_za = base == null ? void 0 : base.llm) == null ? void 0 : _za.model) != null ? _Ba : rt == null ? void 0 : rt.llmModel) != null ? _Ca : tierBasedLLMModel;
3136
3112
  const llmApiKey = (_Ga = (_Fa = (_Da = readString(env, "LITELLM_MASTER_KEY")) != null ? _Da : rt == null ? void 0 : rt.litellmApiKey) != null ? _Fa : (_Ea = base == null ? void 0 : base.llm) == null ? void 0 : _Ea.apiKey) != null ? _Ga : licenseKey;
3137
3113
  const llmProfile = (_Ka = (_Ja = readString(env, "LLM_UNIVERSAL_PROFILE")) != null ? _Ja : (_Ia = (_Ha = base == null ? void 0 : base.llm) == null ? void 0 : _Ha.options) == null ? void 0 : _Ia.profile) != null ? _Ka : "litellm";
3138
- console.log("[serverConfig] \u{1F527} LLM Configuration:", {
3139
- baseUrl: llmBaseUrl,
3140
- model: llmModel,
3141
- provider: llmProvider,
3142
- hasApiKey: !!llmApiKey,
3143
- source: (rt == null ? void 0 : rt.llmModel) ? "runtime-injected" : "env/fallback"
3144
- });
3145
3114
  const defaultEmbeddingProvider = "universal_rest";
3146
3115
  const embeddingProvider = (_Na = (_Ma = readEnum(env, "EMBEDDING_PROVIDER", defaultEmbeddingProvider, EMBEDDING_PROVIDERS)) != null ? _Ma : (_La = base == null ? void 0 : base.embedding) == null ? void 0 : _La.provider) != null ? _Na : defaultEmbeddingProvider;
3147
3116
  const embeddingBaseUrl = (_Ua = (_Ta = (_Sa = (_Ra = (_Pa = (_Oa = readString(env, "LITELLM_BASE_URL")) != null ? _Oa : readString(env, "EMBEDDING_BASE_URL")) != null ? _Pa : readString(env, "LLM_BASE_URL")) != null ? _Ra : (_Qa = base == null ? void 0 : base.embedding) == null ? void 0 : _Qa.baseUrl) != null ? _Sa : rt == null ? void 0 : rt.embeddingBaseUrl) != null ? _Ta : rt == null ? void 0 : rt.llmBaseUrl) != null ? _Ua : defaultGatewayUrl;
3148
3117
  const embeddingModel = (_Ya = (_Xa = (_Wa = readString(env, "EMBEDDING_MODEL")) != null ? _Wa : (_Va = base == null ? void 0 : base.embedding) == null ? void 0 : _Va.model) != null ? _Xa : rt == null ? void 0 : rt.embeddingModel) != null ? _Ya : tierBasedEmbeddingModel;
3149
3118
  const embeddingApiKey = (_ab = (_$a = (_Za = readString(env, "LITELLM_MASTER_KEY")) != null ? _Za : rt == null ? void 0 : rt.litellmApiKey) != null ? _$a : (__a = base == null ? void 0 : base.embedding) == null ? void 0 : __a.apiKey) != null ? _ab : licenseKey;
3150
3119
  const embeddingProfile = (_eb = (_db = readString(env, "EMBEDDING_UNIVERSAL_PROFILE")) != null ? _db : (_cb = (_bb = base == null ? void 0 : base.embedding) == null ? void 0 : _bb.options) == null ? void 0 : _cb.profile) != null ? _eb : "litellm";
3151
- console.log("[serverConfig] \u{1F527} Embedding Configuration:", {
3152
- baseUrl: embeddingBaseUrl,
3153
- model: embeddingModel,
3154
- provider: embeddingProvider,
3155
- hasApiKey: !!embeddingApiKey,
3156
- source: (rt == null ? void 0 : rt.embeddingModel) ? "runtime-injected" : "env/fallback"
3157
- });
3158
3120
  return __spreadProps(__spreadValues({
3159
3121
  projectId,
3160
3122
  licenseKey,
@@ -4537,12 +4499,6 @@ var UniversalLLMAdapter = class {
4537
4499
  this.resolvedHeaders = __spreadValues(__spreadValues({
4538
4500
  "Content-Type": "application/json"
4539
4501
  }, config.apiKey ? { Authorization: `Bearer ${config.apiKey}` } : {}), this.opts.headers || {});
4540
- console.log("[UniversalLLMAdapter] Initialized with:", {
4541
- model: this.model,
4542
- baseUrl: this.baseUrl,
4543
- hasApiKey: !!this.apiKey,
4544
- apiKeyPrefix: this.apiKey ? `${this.apiKey.slice(0, 12)}...` : void 0
4545
- });
4546
4502
  this.http = import_axios2.default.create({
4547
4503
  baseURL: this.baseUrl,
4548
4504
  headers: this.resolvedHeaders,
@@ -4759,15 +4715,10 @@ ${context != null ? context : "None"}` },
4759
4715
  const path2 = (_a3 = this.opts.embedPath) != null ? _a3 : "/embeddings";
4760
4716
  const payload = this.opts.embedPayloadTemplate ? buildPayload(this.opts.embedPayloadTemplate, { input: text, model: this.model }) : { input: text, model: this.model };
4761
4717
  try {
4762
- console.log(`[UniversalLLMAdapter] Posting to embedding endpoint: ${this.baseUrl}${path2}`, {
4763
- model: this.model,
4764
- inputLength: typeof text === "string" ? text.length : "unknown"
4765
- });
4766
4718
  const { data } = await this.http.post(path2, payload);
4767
4719
  const extractPath = (_b = this.opts.embedExtractPath) != null ? _b : "data[0].embedding";
4768
4720
  const vector = resolvePath(data, extractPath);
4769
4721
  if (Array.isArray(vector)) {
4770
- console.log(`[UniversalLLMAdapter] Embedding HTTP request successful. Vector size: ${vector.length}`);
4771
4722
  return vector;
4772
4723
  }
4773
4724
  console.warn(
@@ -4793,12 +4744,10 @@ ${context != null ? context : "None"}` },
4793
4744
  }
4794
4745
  }
4795
4746
  try {
4796
- console.log(`[UniversalLLMAdapter] Retrying embedding request to: ${this.baseUrl}${path2}`);
4797
4747
  const { data } = await this.http.post(path2, payload);
4798
4748
  const extractPath = (_f = this.opts.embedExtractPath) != null ? _f : "data[0].embedding";
4799
4749
  const vector = resolvePath(data, extractPath);
4800
4750
  if (Array.isArray(vector)) {
4801
- console.log(`[UniversalLLMAdapter] Retry embedding HTTP request successful. Vector size: ${vector.length}`);
4802
4751
  return vector;
4803
4752
  }
4804
4753
  console.error(
@@ -4862,7 +4811,6 @@ var LLMFactory = class _LLMFactory {
4862
4811
  */
4863
4812
  static register(name, factory) {
4864
4813
  customProviders.set(name.toLowerCase(), factory);
4865
- console.log(`[LLMFactory] Registered custom provider: "${name}"`);
4866
4814
  }
4867
4815
  /**
4868
4816
  * Unregister a previously registered custom provider.
@@ -5642,7 +5590,6 @@ var MCPClient = class {
5642
5590
  });
5643
5591
  await this.sendNotification("notifications/initialized");
5644
5592
  this.initialized = true;
5645
- console.log(`[MCPClient] Connected and initialized server "${this.config.name}" successfully.`);
5646
5593
  } catch (err) {
5647
5594
  this.disconnect();
5648
5595
  throw new Error(`[MCPClient] Failed to initialize server "${this.config.name}": ${err.message}`);
@@ -5668,7 +5615,6 @@ var MCPClient = class {
5668
5615
  console.warn(`[MCPClient] [stderr] [${this.config.name}]:`, data.toString("utf-8"));
5669
5616
  });
5670
5617
  this.childProcess.on("close", (code) => {
5671
- console.log(`[MCPClient] Connection closed for "${this.config.name}" with exit code: ${code}`);
5672
5618
  this.disconnect();
5673
5619
  });
5674
5620
  await new Promise((resolve) => setTimeout(resolve, 100));
@@ -6797,13 +6743,11 @@ var LLMRouter = class {
6797
6743
  const providerFastDefault = (_a3 = FAST_MODEL_DEFAULTS[this.config.llm.provider]) != null ? _a3 : "";
6798
6744
  const fastModelName = envFastModel || providerFastDefault;
6799
6745
  if (fastModelName && fastModelName !== this.config.llm.model) {
6800
- console.log(`[LLMRouter] Fast role \u2192 provider="${this.config.llm.provider}" model="${fastModelName}"`);
6801
6746
  const fastConfig = __spreadProps(__spreadValues({}, this.config.llm), {
6802
6747
  model: fastModelName
6803
6748
  });
6804
6749
  this.models.set("fast", LLMFactory.create(fastConfig, this.config.embedding));
6805
6750
  } else {
6806
- console.log(`[LLMRouter] Fast role \u2192 reusing default model (no lightweight alternative configured).`);
6807
6751
  this.models.set("fast", defaultModel);
6808
6752
  }
6809
6753
  this.models.set("powerful", defaultModel);
@@ -8791,7 +8735,6 @@ var SchemaMapper = class {
8791
8735
  }
8792
8736
  static async _doTrain(llm, cacheKey, keys) {
8793
8737
  var _a3, _b, _c, _d, _e, _f, _g2, _h, _i, _j, _k;
8794
- console.log(`[SchemaMapper] \u{1F9E0} Training on new schema keys: ${keys.join(", ")}`);
8795
8738
  const propertyList = Object.entries(this.TARGET_PROPERTIES).map(([prop, desc]) => `- ${prop} (${desc})`).join("\n");
8796
8739
  const messages = [
8797
8740
  { role: "system", content: "You are a database schema expert. Respond ONLY with valid JSON." },
@@ -11450,7 +11393,6 @@ function createStreamHandler(configOrPlugin, options) {
11450
11393
  },
11451
11394
  cancel(reason) {
11452
11395
  isActive = false;
11453
- console.log("[createStreamHandler] Stream connection closed by client:", reason);
11454
11396
  }
11455
11397
  });
11456
11398
  return new Response(stream, { headers: __spreadProps(__spreadValues({}, SSE_HEADERS), { "x-message-id": assistantMsgId, "x-user-message-id": userMsgId }) });
@@ -11541,7 +11483,6 @@ function createLicenseHandler(configOrPlugin, options) {
11541
11483
  const rawKey = req.headers.get("x-license-key") || (body == null ? void 0 : body.licenseKey) || ((_a3 = req.headers.get("authorization")) == null ? void 0 : _a3.replace(/^Bearer\s+/i, "")) || config.licenseKey || process.env.NEXT_PUBLIC_RETRIVORA_LICENSE_KEY || process.env.RETRIVORA_LICENSE_KEY || "";
11542
11484
  const licenseKey = (rawKey || "").trim().replace(/^["']|["']$/g, "").trim();
11543
11485
  const projectId = (body == null ? void 0 : body.projectId) || config.projectId || "";
11544
- console.log(`[DEBUG] createLicenseHandler: projectId="${projectId}", body.projectId="${body == null ? void 0 : body.projectId}", config.projectId="${config.projectId}"`);
11545
11486
  const payload = await LicenseVerifier.verifyAsync(licenseKey, projectId);
11546
11487
  return import_server.NextResponse.json({
11547
11488
  valid: true,
@@ -11572,7 +11513,6 @@ function createUploadHandler(configOrPlugin, options) {
11572
11513
  const plugin = getOrCreatePlugin(configOrPlugin);
11573
11514
  const onAuthorize = options == null ? void 0 : options.onAuthorize;
11574
11515
  return async function POST(req, context) {
11575
- console.log("Upload handler invoked");
11576
11516
  const authResult = await checkAuth(req, onAuthorize);
11577
11517
  if (authResult) return authResult;
11578
11518
  const config = plugin.getConfig();
@@ -11581,7 +11521,6 @@ function createUploadHandler(configOrPlugin, options) {
11581
11521
  try {
11582
11522
  const formData = await req.formData();
11583
11523
  const files = formData.getAll("files");
11584
- console.log("Files received for upload:", files.map((f) => f.name));
11585
11524
  const namespace = formData.get("namespace") || void 0;
11586
11525
  const dimensionRaw = formData.get("dimension");
11587
11526
  const dimension = dimensionRaw ? parseInt(dimensionRaw, 10) : void 0;
@@ -302,7 +302,7 @@ var init_package = __esm({
302
302
  "package.json"() {
303
303
  package_default = {
304
304
  name: "@retrivora-ai/rag-engine",
305
- version: "2.4.0",
305
+ version: "2.4.2",
306
306
  description: "Retrivora AI is a plug-and-play AI engine for RAG chat experiences \u2014 generic vector DB + LLM provider, embeddable or standalone.",
307
307
  author: "Abhinav Alkuchi",
308
308
  license: "UNLICENSED",
@@ -497,7 +497,6 @@ var init_ConfigFetcher = __esm({
497
497
  for (const baseUrl of controlPlaneUrls) {
498
498
  try {
499
499
  const url = `${baseUrl}/api/v1/config?projectId=${encodeURIComponent(projectId)}`;
500
- console.log(`[ConfigFetcher] Fetching config from: ${url}`);
501
500
  const res = await fetch(url, {
502
501
  method: "GET",
503
502
  headers: __spreadValues({
@@ -505,7 +504,6 @@ var init_ConfigFetcher = __esm({
505
504
  "x-sdk-version": SDK_VERSION
506
505
  }, licenseKey ? { "x-license-key": licenseKey } : {})
507
506
  });
508
- console.log(`[ConfigFetcher] Response status: ${res.status}`);
509
507
  if (!res.ok) {
510
508
  console.warn(`[ConfigFetcher] Error text: ${await res.text()}`);
511
509
  }
@@ -1224,9 +1222,6 @@ var init_MultiTablePostgresProvider = __esm({
1224
1222
  if (this.tables.length === 0) {
1225
1223
  console.warn('[MultiTablePostgresProvider] No tables with "embedding" columns found in the database.');
1226
1224
  } else {
1227
- console.log(
1228
- `[MultiTablePostgresProvider] Connected. Searching across ${this.tables.length} table(s): ${this.tables.join(", ")}`
1229
- );
1230
1225
  }
1231
1226
  } finally {
1232
1227
  client.release();
@@ -1348,11 +1343,8 @@ var init_MultiTablePostgresProvider = __esm({
1348
1343
  }
1349
1344
  const vectorLiteral = `[${vector.join(",")}]`;
1350
1345
  const allResults = [];
1351
- console.log(`[MultiTablePostgresProvider] --- Starting Multi-Table Search ---`);
1352
1346
  const queryText = _filter == null ? void 0 : _filter.queryText;
1353
1347
  const entityHints = Array.isArray(_filter == null ? void 0 : _filter.keywords) ? _filter.keywords.map((k) => k.trim().toLowerCase()).filter(Boolean) : [];
1354
- console.log(`[MultiTablePostgresProvider] queryText: "${queryText}"`);
1355
- console.log(`[MultiTablePostgresProvider] entityHints: [${entityHints.join(", ")}]`);
1356
1348
  const getDynamicKeywordQuery = () => {
1357
1349
  if (entityHints.length > 0) {
1358
1350
  return entityHints.map((h) => h.replace(/\s+/g, " & ")).join(" & ");
@@ -1440,9 +1432,7 @@ var init_MultiTablePostgresProvider = __esm({
1440
1432
  }
1441
1433
  const result = await this.pool.query(sqlQuery, params);
1442
1434
  if (result.rowCount && result.rowCount > 0) {
1443
- console.log(` \u2705 Table "${table}": Found ${result.rowCount} potential matches. Top score: ${result.rows[0].hybrid_score.toFixed(4)}`);
1444
1435
  } else {
1445
- console.log(` \u26AA Table "${table}": No relevant matches found.`);
1446
1436
  }
1447
1437
  const tableResults = [];
1448
1438
  for (const row of result.rows) {
@@ -1480,9 +1470,6 @@ var init_MultiTablePostgresProvider = __esm({
1480
1470
  var _a4;
1481
1471
  return ((_a4 = res.metadata) == null ? void 0 : _a4.source_table) === bestMatchTable;
1482
1472
  });
1483
- console.log(`[MultiTablePostgresProvider] --- Search Complete ---`);
1484
- console.log(`[MultiTablePostgresProvider] Final top match from "${bestMatchTable}" with score ${finalSorted[0].score.toFixed(4)}`);
1485
- console.log(`[MultiTablePostgresProvider] Restricting recommendations strictly to table: "${bestMatchTable}"`);
1486
1473
  return finalSorted.slice(0, Math.max(topK, 15));
1487
1474
  }
1488
1475
  async delete(_id, _namespace) {
@@ -1860,13 +1847,11 @@ var init_QdrantProvider = __esm({
1860
1847
  if (this.schemaDiscovered) return;
1861
1848
  await this.ping();
1862
1849
  await this.ensureCollection();
1863
- console.log(`[QdrantProvider] \u{1F50D} Discovering schema for collection "${this.indexName}"...`);
1864
1850
  const discoveredFields = await this.discoverSchema();
1865
1851
  const opts = this.config.options;
1866
1852
  const configFields = opts.filterableFields || [];
1867
1853
  const allFields = [.../* @__PURE__ */ new Set([...discoveredFields, ...configFields])];
1868
1854
  if (allFields.length > 0) {
1869
- console.log(`[QdrantProvider] \u{1F6E0} Ensuring indexes for ${allFields.length} discovered fields...`);
1870
1855
  await Promise.all(
1871
1856
  allFields.map(async (fieldInfo) => {
1872
1857
  const [fieldName, schemaType] = fieldInfo.split(":");
@@ -1874,7 +1859,6 @@ var init_QdrantProvider = __esm({
1874
1859
  })
1875
1860
  );
1876
1861
  } else {
1877
- console.log(`[QdrantProvider] \u2139\uFE0F No fields discovered for indexing.`);
1878
1862
  }
1879
1863
  this.schemaDiscovered = true;
1880
1864
  }
@@ -1918,19 +1902,16 @@ var init_QdrantProvider = __esm({
1918
1902
  var _a3;
1919
1903
  try {
1920
1904
  await this.http.get(`/collections/${this.indexName}`);
1921
- console.log(`[QdrantProvider] \u2705 Collection "${this.indexName}" already exists.`);
1922
1905
  } catch (err) {
1923
1906
  if (axios4.isAxiosError(err) && ((_a3 = err.response) == null ? void 0 : _a3.status) === 404) {
1924
1907
  const opts = this.config.options;
1925
1908
  const dimensionsForCreate = opts.dimensions || 1536;
1926
- console.log(`[QdrantProvider] \u23F3 Creating collection "${this.indexName}" (dimensions: ${dimensionsForCreate})...`);
1927
1909
  await this.http.put(`/collections/${this.indexName}`, {
1928
1910
  vectors: {
1929
1911
  size: dimensionsForCreate,
1930
1912
  distance: "Cosine"
1931
1913
  }
1932
1914
  });
1933
- console.log(`[QdrantProvider] \u2705 Created collection "${this.indexName}"`);
1934
1915
  } else {
1935
1916
  throw err;
1936
1917
  }
@@ -1950,7 +1931,6 @@ var init_QdrantProvider = __esm({
1950
1931
  field_name: fullPath,
1951
1932
  field_schema: schema
1952
1933
  });
1953
- console.log(`[QdrantProvider] \u2705 Ensured ${schema} index for "${fullPath}"`);
1954
1934
  } catch (err) {
1955
1935
  let status;
1956
1936
  if (axios4.isAxiosError(err)) status = (_a3 = err.response) == null ? void 0 : _a3.status;
@@ -2103,15 +2083,12 @@ var init_ChromaDBProvider = __esm({
2103
2083
  try {
2104
2084
  const { data } = await this.http.get(`/api/v1/collections/${this.indexName}`);
2105
2085
  this.collectionId = data.id;
2106
- console.log(`[ChromaDBProvider] \u2705 Collection "${this.indexName}" found (id: ${this.collectionId})`);
2107
2086
  } catch (err) {
2108
2087
  if (axios5.isAxiosError(err) && ((_a3 = err.response) == null ? void 0 : _a3.status) === 404) {
2109
- console.log(`[ChromaDBProvider] \u23F3 Collection "${this.indexName}" not found. Creating...`);
2110
2088
  const { data } = await this.http.post("/api/v1/collections", {
2111
2089
  name: this.indexName
2112
2090
  });
2113
2091
  this.collectionId = data.id;
2114
- console.log(`[ChromaDBProvider] \u2705 Created collection "${this.indexName}" (id: ${this.collectionId})`);
2115
2092
  } else {
2116
2093
  throw err;
2117
2094
  }
@@ -2597,7 +2574,6 @@ var init_SimpleGraphProvider = __esm({
2597
2574
  this.edges = [];
2598
2575
  }
2599
2576
  async initialize() {
2600
- console.log("[SimpleGraphProvider] Initialised in-memory graph store.");
2601
2577
  }
2602
2578
  async addNodes(nodes) {
2603
2579
  for (const node of nodes) {
@@ -3099,26 +3075,12 @@ function getEnvConfig(env = process.env, base) {
3099
3075
  const llmModel = (_Ca = (_Ba = (_Aa = readString(env, "LLM_MODEL")) != null ? _Aa : (_za = base == null ? void 0 : base.llm) == null ? void 0 : _za.model) != null ? _Ba : rt == null ? void 0 : rt.llmModel) != null ? _Ca : tierBasedLLMModel;
3100
3076
  const llmApiKey = (_Ga = (_Fa = (_Da = readString(env, "LITELLM_MASTER_KEY")) != null ? _Da : rt == null ? void 0 : rt.litellmApiKey) != null ? _Fa : (_Ea = base == null ? void 0 : base.llm) == null ? void 0 : _Ea.apiKey) != null ? _Ga : licenseKey;
3101
3077
  const llmProfile = (_Ka = (_Ja = readString(env, "LLM_UNIVERSAL_PROFILE")) != null ? _Ja : (_Ia = (_Ha = base == null ? void 0 : base.llm) == null ? void 0 : _Ha.options) == null ? void 0 : _Ia.profile) != null ? _Ka : "litellm";
3102
- console.log("[serverConfig] \u{1F527} LLM Configuration:", {
3103
- baseUrl: llmBaseUrl,
3104
- model: llmModel,
3105
- provider: llmProvider,
3106
- hasApiKey: !!llmApiKey,
3107
- source: (rt == null ? void 0 : rt.llmModel) ? "runtime-injected" : "env/fallback"
3108
- });
3109
3078
  const defaultEmbeddingProvider = "universal_rest";
3110
3079
  const embeddingProvider = (_Na = (_Ma = readEnum(env, "EMBEDDING_PROVIDER", defaultEmbeddingProvider, EMBEDDING_PROVIDERS)) != null ? _Ma : (_La = base == null ? void 0 : base.embedding) == null ? void 0 : _La.provider) != null ? _Na : defaultEmbeddingProvider;
3111
3080
  const embeddingBaseUrl = (_Ua = (_Ta = (_Sa = (_Ra = (_Pa = (_Oa = readString(env, "LITELLM_BASE_URL")) != null ? _Oa : readString(env, "EMBEDDING_BASE_URL")) != null ? _Pa : readString(env, "LLM_BASE_URL")) != null ? _Ra : (_Qa = base == null ? void 0 : base.embedding) == null ? void 0 : _Qa.baseUrl) != null ? _Sa : rt == null ? void 0 : rt.embeddingBaseUrl) != null ? _Ta : rt == null ? void 0 : rt.llmBaseUrl) != null ? _Ua : defaultGatewayUrl;
3112
3081
  const embeddingModel = (_Ya = (_Xa = (_Wa = readString(env, "EMBEDDING_MODEL")) != null ? _Wa : (_Va = base == null ? void 0 : base.embedding) == null ? void 0 : _Va.model) != null ? _Xa : rt == null ? void 0 : rt.embeddingModel) != null ? _Ya : tierBasedEmbeddingModel;
3113
3082
  const embeddingApiKey = (_ab = (_$a = (_Za = readString(env, "LITELLM_MASTER_KEY")) != null ? _Za : rt == null ? void 0 : rt.litellmApiKey) != null ? _$a : (__a = base == null ? void 0 : base.embedding) == null ? void 0 : __a.apiKey) != null ? _ab : licenseKey;
3114
3083
  const embeddingProfile = (_eb = (_db = readString(env, "EMBEDDING_UNIVERSAL_PROFILE")) != null ? _db : (_cb = (_bb = base == null ? void 0 : base.embedding) == null ? void 0 : _bb.options) == null ? void 0 : _cb.profile) != null ? _eb : "litellm";
3115
- console.log("[serverConfig] \u{1F527} Embedding Configuration:", {
3116
- baseUrl: embeddingBaseUrl,
3117
- model: embeddingModel,
3118
- provider: embeddingProvider,
3119
- hasApiKey: !!embeddingApiKey,
3120
- source: (rt == null ? void 0 : rt.embeddingModel) ? "runtime-injected" : "env/fallback"
3121
- });
3122
3084
  return __spreadProps(__spreadValues({
3123
3085
  projectId,
3124
3086
  licenseKey,
@@ -4501,12 +4463,6 @@ var UniversalLLMAdapter = class {
4501
4463
  this.resolvedHeaders = __spreadValues(__spreadValues({
4502
4464
  "Content-Type": "application/json"
4503
4465
  }, config.apiKey ? { Authorization: `Bearer ${config.apiKey}` } : {}), this.opts.headers || {});
4504
- console.log("[UniversalLLMAdapter] Initialized with:", {
4505
- model: this.model,
4506
- baseUrl: this.baseUrl,
4507
- hasApiKey: !!this.apiKey,
4508
- apiKeyPrefix: this.apiKey ? `${this.apiKey.slice(0, 12)}...` : void 0
4509
- });
4510
4466
  this.http = axios2.create({
4511
4467
  baseURL: this.baseUrl,
4512
4468
  headers: this.resolvedHeaders,
@@ -4723,15 +4679,10 @@ ${context != null ? context : "None"}` },
4723
4679
  const path2 = (_a3 = this.opts.embedPath) != null ? _a3 : "/embeddings";
4724
4680
  const payload = this.opts.embedPayloadTemplate ? buildPayload(this.opts.embedPayloadTemplate, { input: text, model: this.model }) : { input: text, model: this.model };
4725
4681
  try {
4726
- console.log(`[UniversalLLMAdapter] Posting to embedding endpoint: ${this.baseUrl}${path2}`, {
4727
- model: this.model,
4728
- inputLength: typeof text === "string" ? text.length : "unknown"
4729
- });
4730
4682
  const { data } = await this.http.post(path2, payload);
4731
4683
  const extractPath = (_b = this.opts.embedExtractPath) != null ? _b : "data[0].embedding";
4732
4684
  const vector = resolvePath(data, extractPath);
4733
4685
  if (Array.isArray(vector)) {
4734
- console.log(`[UniversalLLMAdapter] Embedding HTTP request successful. Vector size: ${vector.length}`);
4735
4686
  return vector;
4736
4687
  }
4737
4688
  console.warn(
@@ -4757,12 +4708,10 @@ ${context != null ? context : "None"}` },
4757
4708
  }
4758
4709
  }
4759
4710
  try {
4760
- console.log(`[UniversalLLMAdapter] Retrying embedding request to: ${this.baseUrl}${path2}`);
4761
4711
  const { data } = await this.http.post(path2, payload);
4762
4712
  const extractPath = (_f = this.opts.embedExtractPath) != null ? _f : "data[0].embedding";
4763
4713
  const vector = resolvePath(data, extractPath);
4764
4714
  if (Array.isArray(vector)) {
4765
- console.log(`[UniversalLLMAdapter] Retry embedding HTTP request successful. Vector size: ${vector.length}`);
4766
4715
  return vector;
4767
4716
  }
4768
4717
  console.error(
@@ -4826,7 +4775,6 @@ var LLMFactory = class _LLMFactory {
4826
4775
  */
4827
4776
  static register(name, factory) {
4828
4777
  customProviders.set(name.toLowerCase(), factory);
4829
- console.log(`[LLMFactory] Registered custom provider: "${name}"`);
4830
4778
  }
4831
4779
  /**
4832
4780
  * Unregister a previously registered custom provider.
@@ -5606,7 +5554,6 @@ var MCPClient = class {
5606
5554
  });
5607
5555
  await this.sendNotification("notifications/initialized");
5608
5556
  this.initialized = true;
5609
- console.log(`[MCPClient] Connected and initialized server "${this.config.name}" successfully.`);
5610
5557
  } catch (err) {
5611
5558
  this.disconnect();
5612
5559
  throw new Error(`[MCPClient] Failed to initialize server "${this.config.name}": ${err.message}`);
@@ -5632,7 +5579,6 @@ var MCPClient = class {
5632
5579
  console.warn(`[MCPClient] [stderr] [${this.config.name}]:`, data.toString("utf-8"));
5633
5580
  });
5634
5581
  this.childProcess.on("close", (code) => {
5635
- console.log(`[MCPClient] Connection closed for "${this.config.name}" with exit code: ${code}`);
5636
5582
  this.disconnect();
5637
5583
  });
5638
5584
  await new Promise((resolve) => setTimeout(resolve, 100));
@@ -6761,13 +6707,11 @@ var LLMRouter = class {
6761
6707
  const providerFastDefault = (_a3 = FAST_MODEL_DEFAULTS[this.config.llm.provider]) != null ? _a3 : "";
6762
6708
  const fastModelName = envFastModel || providerFastDefault;
6763
6709
  if (fastModelName && fastModelName !== this.config.llm.model) {
6764
- console.log(`[LLMRouter] Fast role \u2192 provider="${this.config.llm.provider}" model="${fastModelName}"`);
6765
6710
  const fastConfig = __spreadProps(__spreadValues({}, this.config.llm), {
6766
6711
  model: fastModelName
6767
6712
  });
6768
6713
  this.models.set("fast", LLMFactory.create(fastConfig, this.config.embedding));
6769
6714
  } else {
6770
- console.log(`[LLMRouter] Fast role \u2192 reusing default model (no lightweight alternative configured).`);
6771
6715
  this.models.set("fast", defaultModel);
6772
6716
  }
6773
6717
  this.models.set("powerful", defaultModel);
@@ -8755,7 +8699,6 @@ var SchemaMapper = class {
8755
8699
  }
8756
8700
  static async _doTrain(llm, cacheKey, keys) {
8757
8701
  var _a3, _b, _c, _d, _e, _f, _g2, _h, _i, _j, _k;
8758
- console.log(`[SchemaMapper] \u{1F9E0} Training on new schema keys: ${keys.join(", ")}`);
8759
8702
  const propertyList = Object.entries(this.TARGET_PROPERTIES).map(([prop, desc]) => `- ${prop} (${desc})`).join("\n");
8760
8703
  const messages = [
8761
8704
  { role: "system", content: "You are a database schema expert. Respond ONLY with valid JSON." },
@@ -11414,7 +11357,6 @@ function createStreamHandler(configOrPlugin, options) {
11414
11357
  },
11415
11358
  cancel(reason) {
11416
11359
  isActive = false;
11417
- console.log("[createStreamHandler] Stream connection closed by client:", reason);
11418
11360
  }
11419
11361
  });
11420
11362
  return new Response(stream, { headers: __spreadProps(__spreadValues({}, SSE_HEADERS), { "x-message-id": assistantMsgId, "x-user-message-id": userMsgId }) });
@@ -11505,7 +11447,6 @@ function createLicenseHandler(configOrPlugin, options) {
11505
11447
  const rawKey = req.headers.get("x-license-key") || (body == null ? void 0 : body.licenseKey) || ((_a3 = req.headers.get("authorization")) == null ? void 0 : _a3.replace(/^Bearer\s+/i, "")) || config.licenseKey || process.env.NEXT_PUBLIC_RETRIVORA_LICENSE_KEY || process.env.RETRIVORA_LICENSE_KEY || "";
11506
11448
  const licenseKey = (rawKey || "").trim().replace(/^["']|["']$/g, "").trim();
11507
11449
  const projectId = (body == null ? void 0 : body.projectId) || config.projectId || "";
11508
- console.log(`[DEBUG] createLicenseHandler: projectId="${projectId}", body.projectId="${body == null ? void 0 : body.projectId}", config.projectId="${config.projectId}"`);
11509
11450
  const payload = await LicenseVerifier.verifyAsync(licenseKey, projectId);
11510
11451
  return NextResponse.json({
11511
11452
  valid: true,
@@ -11536,7 +11477,6 @@ function createUploadHandler(configOrPlugin, options) {
11536
11477
  const plugin = getOrCreatePlugin(configOrPlugin);
11537
11478
  const onAuthorize = options == null ? void 0 : options.onAuthorize;
11538
11479
  return async function POST(req, context) {
11539
- console.log("Upload handler invoked");
11540
11480
  const authResult = await checkAuth(req, onAuthorize);
11541
11481
  if (authResult) return authResult;
11542
11482
  const config = plugin.getConfig();
@@ -11545,7 +11485,6 @@ function createUploadHandler(configOrPlugin, options) {
11545
11485
  try {
11546
11486
  const formData = await req.formData();
11547
11487
  const files = formData.getAll("files");
11548
- console.log("Files received for upload:", files.map((f) => f.name));
11549
11488
  const namespace = formData.get("namespace") || void 0;
11550
11489
  const dimensionRaw = formData.get("dimension");
11551
11490
  const dimension = dimensionRaw ? parseInt(dimensionRaw, 10) : void 0;
package/dist/index.js CHANGED
@@ -352,7 +352,7 @@ function projectSettingsToUiConfig(settings) {
352
352
  // package.json
353
353
  var package_default = {
354
354
  name: "@retrivora-ai/rag-engine",
355
- version: "2.4.0",
355
+ version: "2.4.2",
356
356
  description: "Retrivora AI is a plug-and-play AI engine for RAG chat experiences \u2014 generic vector DB + LLM provider, embeddable or standalone.",
357
357
  author: "Abhinav Alkuchi",
358
358
  license: "UNLICENSED",
@@ -532,7 +532,6 @@ var ConfigFetcher = class {
532
532
  for (const baseUrl of controlPlaneUrls) {
533
533
  try {
534
534
  const url = `${baseUrl}/api/v1/config?projectId=${encodeURIComponent(projectId)}`;
535
- console.log(`[ConfigFetcher] Fetching config from: ${url}`);
536
535
  const res = await fetch(url, {
537
536
  method: "GET",
538
537
  headers: __spreadValues({
@@ -540,7 +539,6 @@ var ConfigFetcher = class {
540
539
  "x-sdk-version": SDK_VERSION
541
540
  }, licenseKey ? { "x-license-key": licenseKey } : {})
542
541
  });
543
- console.log(`[ConfigFetcher] Response status: ${res.status}`);
544
542
  if (!res.ok) {
545
543
  console.warn(`[ConfigFetcher] Error text: ${await res.text()}`);
546
544
  }
@@ -663,15 +661,7 @@ function ConfigProvider({
663
661
  if (config == null ? void 0 : config.borderRadius) flatUi.borderRadius = config.borderRadius;
664
662
  if (config == null ? void 0 : config.visualStyle) flatUi.visualStyle = config.visualStyle;
665
663
  return __spreadValues(__spreadValues({}, flatUi), config == null ? void 0 : config.ui);
666
- }, [
667
- config == null ? void 0 : config.ui,
668
- config == null ? void 0 : config.primaryColor,
669
- config == null ? void 0 : config.secondaryColor,
670
- config == null ? void 0 : config.accentColor,
671
- config == null ? void 0 : config.theme,
672
- config == null ? void 0 : config.borderRadius,
673
- config == null ? void 0 : config.visualStyle
674
- ]);
664
+ }, [config]);
675
665
  const explicitSettings = (0, import_react.useMemo)(
676
666
  () => projectSettingsInput ? normalizeProjectSettings(projectId, projectSettingsInput) : void 0,
677
667
  [projectSettingsInput, projectId]
@@ -806,7 +796,6 @@ function DocumentUpload({ namespace, uploadUrl, retrivoraApiBase, onUploadComple
806
796
  const apiBase = retrivoraApiBase || configuredApiBase || "/api/retrivora";
807
797
  const primaryUrl = uploadUrl || `${apiBase.replace(/\/$/, "")}/upload`;
808
798
  const uploadHeaders = __spreadValues(__spreadValues({}, configHeaders || {}), licenseKey ? { "x-license-key": licenseKey } : {});
809
- console.log(`[Retrivora SDK] \u{1F4E4} Initiating upload request to "${primaryUrl}" (Files: ${idleFiles.length}, Namespace: "${targetNs}", Dimension: ${dimension})`);
810
799
  try {
811
800
  let response = await fetch(primaryUrl, {
812
801
  method: "POST",
@@ -823,7 +812,6 @@ function DocumentUpload({ namespace, uploadUrl, retrivoraApiBase, onUploadComple
823
812
  }
824
813
  const result = await response.json();
825
814
  if (!response.ok) throw new Error(result.error || `Upload failed with HTTP status ${response.status}`);
826
- console.log(`[Retrivora SDK] \u2705 Upload response success:`, result);
827
815
  setFileStates((prev) => prev.map((s) => s.status === "uploading" ? __spreadProps(__spreadValues({}, s), { status: "success" }) : s));
828
816
  const updatedSuccessCount = fileStates.length;
829
817
  setLastUploadSummary({
@@ -2561,7 +2549,6 @@ function resolveStructuredRows(config) {
2561
2549
  }
2562
2550
  function UIDispatcher({ rawContent, primaryColor, accentColor, isStreaming, onAddToCart, viewportSize = "large" }) {
2563
2551
  var _a;
2564
- console.log("rawContent", rawContent);
2565
2552
  const result = import_react7.default.useMemo(() => {
2566
2553
  try {
2567
2554
  const clean = rawContent.replace(/^```[a-z]*\s*/i, "").replace(/```\s*$/, "").trim();
@@ -3470,7 +3457,6 @@ function useRagChat(projectId, options = {}) {
3470
3457
  onReply == null ? void 0 : onReply(finalMsg);
3471
3458
  } catch (err) {
3472
3459
  if (err instanceof Error && err.name === "AbortError") {
3473
- console.log("[useRagChat] Streaming stopped by user.");
3474
3460
  return;
3475
3461
  }
3476
3462
  let msg = err instanceof Error ? err.message : "Something went wrong. Please try again.";