@retrivora-ai/rag-engine 2.2.3 → 2.2.4

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.
@@ -125,7 +125,7 @@ var init_templateUtils = __esm({
125
125
  async function handleGroqRequest(req, apiKeyOverride) {
126
126
  const apiKey = apiKeyOverride || process.env.GROQ_API_KEY;
127
127
  if (!apiKey) {
128
- throw new Error("Groq API Key missing. Please set GROQ_API_KEY in environment variables.");
128
+ throw new Error("LLM service credentials not configured.");
129
129
  }
130
130
  const modelName = req.model.replace(/^groq\//i, "");
131
131
  const payload = __spreadProps(__spreadValues({}, req), {
@@ -622,7 +622,6 @@ async function dispatchChatCompletion(req, apiKeyOverride) {
622
622
  const effectiveKey = customGroqKey || cleanApiKeyOverride(apiKeyOverride);
623
623
  const activeModel = req.model || targetModel || "llama-3.1-8b-instant";
624
624
  const provider = resolveProvider(activeModel);
625
- console.log(`[LLM Gateway Router] Dispatching chat request: model=${activeModel}, provider=${provider}, hasCustomKey=${Boolean(customGroqKey)}, hasGlobalGroqKey=${Boolean(process.env.GROQ_API_KEY)}`);
626
625
  try {
627
626
  switch (provider) {
628
627
  case "groq":
@@ -4748,7 +4747,6 @@ ${context != null ? context : "None"}` },
4748
4747
  return String(result2);
4749
4748
  }
4750
4749
  } catch (httpErr) {
4751
- console.warn(`[UniversalLLMAdapter] Direct HTTP POST to ${this.baseUrl}${path2} failed (${httpErr.message}). Attempting in-process gateway dispatch fallback...`);
4752
4750
  const _g2 = globalThis;
4753
4751
  let dispatch = _g2.__retrivoraDispatchChat;
4754
4752
  if (typeof dispatch !== "function") {
@@ -5395,7 +5393,7 @@ var ConfigValidator = class {
5395
5393
  // package.json
5396
5394
  var package_default = {
5397
5395
  name: "@retrivora-ai/rag-engine",
5398
- version: "2.2.3",
5396
+ version: "2.2.4",
5399
5397
  description: "Retrivora AI is a plug-and-play AI engine for RAG chat experiences \u2014 generic vector DB + LLM provider, embeddable or standalone.",
5400
5398
  author: "Abhinav Alkuchi",
5401
5399
  license: "UNLICENSED",
@@ -9815,7 +9813,7 @@ ${context}`;
9815
9813
  const tokenCount = Number(((_c2 = finalTrace == null ? void 0 : finalTrace.tokens) == null ? void 0 : _c2.totalTokens) || 0);
9816
9814
  const costEst = Number(((_d2 = finalTrace == null ? void 0 : finalTrace.tokens) == null ? void 0 : _d2.estimatedCostUsd) || 0);
9817
9815
  const latencyDuration = Number(((_e2 = finalTrace == null ? void 0 : finalTrace.latency) == null ? void 0 : _e2.totalMs) || 0);
9818
- console.log(`[Retrivora Pipeline Telemetry] \u{1F4CA} Dispatching RAG telemetry -> Project: "${ns}", Model: "${providerName}/${modelName}", Tokens: ${tokenCount}, Latency: ${latencyDuration}ms`);
9816
+ console.log(`[Retrivora Pipeline Telemetry] \u{1F4CA} Dispatching RAG telemetry -> Project: "${ns}", Tokens: ${tokenCount}, Latency: ${latencyDuration}ms`);
9819
9817
  await fetch(absoluteUrl, {
9820
9818
  method: "POST",
9821
9819
  headers: {
@@ -10974,7 +10972,7 @@ function reportTelemetry(req, plugin, action, status, details, trace) {
10974
10972
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
10975
10973
  details
10976
10974
  };
10977
- console.log(`[Retrivora SDK Telemetry] \u{1F4CA} Dispatching telemetry -> Feature: "${action}", Status: "${status}", Project: "${projectId}", Model: "${provider}/${model}", Latency: ${latencyMs}ms`);
10975
+ console.log(`[Retrivora SDK Telemetry] Dispatching telemetry -> Feature: "${action}", Status: "${status}", Project: "${projectId}", Latency: ${latencyMs}ms`);
10978
10976
  fetch(absoluteUrl, {
10979
10977
  method: "POST",
10980
10978
  headers: {
@@ -11414,8 +11412,8 @@ function createSuggestionsHandler(configOrPlugin, options) {
11414
11412
  query = url.searchParams.get("query") || "";
11415
11413
  namespace = url.searchParams.get("namespace") || void 0;
11416
11414
  }
11417
- if (typeof query !== "string") {
11418
- return import_server.NextResponse.json({ error: "query is required" }, { status: 400 });
11415
+ if (!query || typeof query !== "string" || !query.trim()) {
11416
+ return import_server.NextResponse.json({ suggestions: [] });
11419
11417
  }
11420
11418
  const suggestions = await plugin.getSuggestions(query, namespace);
11421
11419
  reportTelemetry(req, plugin, "AUTO_SUGGESTIONS", "success", `Fetched ${suggestions.length} suggestions for: ${query.slice(0, 30)}`);
@@ -110,7 +110,7 @@ var init_templateUtils = __esm({
110
110
  async function handleGroqRequest(req, apiKeyOverride) {
111
111
  const apiKey = apiKeyOverride || process.env.GROQ_API_KEY;
112
112
  if (!apiKey) {
113
- throw new Error("Groq API Key missing. Please set GROQ_API_KEY in environment variables.");
113
+ throw new Error("LLM service credentials not configured.");
114
114
  }
115
115
  const modelName = req.model.replace(/^groq\//i, "");
116
116
  const payload = __spreadProps(__spreadValues({}, req), {
@@ -607,7 +607,6 @@ async function dispatchChatCompletion(req, apiKeyOverride) {
607
607
  const effectiveKey = customGroqKey || cleanApiKeyOverride(apiKeyOverride);
608
608
  const activeModel = req.model || targetModel || "llama-3.1-8b-instant";
609
609
  const provider = resolveProvider(activeModel);
610
- console.log(`[LLM Gateway Router] Dispatching chat request: model=${activeModel}, provider=${provider}, hasCustomKey=${Boolean(customGroqKey)}, hasGlobalGroqKey=${Boolean(process.env.GROQ_API_KEY)}`);
611
610
  try {
612
611
  switch (provider) {
613
612
  case "groq":
@@ -4713,7 +4712,6 @@ ${context != null ? context : "None"}` },
4713
4712
  return String(result2);
4714
4713
  }
4715
4714
  } catch (httpErr) {
4716
- console.warn(`[UniversalLLMAdapter] Direct HTTP POST to ${this.baseUrl}${path2} failed (${httpErr.message}). Attempting in-process gateway dispatch fallback...`);
4717
4715
  const _g2 = globalThis;
4718
4716
  let dispatch = _g2.__retrivoraDispatchChat;
4719
4717
  if (typeof dispatch !== "function") {
@@ -5360,7 +5358,7 @@ var ConfigValidator = class {
5360
5358
  // package.json
5361
5359
  var package_default = {
5362
5360
  name: "@retrivora-ai/rag-engine",
5363
- version: "2.2.3",
5361
+ version: "2.2.4",
5364
5362
  description: "Retrivora AI is a plug-and-play AI engine for RAG chat experiences \u2014 generic vector DB + LLM provider, embeddable or standalone.",
5365
5363
  author: "Abhinav Alkuchi",
5366
5364
  license: "UNLICENSED",
@@ -9780,7 +9778,7 @@ ${context}`;
9780
9778
  const tokenCount = Number(((_c2 = finalTrace == null ? void 0 : finalTrace.tokens) == null ? void 0 : _c2.totalTokens) || 0);
9781
9779
  const costEst = Number(((_d2 = finalTrace == null ? void 0 : finalTrace.tokens) == null ? void 0 : _d2.estimatedCostUsd) || 0);
9782
9780
  const latencyDuration = Number(((_e2 = finalTrace == null ? void 0 : finalTrace.latency) == null ? void 0 : _e2.totalMs) || 0);
9783
- console.log(`[Retrivora Pipeline Telemetry] \u{1F4CA} Dispatching RAG telemetry -> Project: "${ns}", Model: "${providerName}/${modelName}", Tokens: ${tokenCount}, Latency: ${latencyDuration}ms`);
9781
+ console.log(`[Retrivora Pipeline Telemetry] \u{1F4CA} Dispatching RAG telemetry -> Project: "${ns}", Tokens: ${tokenCount}, Latency: ${latencyDuration}ms`);
9784
9782
  await fetch(absoluteUrl, {
9785
9783
  method: "POST",
9786
9784
  headers: {
@@ -10939,7 +10937,7 @@ function reportTelemetry(req, plugin, action, status, details, trace) {
10939
10937
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
10940
10938
  details
10941
10939
  };
10942
- console.log(`[Retrivora SDK Telemetry] \u{1F4CA} Dispatching telemetry -> Feature: "${action}", Status: "${status}", Project: "${projectId}", Model: "${provider}/${model}", Latency: ${latencyMs}ms`);
10940
+ console.log(`[Retrivora SDK Telemetry] Dispatching telemetry -> Feature: "${action}", Status: "${status}", Project: "${projectId}", Latency: ${latencyMs}ms`);
10943
10941
  fetch(absoluteUrl, {
10944
10942
  method: "POST",
10945
10943
  headers: {
@@ -11379,8 +11377,8 @@ function createSuggestionsHandler(configOrPlugin, options) {
11379
11377
  query = url.searchParams.get("query") || "";
11380
11378
  namespace = url.searchParams.get("namespace") || void 0;
11381
11379
  }
11382
- if (typeof query !== "string") {
11383
- return NextResponse.json({ error: "query is required" }, { status: 400 });
11380
+ if (!query || typeof query !== "string" || !query.trim()) {
11381
+ return NextResponse.json({ suggestions: [] });
11384
11382
  }
11385
11383
  const suggestions = await plugin.getSuggestions(query, namespace);
11386
11384
  reportTelemetry(req, plugin, "AUTO_SUGGESTIONS", "success", `Fetched ${suggestions.length} suggestions for: ${query.slice(0, 30)}`);
package/dist/index.js CHANGED
@@ -3634,7 +3634,7 @@ function ChatWidget({ position = "bottom-right", onAddToCart, apiUrl, retrivoraA
3634
3634
  // package.json
3635
3635
  var package_default = {
3636
3636
  name: "@retrivora-ai/rag-engine",
3637
- version: "2.2.3",
3637
+ version: "2.2.4",
3638
3638
  description: "Retrivora AI is a plug-and-play AI engine for RAG chat experiences \u2014 generic vector DB + LLM provider, embeddable or standalone.",
3639
3639
  author: "Abhinav Alkuchi",
3640
3640
  license: "UNLICENSED",
package/dist/index.mjs CHANGED
@@ -3635,7 +3635,7 @@ function ChatWidget({ position = "bottom-right", onAddToCart, apiUrl, retrivoraA
3635
3635
  // package.json
3636
3636
  var package_default = {
3637
3637
  name: "@retrivora-ai/rag-engine",
3638
- version: "2.2.3",
3638
+ version: "2.2.4",
3639
3639
  description: "Retrivora AI is a plug-and-play AI engine for RAG chat experiences \u2014 generic vector DB + LLM provider, embeddable or standalone.",
3640
3640
  author: "Abhinav Alkuchi",
3641
3641
  license: "UNLICENSED",
package/dist/server.js CHANGED
@@ -125,7 +125,7 @@ var init_templateUtils = __esm({
125
125
  async function handleGroqRequest(req, apiKeyOverride) {
126
126
  const apiKey = apiKeyOverride || process.env.GROQ_API_KEY;
127
127
  if (!apiKey) {
128
- throw new Error("Groq API Key missing. Please set GROQ_API_KEY in environment variables.");
128
+ throw new Error("LLM service credentials not configured.");
129
129
  }
130
130
  const modelName = req.model.replace(/^groq\//i, "");
131
131
  const payload = __spreadProps(__spreadValues({}, req), {
@@ -622,7 +622,6 @@ async function dispatchChatCompletion(req, apiKeyOverride) {
622
622
  const effectiveKey = customGroqKey || cleanApiKeyOverride(apiKeyOverride);
623
623
  const activeModel = req.model || targetModel || "llama-3.1-8b-instant";
624
624
  const provider = resolveProvider(activeModel);
625
- console.log(`[LLM Gateway Router] Dispatching chat request: model=${activeModel}, provider=${provider}, hasCustomKey=${Boolean(customGroqKey)}, hasGlobalGroqKey=${Boolean(process.env.GROQ_API_KEY)}`);
626
625
  try {
627
626
  switch (provider) {
628
627
  case "groq":
@@ -4849,7 +4848,6 @@ ${context != null ? context : "None"}` },
4849
4848
  return String(result2);
4850
4849
  }
4851
4850
  } catch (httpErr) {
4852
- console.warn(`[UniversalLLMAdapter] Direct HTTP POST to ${this.baseUrl}${path2} failed (${httpErr.message}). Attempting in-process gateway dispatch fallback...`);
4853
4851
  const _g2 = globalThis;
4854
4852
  let dispatch = _g2.__retrivoraDispatchChat;
4855
4853
  if (typeof dispatch !== "function") {
@@ -5496,7 +5494,7 @@ var ConfigValidator = class {
5496
5494
  // package.json
5497
5495
  var package_default = {
5498
5496
  name: "@retrivora-ai/rag-engine",
5499
- version: "2.2.3",
5497
+ version: "2.2.4",
5500
5498
  description: "Retrivora AI is a plug-and-play AI engine for RAG chat experiences \u2014 generic vector DB + LLM provider, embeddable or standalone.",
5501
5499
  author: "Abhinav Alkuchi",
5502
5500
  license: "UNLICENSED",
@@ -9930,7 +9928,7 @@ ${context}`;
9930
9928
  const tokenCount = Number(((_c2 = finalTrace == null ? void 0 : finalTrace.tokens) == null ? void 0 : _c2.totalTokens) || 0);
9931
9929
  const costEst = Number(((_d2 = finalTrace == null ? void 0 : finalTrace.tokens) == null ? void 0 : _d2.estimatedCostUsd) || 0);
9932
9930
  const latencyDuration = Number(((_e2 = finalTrace == null ? void 0 : finalTrace.latency) == null ? void 0 : _e2.totalMs) || 0);
9933
- console.log(`[Retrivora Pipeline Telemetry] \u{1F4CA} Dispatching RAG telemetry -> Project: "${ns}", Model: "${providerName}/${modelName}", Tokens: ${tokenCount}, Latency: ${latencyDuration}ms`);
9931
+ console.log(`[Retrivora Pipeline Telemetry] \u{1F4CA} Dispatching RAG telemetry -> Project: "${ns}", Tokens: ${tokenCount}, Latency: ${latencyDuration}ms`);
9934
9932
  await fetch(absoluteUrl, {
9935
9933
  method: "POST",
9936
9934
  headers: {
@@ -11388,7 +11386,7 @@ function reportTelemetry(req, plugin, action, status, details, trace) {
11388
11386
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
11389
11387
  details
11390
11388
  };
11391
- console.log(`[Retrivora SDK Telemetry] \u{1F4CA} Dispatching telemetry -> Feature: "${action}", Status: "${status}", Project: "${projectId}", Model: "${provider}/${model}", Latency: ${latencyMs}ms`);
11389
+ console.log(`[Retrivora SDK Telemetry] Dispatching telemetry -> Feature: "${action}", Status: "${status}", Project: "${projectId}", Latency: ${latencyMs}ms`);
11392
11390
  fetch(absoluteUrl, {
11393
11391
  method: "POST",
11394
11392
  headers: {
@@ -11828,8 +11826,8 @@ function createSuggestionsHandler(configOrPlugin, options) {
11828
11826
  query = url.searchParams.get("query") || "";
11829
11827
  namespace = url.searchParams.get("namespace") || void 0;
11830
11828
  }
11831
- if (typeof query !== "string") {
11832
- return import_server.NextResponse.json({ error: "query is required" }, { status: 400 });
11829
+ if (!query || typeof query !== "string" || !query.trim()) {
11830
+ return import_server.NextResponse.json({ suggestions: [] });
11833
11831
  }
11834
11832
  const suggestions = await plugin.getSuggestions(query, namespace);
11835
11833
  reportTelemetry(req, plugin, "AUTO_SUGGESTIONS", "success", `Fetched ${suggestions.length} suggestions for: ${query.slice(0, 30)}`);
package/dist/server.mjs CHANGED
@@ -110,7 +110,7 @@ var init_templateUtils = __esm({
110
110
  async function handleGroqRequest(req, apiKeyOverride) {
111
111
  const apiKey = apiKeyOverride || process.env.GROQ_API_KEY;
112
112
  if (!apiKey) {
113
- throw new Error("Groq API Key missing. Please set GROQ_API_KEY in environment variables.");
113
+ throw new Error("LLM service credentials not configured.");
114
114
  }
115
115
  const modelName = req.model.replace(/^groq\//i, "");
116
116
  const payload = __spreadProps(__spreadValues({}, req), {
@@ -607,7 +607,6 @@ async function dispatchChatCompletion(req, apiKeyOverride) {
607
607
  const effectiveKey = customGroqKey || cleanApiKeyOverride(apiKeyOverride);
608
608
  const activeModel = req.model || targetModel || "llama-3.1-8b-instant";
609
609
  const provider = resolveProvider(activeModel);
610
- console.log(`[LLM Gateway Router] Dispatching chat request: model=${activeModel}, provider=${provider}, hasCustomKey=${Boolean(customGroqKey)}, hasGlobalGroqKey=${Boolean(process.env.GROQ_API_KEY)}`);
611
610
  try {
612
611
  switch (provider) {
613
612
  case "groq":
@@ -4752,7 +4751,6 @@ ${context != null ? context : "None"}` },
4752
4751
  return String(result2);
4753
4752
  }
4754
4753
  } catch (httpErr) {
4755
- console.warn(`[UniversalLLMAdapter] Direct HTTP POST to ${this.baseUrl}${path2} failed (${httpErr.message}). Attempting in-process gateway dispatch fallback...`);
4756
4754
  const _g2 = globalThis;
4757
4755
  let dispatch = _g2.__retrivoraDispatchChat;
4758
4756
  if (typeof dispatch !== "function") {
@@ -5399,7 +5397,7 @@ var ConfigValidator = class {
5399
5397
  // package.json
5400
5398
  var package_default = {
5401
5399
  name: "@retrivora-ai/rag-engine",
5402
- version: "2.2.3",
5400
+ version: "2.2.4",
5403
5401
  description: "Retrivora AI is a plug-and-play AI engine for RAG chat experiences \u2014 generic vector DB + LLM provider, embeddable or standalone.",
5404
5402
  author: "Abhinav Alkuchi",
5405
5403
  license: "UNLICENSED",
@@ -9833,7 +9831,7 @@ ${context}`;
9833
9831
  const tokenCount = Number(((_c2 = finalTrace == null ? void 0 : finalTrace.tokens) == null ? void 0 : _c2.totalTokens) || 0);
9834
9832
  const costEst = Number(((_d2 = finalTrace == null ? void 0 : finalTrace.tokens) == null ? void 0 : _d2.estimatedCostUsd) || 0);
9835
9833
  const latencyDuration = Number(((_e2 = finalTrace == null ? void 0 : finalTrace.latency) == null ? void 0 : _e2.totalMs) || 0);
9836
- console.log(`[Retrivora Pipeline Telemetry] \u{1F4CA} Dispatching RAG telemetry -> Project: "${ns}", Model: "${providerName}/${modelName}", Tokens: ${tokenCount}, Latency: ${latencyDuration}ms`);
9834
+ console.log(`[Retrivora Pipeline Telemetry] \u{1F4CA} Dispatching RAG telemetry -> Project: "${ns}", Tokens: ${tokenCount}, Latency: ${latencyDuration}ms`);
9837
9835
  await fetch(absoluteUrl, {
9838
9836
  method: "POST",
9839
9837
  headers: {
@@ -11291,7 +11289,7 @@ function reportTelemetry(req, plugin, action, status, details, trace) {
11291
11289
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
11292
11290
  details
11293
11291
  };
11294
- console.log(`[Retrivora SDK Telemetry] \u{1F4CA} Dispatching telemetry -> Feature: "${action}", Status: "${status}", Project: "${projectId}", Model: "${provider}/${model}", Latency: ${latencyMs}ms`);
11292
+ console.log(`[Retrivora SDK Telemetry] Dispatching telemetry -> Feature: "${action}", Status: "${status}", Project: "${projectId}", Latency: ${latencyMs}ms`);
11295
11293
  fetch(absoluteUrl, {
11296
11294
  method: "POST",
11297
11295
  headers: {
@@ -11731,8 +11729,8 @@ function createSuggestionsHandler(configOrPlugin, options) {
11731
11729
  query = url.searchParams.get("query") || "";
11732
11730
  namespace = url.searchParams.get("namespace") || void 0;
11733
11731
  }
11734
- if (typeof query !== "string") {
11735
- return NextResponse.json({ error: "query is required" }, { status: 400 });
11732
+ if (!query || typeof query !== "string" || !query.trim()) {
11733
+ return NextResponse.json({ suggestions: [] });
11736
11734
  }
11737
11735
  const suggestions = await plugin.getSuggestions(query, namespace);
11738
11736
  reportTelemetry(req, plugin, "AUTO_SUGGESTIONS", "success", `Fetched ${suggestions.length} suggestions for: ${query.slice(0, 30)}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@retrivora-ai/rag-engine",
3
- "version": "2.2.3",
3
+ "version": "2.2.4",
4
4
  "description": "Retrivora AI is a plug-and-play AI engine for RAG chat experiences — generic vector DB + LLM provider, embeddable or standalone.",
5
5
  "author": "Abhinav Alkuchi",
6
6
  "license": "UNLICENSED",
@@ -620,7 +620,7 @@ You are a helpful assistant. Use the provided context to answer questions accura
620
620
  const promptSources = fullSources.slice(0, 15);
621
621
  let context = promptSources.length
622
622
  ? `[SEARCH SUMMARY: Found ${totalCount} matching record(s) out of ${rawSources.length} total resources searched in database. Context includes top ${promptSources.length} relevant records]\n\n` +
623
- promptSources.map((m, i) => `[Source ${i + 1}]\n${m?.content ?? ''}`).join('\n\n---\n\n')
623
+ promptSources.map((m, i) => `[Source ${i + 1}]\n${m?.content ?? ''}`).join('\n\n---\n\n')
624
624
  : 'No relevant context found.';
625
625
 
626
626
  // Do NOT truncate UI sources — keep all qualified matches for UI citations & tables
@@ -938,7 +938,7 @@ You are a helpful assistant. Use the provided context to answer questions accura
938
938
  const costEst = Number(finalTrace?.tokens?.estimatedCostUsd || 0);
939
939
  const latencyDuration = Number(finalTrace?.latency?.totalMs || 0);
940
940
 
941
- console.log(`[Retrivora Pipeline Telemetry] 📊 Dispatching RAG telemetry -> Project: "${ns}", Model: "${providerName}/${modelName}", Tokens: ${tokenCount}, Latency: ${latencyDuration}ms`);
941
+ console.log(`[Retrivora Pipeline Telemetry] 📊 Dispatching RAG telemetry -> Project: "${ns}", Tokens: ${tokenCount}, Latency: ${latencyDuration}ms`);
942
942
 
943
943
  await fetch(absoluteUrl, {
944
944
  method: 'POST',
@@ -208,7 +208,7 @@ function reportTelemetry(
208
208
  details,
209
209
  };
210
210
 
211
- console.log(`[Retrivora SDK Telemetry] 📊 Dispatching telemetry -> Feature: "${action}", Status: "${status}", Project: "${projectId}", Model: "${provider}/${model}", Latency: ${latencyMs}ms`);
211
+ console.log(`[Retrivora SDK Telemetry] Dispatching telemetry -> Feature: "${action}", Status: "${status}", Project: "${projectId}", Latency: ${latencyMs}ms`);
212
212
 
213
213
  fetch(absoluteUrl, {
214
214
  method: 'POST',
@@ -766,8 +766,8 @@ export function createSuggestionsHandler(
766
766
  namespace = url.searchParams.get('namespace') || undefined;
767
767
  }
768
768
 
769
- if (typeof query !== 'string') {
770
- return NextResponse.json({ error: 'query is required' }, { status: 400 });
769
+ if (!query || typeof query !== 'string' || !query.trim()) {
770
+ return NextResponse.json({ suggestions: [] });
771
771
  }
772
772
 
773
773
  const suggestions = await plugin.getSuggestions(query, namespace);
@@ -121,7 +121,7 @@ export class UniversalLLMAdapter implements ILLMProvider {
121
121
  return String(result);
122
122
  }
123
123
  } catch (httpErr: any) {
124
- console.warn(`[UniversalLLMAdapter] Direct HTTP POST to ${this.baseUrl}${path} failed (${httpErr.message}). Attempting in-process gateway dispatch fallback...`);
124
+ // Direct POST fallback attempt
125
125
 
126
126
  const _g = globalThis as any;
127
127
  let dispatch = _g.__retrivoraDispatchChat;