@retrivora-ai/rag-engine 2.4.9 → 2.5.0

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.
@@ -318,7 +318,7 @@ var init_package = __esm({
318
318
  "package.json"() {
319
319
  package_default = {
320
320
  name: "@retrivora-ai/rag-engine",
321
- version: "2.4.9",
321
+ version: "2.5.0",
322
322
  description: "Retrivora AI is a plug-and-play AI engine for RAG chat experiences \u2014 generic vector DB + LLM provider, embeddable or standalone.",
323
323
  author: "Abhinav Alkuchi",
324
324
  license: "UNLICENSED",
@@ -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.4.9",
315
+ version: "2.5.0",
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",
package/dist/index.d.mts CHANGED
@@ -166,4 +166,36 @@ declare function useProjectSettings(projectId: string, options?: UseProjectSetti
166
166
  */
167
167
  declare function addSynonyms(customSynonyms: Record<string, string[]>): void;
168
168
 
169
- export { ChatWidget, ChatWidgetProps, ChatWindow, ChatWindowProps, ClientConfig, CodeViewer, ConfigProvider, DocumentUpload, DocumentUploadProps, MessageBubble, MessageBubbleProps, ObservabilityPanel, ObservabilityTrace, ProductCard, ProductCardProps, ProductCarousel, ProductCarouselProps, ProjectChatSettings, RemoteConfig, SourceCard, SourceCardProps, type UIBlock, UIBlockRenderer, UIDispatcher, type UseProjectSettingsOptions, type UseProjectSettingsReturn, UseRagChatOptions, UseRagChatReturn, VisualizationRenderer, addSynonyms, useConfig, useProjectSettings, useRagChat };
169
+ interface RetrivoraInitOptions {
170
+ projectId: string;
171
+ licenseKey: string;
172
+ apiBase?: string;
173
+ primaryColor?: string;
174
+ secondaryColor?: string;
175
+ theme?: string;
176
+ }
177
+ declare class RetrivoraBrowserClient {
178
+ projectId: string;
179
+ licenseKey: string;
180
+ apiBase: string;
181
+ primaryColor?: string;
182
+ secondaryColor?: string;
183
+ theme?: string;
184
+ constructor(options?: RetrivoraInitOptions);
185
+ init(options: RetrivoraInitOptions): void;
186
+ chat(message: string, options?: {
187
+ history?: any[];
188
+ namespace?: string;
189
+ }): Promise<{
190
+ reply: any;
191
+ sources: any;
192
+ trace: any;
193
+ ui_transformation: any;
194
+ }>;
195
+ upload(file: File): Promise<any>;
196
+ suggest(query: string): Promise<any>;
197
+ private ensureInitialized;
198
+ }
199
+ declare const retrivora: RetrivoraBrowserClient;
200
+
201
+ export { ChatWidget, ChatWidgetProps, ChatWindow, ChatWindowProps, ClientConfig, CodeViewer, ConfigProvider, DocumentUpload, DocumentUploadProps, MessageBubble, MessageBubbleProps, ObservabilityPanel, ObservabilityTrace, ProductCard, ProductCardProps, ProductCarousel, ProductCarouselProps, ProjectChatSettings, RemoteConfig, type RetrivoraInitOptions, SourceCard, SourceCardProps, type UIBlock, UIBlockRenderer, UIDispatcher, type UseProjectSettingsOptions, type UseProjectSettingsReturn, UseRagChatOptions, UseRagChatReturn, VisualizationRenderer, addSynonyms, retrivora, useConfig, useProjectSettings, useRagChat };
package/dist/index.d.ts CHANGED
@@ -166,4 +166,36 @@ declare function useProjectSettings(projectId: string, options?: UseProjectSetti
166
166
  */
167
167
  declare function addSynonyms(customSynonyms: Record<string, string[]>): void;
168
168
 
169
- export { ChatWidget, ChatWidgetProps, ChatWindow, ChatWindowProps, ClientConfig, CodeViewer, ConfigProvider, DocumentUpload, DocumentUploadProps, MessageBubble, MessageBubbleProps, ObservabilityPanel, ObservabilityTrace, ProductCard, ProductCardProps, ProductCarousel, ProductCarouselProps, ProjectChatSettings, RemoteConfig, SourceCard, SourceCardProps, type UIBlock, UIBlockRenderer, UIDispatcher, type UseProjectSettingsOptions, type UseProjectSettingsReturn, UseRagChatOptions, UseRagChatReturn, VisualizationRenderer, addSynonyms, useConfig, useProjectSettings, useRagChat };
169
+ interface RetrivoraInitOptions {
170
+ projectId: string;
171
+ licenseKey: string;
172
+ apiBase?: string;
173
+ primaryColor?: string;
174
+ secondaryColor?: string;
175
+ theme?: string;
176
+ }
177
+ declare class RetrivoraBrowserClient {
178
+ projectId: string;
179
+ licenseKey: string;
180
+ apiBase: string;
181
+ primaryColor?: string;
182
+ secondaryColor?: string;
183
+ theme?: string;
184
+ constructor(options?: RetrivoraInitOptions);
185
+ init(options: RetrivoraInitOptions): void;
186
+ chat(message: string, options?: {
187
+ history?: any[];
188
+ namespace?: string;
189
+ }): Promise<{
190
+ reply: any;
191
+ sources: any;
192
+ trace: any;
193
+ ui_transformation: any;
194
+ }>;
195
+ upload(file: File): Promise<any>;
196
+ suggest(query: string): Promise<any>;
197
+ private ensureInitialized;
198
+ }
199
+ declare const retrivora: RetrivoraBrowserClient;
200
+
201
+ export { ChatWidget, ChatWidgetProps, ChatWindow, ChatWindowProps, ClientConfig, CodeViewer, ConfigProvider, DocumentUpload, DocumentUploadProps, MessageBubble, MessageBubbleProps, ObservabilityPanel, ObservabilityTrace, ProductCard, ProductCardProps, ProductCarousel, ProductCarouselProps, ProjectChatSettings, RemoteConfig, type RetrivoraInitOptions, SourceCard, SourceCardProps, type UIBlock, UIBlockRenderer, UIDispatcher, type UseProjectSettingsOptions, type UseProjectSettingsReturn, UseRagChatOptions, UseRagChatReturn, VisualizationRenderer, addSynonyms, retrivora, useConfig, useProjectSettings, useRagChat };
package/dist/index.js CHANGED
@@ -92,6 +92,7 @@ __export(index_exports, {
92
92
  isTransientError: () => isTransientError,
93
93
  normalizeProjectSettings: () => normalizeProjectSettings,
94
94
  projectSettingsToUiConfig: () => projectSettingsToUiConfig,
95
+ retrivora: () => retrivora,
95
96
  useConfig: () => useConfig,
96
97
  useProjectSettings: () => useProjectSettings,
97
98
  useRagChat: () => useRagChat
@@ -356,7 +357,7 @@ function projectSettingsToUiConfig(settings) {
356
357
  // package.json
357
358
  var package_default = {
358
359
  name: "@retrivora-ai/rag-engine",
359
- version: "2.4.9",
360
+ version: "2.5.0",
360
361
  description: "Retrivora AI is a plug-and-play AI engine for RAG chat experiences \u2014 generic vector DB + LLM provider, embeddable or standalone.",
361
362
  author: "Abhinav Alkuchi",
362
363
  license: "UNLICENSED",
@@ -5824,6 +5825,98 @@ ${errorMessages}`
5824
5825
  return { results, errors, totalProcessed, totalFailed };
5825
5826
  }
5826
5827
  };
5828
+
5829
+ // src/core/RetrivoraBrowserClient.ts
5830
+ var RetrivoraBrowserClient = class {
5831
+ constructor(options) {
5832
+ this.projectId = "";
5833
+ this.licenseKey = "";
5834
+ this.apiBase = "https://www.retrivora.com/api";
5835
+ if (options) {
5836
+ this.init(options);
5837
+ }
5838
+ }
5839
+ init(options) {
5840
+ this.projectId = options.projectId;
5841
+ this.licenseKey = options.licenseKey;
5842
+ this.primaryColor = options.primaryColor;
5843
+ this.secondaryColor = options.secondaryColor;
5844
+ this.theme = options.theme;
5845
+ if (options.apiBase) {
5846
+ this.apiBase = options.apiBase;
5847
+ } else if (typeof window !== "undefined") {
5848
+ this.apiBase = `${window.location.origin}/api`;
5849
+ }
5850
+ }
5851
+ async chat(message, options) {
5852
+ var _a, _b, _c;
5853
+ this.ensureInitialized();
5854
+ const res = await fetch(`${this.apiBase}/v1/chat/completions`, {
5855
+ method: "POST",
5856
+ headers: {
5857
+ "Content-Type": "application/json",
5858
+ "Authorization": `Bearer ${this.licenseKey}`,
5859
+ "X-Project-Id": this.projectId
5860
+ },
5861
+ body: JSON.stringify({
5862
+ messages: [
5863
+ ...(options == null ? void 0 : options.history) || [],
5864
+ { role: "user", content: message }
5865
+ ],
5866
+ model: "llama-3.1-8b-instant",
5867
+ stream: false
5868
+ })
5869
+ });
5870
+ if (!res.ok) {
5871
+ const errData = await res.json().catch(() => ({}));
5872
+ throw new Error(errData.error || `Chat completions failed with status: ${res.status}`);
5873
+ }
5874
+ const data = await res.json();
5875
+ return {
5876
+ reply: ((_c = (_b = (_a = data.choices) == null ? void 0 : _a[0]) == null ? void 0 : _b.message) == null ? void 0 : _c.content) || "",
5877
+ sources: data.sources || [],
5878
+ trace: data.trace || null,
5879
+ ui_transformation: data.ui_transformation || null
5880
+ };
5881
+ }
5882
+ async upload(file) {
5883
+ this.ensureInitialized();
5884
+ const formData = new FormData();
5885
+ formData.append("file", file);
5886
+ formData.append("projectId", this.projectId);
5887
+ const res = await fetch(`${this.apiBase}/upload`, {
5888
+ method: "POST",
5889
+ headers: {
5890
+ "Authorization": `Bearer ${this.licenseKey}`
5891
+ },
5892
+ body: formData
5893
+ });
5894
+ if (!res.ok) {
5895
+ const errData = await res.json().catch(() => ({}));
5896
+ throw new Error(errData.error || `Upload failed with status: ${res.status}`);
5897
+ }
5898
+ return res.json();
5899
+ }
5900
+ async suggest(query) {
5901
+ this.ensureInitialized();
5902
+ const res = await fetch(`${this.apiBase}/suggestions?q=${encodeURIComponent(query)}&projectId=${this.projectId}`, {
5903
+ headers: {
5904
+ "Authorization": `Bearer ${this.licenseKey}`
5905
+ }
5906
+ });
5907
+ if (!res.ok) {
5908
+ const errData = await res.json().catch(() => ({}));
5909
+ throw new Error(errData.error || `Suggestions fetch failed with status: ${res.status}`);
5910
+ }
5911
+ return res.json();
5912
+ }
5913
+ ensureInitialized() {
5914
+ if (!this.projectId || !this.licenseKey) {
5915
+ throw new Error("[Retrivora SDK] Client not initialized. Run retrivora.init({ projectId, licenseKey }) first.");
5916
+ }
5917
+ }
5918
+ };
5919
+ var retrivora = new RetrivoraBrowserClient();
5827
5920
  // Annotate the CommonJS export names for ESM import in node:
5828
5921
  0 && (module.exports = {
5829
5922
  AuthenticationException,
@@ -5858,6 +5951,7 @@ ${errorMessages}`
5858
5951
  isTransientError,
5859
5952
  normalizeProjectSettings,
5860
5953
  projectSettingsToUiConfig,
5954
+ retrivora,
5861
5955
  useConfig,
5862
5956
  useProjectSettings,
5863
5957
  useRagChat
package/dist/index.mjs CHANGED
@@ -312,7 +312,7 @@ function projectSettingsToUiConfig(settings) {
312
312
  // package.json
313
313
  var package_default = {
314
314
  name: "@retrivora-ai/rag-engine",
315
- version: "2.4.9",
315
+ version: "2.5.0",
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",
@@ -5826,6 +5826,98 @@ ${errorMessages}`
5826
5826
  return { results, errors, totalProcessed, totalFailed };
5827
5827
  }
5828
5828
  };
5829
+
5830
+ // src/core/RetrivoraBrowserClient.ts
5831
+ var RetrivoraBrowserClient = class {
5832
+ constructor(options) {
5833
+ this.projectId = "";
5834
+ this.licenseKey = "";
5835
+ this.apiBase = "https://www.retrivora.com/api";
5836
+ if (options) {
5837
+ this.init(options);
5838
+ }
5839
+ }
5840
+ init(options) {
5841
+ this.projectId = options.projectId;
5842
+ this.licenseKey = options.licenseKey;
5843
+ this.primaryColor = options.primaryColor;
5844
+ this.secondaryColor = options.secondaryColor;
5845
+ this.theme = options.theme;
5846
+ if (options.apiBase) {
5847
+ this.apiBase = options.apiBase;
5848
+ } else if (typeof window !== "undefined") {
5849
+ this.apiBase = `${window.location.origin}/api`;
5850
+ }
5851
+ }
5852
+ async chat(message, options) {
5853
+ var _a, _b, _c;
5854
+ this.ensureInitialized();
5855
+ const res = await fetch(`${this.apiBase}/v1/chat/completions`, {
5856
+ method: "POST",
5857
+ headers: {
5858
+ "Content-Type": "application/json",
5859
+ "Authorization": `Bearer ${this.licenseKey}`,
5860
+ "X-Project-Id": this.projectId
5861
+ },
5862
+ body: JSON.stringify({
5863
+ messages: [
5864
+ ...(options == null ? void 0 : options.history) || [],
5865
+ { role: "user", content: message }
5866
+ ],
5867
+ model: "llama-3.1-8b-instant",
5868
+ stream: false
5869
+ })
5870
+ });
5871
+ if (!res.ok) {
5872
+ const errData = await res.json().catch(() => ({}));
5873
+ throw new Error(errData.error || `Chat completions failed with status: ${res.status}`);
5874
+ }
5875
+ const data = await res.json();
5876
+ return {
5877
+ reply: ((_c = (_b = (_a = data.choices) == null ? void 0 : _a[0]) == null ? void 0 : _b.message) == null ? void 0 : _c.content) || "",
5878
+ sources: data.sources || [],
5879
+ trace: data.trace || null,
5880
+ ui_transformation: data.ui_transformation || null
5881
+ };
5882
+ }
5883
+ async upload(file) {
5884
+ this.ensureInitialized();
5885
+ const formData = new FormData();
5886
+ formData.append("file", file);
5887
+ formData.append("projectId", this.projectId);
5888
+ const res = await fetch(`${this.apiBase}/upload`, {
5889
+ method: "POST",
5890
+ headers: {
5891
+ "Authorization": `Bearer ${this.licenseKey}`
5892
+ },
5893
+ body: formData
5894
+ });
5895
+ if (!res.ok) {
5896
+ const errData = await res.json().catch(() => ({}));
5897
+ throw new Error(errData.error || `Upload failed with status: ${res.status}`);
5898
+ }
5899
+ return res.json();
5900
+ }
5901
+ async suggest(query) {
5902
+ this.ensureInitialized();
5903
+ const res = await fetch(`${this.apiBase}/suggestions?q=${encodeURIComponent(query)}&projectId=${this.projectId}`, {
5904
+ headers: {
5905
+ "Authorization": `Bearer ${this.licenseKey}`
5906
+ }
5907
+ });
5908
+ if (!res.ok) {
5909
+ const errData = await res.json().catch(() => ({}));
5910
+ throw new Error(errData.error || `Suggestions fetch failed with status: ${res.status}`);
5911
+ }
5912
+ return res.json();
5913
+ }
5914
+ ensureInitialized() {
5915
+ if (!this.projectId || !this.licenseKey) {
5916
+ throw new Error("[Retrivora SDK] Client not initialized. Run retrivora.init({ projectId, licenseKey }) first.");
5917
+ }
5918
+ }
5919
+ };
5920
+ var retrivora = new RetrivoraBrowserClient();
5829
5921
  export {
5830
5922
  AuthenticationException,
5831
5923
  BatchProcessor,
@@ -5859,6 +5951,7 @@ export {
5859
5951
  isTransientError,
5860
5952
  normalizeProjectSettings,
5861
5953
  projectSettingsToUiConfig,
5954
+ retrivora,
5862
5955
  useConfig,
5863
5956
  useProjectSettings,
5864
5957
  useRagChat
package/dist/server.js CHANGED
@@ -332,7 +332,7 @@ var init_package = __esm({
332
332
  "package.json"() {
333
333
  package_default = {
334
334
  name: "@retrivora-ai/rag-engine",
335
- version: "2.4.9",
335
+ version: "2.5.0",
336
336
  description: "Retrivora AI is a plug-and-play AI engine for RAG chat experiences \u2014 generic vector DB + LLM provider, embeddable or standalone.",
337
337
  author: "Abhinav Alkuchi",
338
338
  license: "UNLICENSED",
package/dist/server.mjs CHANGED
@@ -326,7 +326,7 @@ var init_package = __esm({
326
326
  "package.json"() {
327
327
  package_default = {
328
328
  name: "@retrivora-ai/rag-engine",
329
- version: "2.4.9",
329
+ version: "2.5.0",
330
330
  description: "Retrivora AI is a plug-and-play AI engine for RAG chat experiences \u2014 generic vector DB + LLM provider, embeddable or standalone.",
331
331
  author: "Abhinav Alkuchi",
332
332
  license: "UNLICENSED",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@retrivora-ai/rag-engine",
3
- "version": "2.4.9",
3
+ "version": "2.5.0",
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",