@retrivora-ai/rag-engine 2.2.2 → 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.2",
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: {
@@ -10940,7 +10938,7 @@ function reportTelemetry(req, plugin, action, status, details, trace) {
10940
10938
  const licenseKey = config.licenseKey || process.env.RAG_LICENSE_KEY || process.env.RETRIVORA_LICENSE_KEY || process.env.NEXT_PUBLIC_RETRIVORA_LICENSE_KEY;
10941
10939
  const telemetryConfig = config.telemetry;
10942
10940
  const enabled = (_a2 = telemetryConfig == null ? void 0 : telemetryConfig.enabled) != null ? _a2 : Boolean(licenseKey);
10943
- const defaultUrl = process.env.NODE_ENV === "development" && !process.env.TELEMETRY_URL && !process.env.NEXT_PUBLIC_TELEMETRY_URL ? "http://localhost:3001/api/telemetry" : "https://retrivora.com/api/telemetry";
10941
+ const defaultUrl = process.env.NODE_ENV === "development" && !process.env.TELEMETRY_URL && !process.env.NEXT_PUBLIC_TELEMETRY_URL ? "http://localhost:3001/api/telemetry" : "https://www.retrivora.com/api/telemetry";
10944
10942
  const telemetryUrl = (telemetryConfig == null ? void 0 : telemetryConfig.url) || process.env.TELEMETRY_URL || process.env.NEXT_PUBLIC_TELEMETRY_URL || defaultUrl;
10945
10943
  const host = req.headers.get("host") || "localhost";
10946
10944
  const userAgent = req.headers.get("user-agent") || `Retrivora-SDK/${SDK_VERSION}`;
@@ -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.2",
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: {
@@ -10905,7 +10903,7 @@ function reportTelemetry(req, plugin, action, status, details, trace) {
10905
10903
  const licenseKey = config.licenseKey || process.env.RAG_LICENSE_KEY || process.env.RETRIVORA_LICENSE_KEY || process.env.NEXT_PUBLIC_RETRIVORA_LICENSE_KEY;
10906
10904
  const telemetryConfig = config.telemetry;
10907
10905
  const enabled = (_a2 = telemetryConfig == null ? void 0 : telemetryConfig.enabled) != null ? _a2 : Boolean(licenseKey);
10908
- const defaultUrl = process.env.NODE_ENV === "development" && !process.env.TELEMETRY_URL && !process.env.NEXT_PUBLIC_TELEMETRY_URL ? "http://localhost:3001/api/telemetry" : "https://retrivora.com/api/telemetry";
10906
+ const defaultUrl = process.env.NODE_ENV === "development" && !process.env.TELEMETRY_URL && !process.env.NEXT_PUBLIC_TELEMETRY_URL ? "http://localhost:3001/api/telemetry" : "https://www.retrivora.com/api/telemetry";
10909
10907
  const telemetryUrl = (telemetryConfig == null ? void 0 : telemetryConfig.url) || process.env.TELEMETRY_URL || process.env.NEXT_PUBLIC_TELEMETRY_URL || defaultUrl;
10910
10908
  const host = req.headers.get("host") || "localhost";
10911
10909
  const userAgent = req.headers.get("user-agent") || `Retrivora-SDK/${SDK_VERSION}`;
@@ -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.css CHANGED
@@ -112,6 +112,7 @@
112
112
  --color-white: #fff;
113
113
  --spacing: 0.25rem;
114
114
  --container-xs: 20rem;
115
+ --container-sm: 24rem;
115
116
  --container-md: 28rem;
116
117
  --container-2xl: 42rem;
117
118
  --container-4xl: 56rem;
@@ -123,11 +124,14 @@
123
124
  --text-base--line-height: calc(1.5 / 1);
124
125
  --text-lg: 1.125rem;
125
126
  --text-lg--line-height: calc(1.75 / 1.125);
127
+ --text-xl: 1.25rem;
128
+ --text-xl--line-height: calc(1.75 / 1.25);
126
129
  --text-3xl: 1.875rem;
127
130
  --text-3xl--line-height: calc(2.25 / 1.875);
128
131
  --font-weight-medium: 500;
129
132
  --font-weight-semibold: 600;
130
133
  --font-weight-bold: 700;
134
+ --font-weight-extrabold: 800;
131
135
  --tracking-tight: -0.025em;
132
136
  --tracking-wider: 0.05em;
133
137
  --tracking-widest: 0.1em;
@@ -759,6 +763,9 @@
759
763
  .max-w-none {
760
764
  max-width: none;
761
765
  }
766
+ .max-w-sm {
767
+ max-width: var(--container-sm);
768
+ }
762
769
  .max-w-xs {
763
770
  max-width: var(--container-xs);
764
771
  }
@@ -777,6 +784,9 @@
777
784
  .flex-shrink-0 {
778
785
  flex-shrink: 0;
779
786
  }
787
+ .shrink-0 {
788
+ flex-shrink: 0;
789
+ }
780
790
  .flex-grow {
781
791
  flex-grow: 1;
782
792
  }
@@ -930,6 +940,9 @@
930
940
  .gap-2 {
931
941
  gap: calc(var(--spacing) * 2);
932
942
  }
943
+ .gap-2\.5 {
944
+ gap: calc(var(--spacing) * 2.5);
945
+ }
933
946
  .gap-3 {
934
947
  gap: calc(var(--spacing) * 3);
935
948
  }
@@ -1111,6 +1124,12 @@
1111
1124
  .border-emerald-100 {
1112
1125
  border-color: var(--color-emerald-100);
1113
1126
  }
1127
+ .border-emerald-100\/50 {
1128
+ border-color: color-mix(in srgb, oklch(95% 0.052 163.051) 50%, transparent);
1129
+ @supports (color: color-mix(in lab, red, red)) {
1130
+ border-color: color-mix(in oklab, var(--color-emerald-100) 50%, transparent);
1131
+ }
1132
+ }
1114
1133
  .border-emerald-200 {
1115
1134
  border-color: var(--color-emerald-200);
1116
1135
  }
@@ -1363,6 +1382,12 @@
1363
1382
  .bg-slate-950 {
1364
1383
  background-color: var(--color-slate-950);
1365
1384
  }
1385
+ .bg-slate-950\/70 {
1386
+ background-color: color-mix(in srgb, oklch(12.9% 0.042 264.695) 70%, transparent);
1387
+ @supports (color: color-mix(in lab, red, red)) {
1388
+ background-color: color-mix(in oklab, var(--color-slate-950) 70%, transparent);
1389
+ }
1390
+ }
1366
1391
  .bg-transparent {
1367
1392
  background-color: transparent;
1368
1393
  }
@@ -1520,6 +1545,10 @@
1520
1545
  font-size: var(--text-sm);
1521
1546
  line-height: var(--tw-leading, var(--text-sm--line-height));
1522
1547
  }
1548
+ .text-xl {
1549
+ font-size: var(--text-xl);
1550
+ line-height: var(--tw-leading, var(--text-xl--line-height));
1551
+ }
1523
1552
  .text-xs {
1524
1553
  font-size: var(--text-xs);
1525
1554
  line-height: var(--tw-leading, var(--text-xs--line-height));
@@ -1551,6 +1580,10 @@
1551
1580
  --tw-font-weight: var(--font-weight-bold);
1552
1581
  font-weight: var(--font-weight-bold);
1553
1582
  }
1583
+ .font-extrabold {
1584
+ --tw-font-weight: var(--font-weight-extrabold);
1585
+ font-weight: var(--font-weight-extrabold);
1586
+ }
1554
1587
  .font-medium {
1555
1588
  --tw-font-weight: var(--font-weight-medium);
1556
1589
  font-weight: var(--font-weight-medium);
@@ -1649,6 +1682,9 @@
1649
1682
  .text-emerald-800 {
1650
1683
  color: var(--color-emerald-800);
1651
1684
  }
1685
+ .text-emerald-900 {
1686
+ color: var(--color-emerald-900);
1687
+ }
1652
1688
  .text-emerald-950 {
1653
1689
  color: var(--color-emerald-950);
1654
1690
  }
@@ -2363,6 +2399,14 @@
2363
2399
  }
2364
2400
  }
2365
2401
  }
2402
+ .dark\:border-emerald-500\/10 {
2403
+ @media (prefers-color-scheme: dark) {
2404
+ border-color: color-mix(in srgb, oklch(69.6% 0.17 162.48) 10%, transparent);
2405
+ @supports (color: color-mix(in lab, red, red)) {
2406
+ border-color: color-mix(in oklab, var(--color-emerald-500) 10%, transparent);
2407
+ }
2408
+ }
2409
+ }
2366
2410
  .dark\:border-emerald-500\/20 {
2367
2411
  @media (prefers-color-scheme: dark) {
2368
2412
  border-color: color-mix(in srgb, oklch(69.6% 0.17 162.48) 20%, transparent);