@retrivora-ai/rag-engine 2.1.3 → 2.1.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.
package/dist/server.d.mts CHANGED
@@ -1,9 +1,9 @@
1
- import { V as VectorDBConfig, L as LLMConfig, d as EmbeddingConfig, i as RagConfig, n as UniversalRagConfig, o as UpsertDocument, q as VectorMatch, G as GraphDBConfig, r as GraphNode, s as Edge, t as GraphSearchResult, I as ILLMProvider, p as VectorDBProvider, g as LLMProvider, e as EmbeddingProvider, R as RAGConfig, m as UIConfig, C as ChatMessage, b as ChatOptions, E as EmbedOptions } from './ILLMProvider-0rRBYbVW.mjs';
2
- export { B as BarChartData, u as CarouselProduct, c as ChatResponse, v as IRetriever, f as IngestDocument, h as LatencyBreakdown, w as LineChartDataPoint, M as MessageRole, x as MetricCardData, O as ObservabilityTrace, P as PieChartData, y as Product, j as RagMessage, k as RetrievalConfig, z as RetrievalResult, l as RetrievedChunk, A as RetrivoraChunkMetadata, D as RetrivoraIngestedDocument, S as ScatterPlotDataPoint, F as SuggestionsResponse, H as TableData, T as TokenUsage, J as UITransformationResponse, U as UseRagChatOptions, a as UseRagChatReturn, K as VisualizationType, W as WorkflowConfig } from './ILLMProvider-0rRBYbVW.mjs';
3
- import { I as IRenderRule, i as DecisionContext, k as IntentCategory, n as RenderDecision } from './index-B1wGUlSL.mjs';
4
- export { w as ArchitectureCardProps, A as AuthenticationException, x as CarouselRendererStrategy, y as ChartRendererStrategy, e as ChartType, z as ChatViewportSize, C as ChatWidgetProps, a as ChatWindowProps, f as Chunk, g as ChunkOptions, c as ClientConfig, b as ConfigProviderProps, h as ConfigurationException, B as DocumentChunker, D as DocumentUploadProps, E as EmbeddingFailedException, j as IRendererStrategy, l as IntentClassifier, M as MessageBubbleProps, F as MixedRendererStrategy, G as Pipeline, H as PipelineStep, P as ProductCardProps, d as ProductCarouselProps, m as ProviderNotFoundException, J as ProviderPill, R as RateLimitException, K as RenderSectionDecision, o as RenderType, p as RendererRegistry, q as RetrievalException, r as Retrivora, s as RetrivoraError, t as RetrivoraErrorCode, u as RuleEngine, L as Snippet, S as SourceCardProps, T as TableRendererStrategy, N as TextRendererStrategy, V as VisualizationDecisionEngine, v as decideVisualization, O as wrapError } from './index-B1wGUlSL.mjs';
5
- import { H as HealthCheckResult, I as IProviderValidator, a as IProviderHealthChecker } from './index-BvODr57d.mjs';
6
- export { C as ConfigValidator, V as ValidationError, b as VectorPlugin, c as createChatHandler, d as createFeedbackHandler, e as createHealthHandler, f as createHistoryHandler, g as createIngestHandler, h as createRagHandler, i as createSessionsHandler, j as createStreamHandler, k as createUploadHandler, s as sseErrorFrame, l as sseFrame, m as sseMetaFrame, n as sseTextFrame } from './index-BvODr57d.mjs';
1
+ import { V as VectorDBConfig, L as LLMConfig, d as EmbeddingConfig, i as RagConfig, n as UniversalRagConfig, o as UpsertDocument, q as VectorMatch, G as GraphDBConfig, r as GraphNode, s as Edge, t as GraphSearchResult, I as ILLMProvider, p as VectorDBProvider, g as LLMProvider, e as EmbeddingProvider, R as RAGConfig, m as UIConfig, C as ChatMessage, b as ChatOptions, E as EmbedOptions } from './ILLMProvider-BWa68XX5.mjs';
2
+ export { B as BarChartData, u as CarouselProduct, c as ChatResponse, v as IRetriever, f as IngestDocument, h as LatencyBreakdown, w as LineChartDataPoint, M as MessageRole, x as MetricCardData, O as ObservabilityTrace, P as PieChartData, y as Product, j as RagMessage, k as RetrievalConfig, z as RetrievalResult, l as RetrievedChunk, A as RetrivoraChunkMetadata, D as RetrivoraIngestedDocument, S as ScatterPlotDataPoint, F as SuggestionsResponse, H as TableData, T as TokenUsage, J as UITransformationResponse, U as UseRagChatOptions, a as UseRagChatReturn, K as VisualizationType, W as WorkflowConfig } from './ILLMProvider-BWa68XX5.mjs';
3
+ import { I as IRenderRule, i as DecisionContext, k as IntentCategory, n as RenderDecision } from './index-BbJGyNmW.mjs';
4
+ export { x as ArchitectureCardProps, A as AuthenticationException, y as CarouselRendererStrategy, z as ChartRendererStrategy, e as ChartType, B as ChatViewportSize, C as ChatWidgetProps, a as ChatWindowProps, f as Chunk, g as ChunkOptions, c as ClientConfig, b as ConfigProviderProps, h as ConfigurationException, F as DocumentChunker, D as DocumentUploadProps, E as EmbeddingFailedException, j as IRendererStrategy, l as IntentClassifier, M as MessageBubbleProps, G as MixedRendererStrategy, H as Pipeline, J as PipelineStep, P as ProductCardProps, d as ProductCarouselProps, m as ProviderNotFoundException, K as ProviderPill, R as RateLimitException, L as RenderSectionDecision, o as RenderType, p as RendererRegistry, q as RetrievalException, r as Retrivora, s as RetrivoraError, t as RetrivoraErrorCode, u as RuleEngine, v as SDK_VERSION, N as Snippet, S as SourceCardProps, T as TableRendererStrategy, O as TextRendererStrategy, V as VisualizationDecisionEngine, w as decideVisualization, Q as wrapError } from './index-BbJGyNmW.mjs';
5
+ import { H as HealthCheckResult, I as IProviderValidator, a as IProviderHealthChecker } from './index-DFc_Ll9z.mjs';
6
+ export { C as ConfigValidator, V as ValidationError, b as VectorPlugin, c as createChatHandler, d as createFeedbackHandler, e as createHealthHandler, f as createHistoryHandler, g as createIngestHandler, h as createRagHandler, i as createSessionsHandler, j as createStreamHandler, k as createUploadHandler, s as sseErrorFrame, l as sseFrame, m as sseMetaFrame, n as sseTextFrame } from './index-DFc_Ll9z.mjs';
7
7
  import 'react';
8
8
  import 'next/server';
9
9
 
package/dist/server.d.ts CHANGED
@@ -1,9 +1,9 @@
1
- import { V as VectorDBConfig, L as LLMConfig, d as EmbeddingConfig, i as RagConfig, n as UniversalRagConfig, o as UpsertDocument, q as VectorMatch, G as GraphDBConfig, r as GraphNode, s as Edge, t as GraphSearchResult, I as ILLMProvider, p as VectorDBProvider, g as LLMProvider, e as EmbeddingProvider, R as RAGConfig, m as UIConfig, C as ChatMessage, b as ChatOptions, E as EmbedOptions } from './ILLMProvider-0rRBYbVW.js';
2
- export { B as BarChartData, u as CarouselProduct, c as ChatResponse, v as IRetriever, f as IngestDocument, h as LatencyBreakdown, w as LineChartDataPoint, M as MessageRole, x as MetricCardData, O as ObservabilityTrace, P as PieChartData, y as Product, j as RagMessage, k as RetrievalConfig, z as RetrievalResult, l as RetrievedChunk, A as RetrivoraChunkMetadata, D as RetrivoraIngestedDocument, S as ScatterPlotDataPoint, F as SuggestionsResponse, H as TableData, T as TokenUsage, J as UITransformationResponse, U as UseRagChatOptions, a as UseRagChatReturn, K as VisualizationType, W as WorkflowConfig } from './ILLMProvider-0rRBYbVW.js';
3
- import { I as IRenderRule, i as DecisionContext, k as IntentCategory, n as RenderDecision } from './index-DcklhThn.js';
4
- export { w as ArchitectureCardProps, A as AuthenticationException, x as CarouselRendererStrategy, y as ChartRendererStrategy, e as ChartType, z as ChatViewportSize, C as ChatWidgetProps, a as ChatWindowProps, f as Chunk, g as ChunkOptions, c as ClientConfig, b as ConfigProviderProps, h as ConfigurationException, B as DocumentChunker, D as DocumentUploadProps, E as EmbeddingFailedException, j as IRendererStrategy, l as IntentClassifier, M as MessageBubbleProps, F as MixedRendererStrategy, G as Pipeline, H as PipelineStep, P as ProductCardProps, d as ProductCarouselProps, m as ProviderNotFoundException, J as ProviderPill, R as RateLimitException, K as RenderSectionDecision, o as RenderType, p as RendererRegistry, q as RetrievalException, r as Retrivora, s as RetrivoraError, t as RetrivoraErrorCode, u as RuleEngine, L as Snippet, S as SourceCardProps, T as TableRendererStrategy, N as TextRendererStrategy, V as VisualizationDecisionEngine, v as decideVisualization, O as wrapError } from './index-DcklhThn.js';
5
- import { H as HealthCheckResult, I as IProviderValidator, a as IProviderHealthChecker } from './index-BIHHp_f6.js';
6
- export { C as ConfigValidator, V as ValidationError, b as VectorPlugin, c as createChatHandler, d as createFeedbackHandler, e as createHealthHandler, f as createHistoryHandler, g as createIngestHandler, h as createRagHandler, i as createSessionsHandler, j as createStreamHandler, k as createUploadHandler, s as sseErrorFrame, l as sseFrame, m as sseMetaFrame, n as sseTextFrame } from './index-BIHHp_f6.js';
1
+ import { V as VectorDBConfig, L as LLMConfig, d as EmbeddingConfig, i as RagConfig, n as UniversalRagConfig, o as UpsertDocument, q as VectorMatch, G as GraphDBConfig, r as GraphNode, s as Edge, t as GraphSearchResult, I as ILLMProvider, p as VectorDBProvider, g as LLMProvider, e as EmbeddingProvider, R as RAGConfig, m as UIConfig, C as ChatMessage, b as ChatOptions, E as EmbedOptions } from './ILLMProvider-BWa68XX5.js';
2
+ export { B as BarChartData, u as CarouselProduct, c as ChatResponse, v as IRetriever, f as IngestDocument, h as LatencyBreakdown, w as LineChartDataPoint, M as MessageRole, x as MetricCardData, O as ObservabilityTrace, P as PieChartData, y as Product, j as RagMessage, k as RetrievalConfig, z as RetrievalResult, l as RetrievedChunk, A as RetrivoraChunkMetadata, D as RetrivoraIngestedDocument, S as ScatterPlotDataPoint, F as SuggestionsResponse, H as TableData, T as TokenUsage, J as UITransformationResponse, U as UseRagChatOptions, a as UseRagChatReturn, K as VisualizationType, W as WorkflowConfig } from './ILLMProvider-BWa68XX5.js';
3
+ import { I as IRenderRule, i as DecisionContext, k as IntentCategory, n as RenderDecision } from './index-BCbeeh74.js';
4
+ export { x as ArchitectureCardProps, A as AuthenticationException, y as CarouselRendererStrategy, z as ChartRendererStrategy, e as ChartType, B as ChatViewportSize, C as ChatWidgetProps, a as ChatWindowProps, f as Chunk, g as ChunkOptions, c as ClientConfig, b as ConfigProviderProps, h as ConfigurationException, F as DocumentChunker, D as DocumentUploadProps, E as EmbeddingFailedException, j as IRendererStrategy, l as IntentClassifier, M as MessageBubbleProps, G as MixedRendererStrategy, H as Pipeline, J as PipelineStep, P as ProductCardProps, d as ProductCarouselProps, m as ProviderNotFoundException, K as ProviderPill, R as RateLimitException, L as RenderSectionDecision, o as RenderType, p as RendererRegistry, q as RetrievalException, r as Retrivora, s as RetrivoraError, t as RetrivoraErrorCode, u as RuleEngine, v as SDK_VERSION, N as Snippet, S as SourceCardProps, T as TableRendererStrategy, O as TextRendererStrategy, V as VisualizationDecisionEngine, w as decideVisualization, Q as wrapError } from './index-BCbeeh74.js';
5
+ import { H as HealthCheckResult, I as IProviderValidator, a as IProviderHealthChecker } from './index-C6ehmP0b.js';
6
+ export { C as ConfigValidator, V as ValidationError, b as VectorPlugin, c as createChatHandler, d as createFeedbackHandler, e as createHealthHandler, f as createHistoryHandler, g as createIngestHandler, h as createRagHandler, i as createSessionsHandler, j as createStreamHandler, k as createUploadHandler, s as sseErrorFrame, l as sseFrame, m as sseMetaFrame, n as sseTextFrame } from './index-C6ehmP0b.js';
7
7
  import 'react';
8
8
  import 'next/server';
9
9
 
package/dist/server.js CHANGED
@@ -2759,6 +2759,7 @@ __export(server_exports, {
2759
2759
  Rule6SmallResultSetRule: () => Rule6SmallResultSetRule,
2760
2760
  Rule7LargeTableRule: () => Rule7LargeTableRule,
2761
2761
  RuleEngine: () => RuleEngine,
2762
+ SDK_VERSION: () => SDK_VERSION,
2762
2763
  TableRendererStrategy: () => TableRendererStrategy,
2763
2764
  TextRendererStrategy: () => TextRendererStrategy,
2764
2765
  UniversalLLMAdapter: () => UniversalLLMAdapter,
@@ -3141,7 +3142,7 @@ function getRagConfig(baseConfig, env = process.env) {
3141
3142
  return getEnvConfig(env, baseConfig);
3142
3143
  }
3143
3144
  function getEnvConfig(env = process.env, base) {
3144
- var _a2, _b, _c, _d, _e, _f, _g2, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K, _L, _M, _N, _O, _P, _Q, _R, _S, _T, _U, _V, _W, _X, _Y, _Z, __, _$, _aa, _ba, _ca, _da, _ea, _fa, _ga, _ha, _ia, _ja, _ka, _la, _ma, _na, _oa, _pa, _qa, _ra, _sa, _ta, _ua, _va, _wa, _xa, _ya, _za, _Aa, _Ba, _Ca, _Da, _Ea, _Fa, _Ga, _Ha, _Ia, _Ja, _Ka, _La, _Ma, _Na, _Oa, _Pa, _Qa, _Ra, _Sa, _Ta, _Ua, _Va, _Wa, _Xa, _Ya, _Za, __a, _$a, _ab, _bb, _cb, _db, _eb, _fb, _gb, _hb, _ib, _jb, _kb, _lb, _mb, _nb, _ob, _pb, _qb, _rb, _sb, _tb, _ub, _vb, _wb, _xb, _yb, _zb, _Ab, _Bb, _Cb, _Db, _Eb, _Fb;
3145
+ var _a2, _b, _c, _d, _e, _f, _g2, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K, _L, _M, _N, _O, _P, _Q, _R, _S, _T, _U, _V, _W, _X, _Y, _Z, __, _$, _aa, _ba, _ca, _da, _ea, _fa, _ga, _ha, _ia, _ja, _ka, _la, _ma, _na, _oa, _pa, _qa, _ra, _sa, _ta, _ua, _va, _wa, _xa, _ya, _za, _Aa, _Ba, _Ca, _Da, _Ea, _Fa, _Ga, _Ha, _Ia, _Ja, _Ka, _La, _Ma, _Na, _Oa, _Pa, _Qa, _Ra, _Sa, _Ta, _Ua, _Va, _Wa, _Xa, _Ya, _Za, __a, _$a, _ab, _bb, _cb, _db, _eb, _fb, _gb, _hb, _ib, _jb, _kb, _lb, _mb, _nb, _ob, _pb, _qb, _rb, _sb, _tb, _ub, _vb, _wb, _xb, _yb, _zb, _Ab, _Bb, _Cb, _Db, _Eb, _Fb, _Gb, _Hb, _Ib;
3145
3146
  const projectId = (_c = (_b = (_a2 = readString(env, "RAG_PROJECT_ID")) != null ? _a2 : readString(env, "NEXT_PUBLIC_PROJECT_ID")) != null ? _b : base == null ? void 0 : base.projectId) != null ? _c : "__default__";
3146
3147
  const licenseKey = (_g2 = (_f = (_e = (_d = readString(env, "RAG_LICENSE_KEY")) != null ? _d : readString(env, "RETRIVORA_LICENSE_KEY")) != null ? _e : readString(env, "NEXT_PUBLIC_RETRIVORA_LICENSE_KEY")) != null ? _f : readString(env, "LICENSE_KEY")) != null ? _g2 : base == null ? void 0 : base.licenseKey;
3147
3148
  const telemetryEnabled = readString(env, "TELEMETRY_ENABLED") === "true" || readString(env, "NEXT_PUBLIC_TELEMETRY_ENABLED") === "true" || ((_h = base == null ? void 0 : base.telemetry) == null ? void 0 : _h.enabled) || Boolean(licenseKey);
@@ -3149,38 +3150,38 @@ function getEnvConfig(env = process.env, base) {
3149
3150
  const embeddingDimensions = readNumber(env, "EMBEDDING_DIMENSIONS", 768);
3150
3151
  const vectorDbOptions = {};
3151
3152
  if (vectorProvider === "pinecone") {
3152
- vectorDbOptions.apiKey = (_l = (_k = readString(env, "PINECONE_API_KEY")) != null ? _k : (_j = (_i = base == null ? void 0 : base.vectorDb) == null ? void 0 : _i.options) == null ? void 0 : _j.apiKey) != null ? _l : "";
3153
- vectorDbOptions.indexName = (_q = (_n = readString(env, "PINECONE_INDEX")) != null ? _n : (_m = base == null ? void 0 : base.vectorDb) == null ? void 0 : _m.indexName) != null ? _q : (_p = (_o = base == null ? void 0 : base.vectorDb) == null ? void 0 : _o.options) == null ? void 0 : _p.indexName;
3153
+ vectorDbOptions.apiKey = (_m = (_l = (_k = readString(env, "PINECONE_API_KEY")) != null ? _k : (_j = (_i = base == null ? void 0 : base.vectorDb) == null ? void 0 : _i.options) == null ? void 0 : _j.apiKey) != null ? _l : process.env.PINECONE_API_KEY) != null ? _m : "";
3154
+ vectorDbOptions.indexName = (_t = (_s = (_r = (_o = readString(env, "PINECONE_INDEX")) != null ? _o : (_n = base == null ? void 0 : base.vectorDb) == null ? void 0 : _n.indexName) != null ? _r : (_q = (_p = base == null ? void 0 : base.vectorDb) == null ? void 0 : _p.options) == null ? void 0 : _q.indexName) != null ? _s : process.env.PINECONE_INDEX) != null ? _t : "retrivora-free";
3154
3155
  } else if (vectorProvider === "pgvector" || vectorProvider === "postgresql") {
3155
- vectorDbOptions.connectionString = (_v = (_u = (_r = readString(env, "PGVECTOR_CONNECTION_STRING")) != null ? _r : readString(env, "POSTGRES_URL")) != null ? _u : (_t = (_s = base == null ? void 0 : base.vectorDb) == null ? void 0 : _s.options) == null ? void 0 : _t.connectionString) != null ? _v : "";
3156
- vectorDbOptions.tables = (_A = (_x = (_w = readString(env, "VECTOR_DB_TABLES")) != null ? _w : readString(env, "POSTGRES_TABLES")) == null ? void 0 : _x.split(",").map((t) => t.trim())) != null ? _A : (_z = (_y = base == null ? void 0 : base.vectorDb) == null ? void 0 : _y.options) == null ? void 0 : _z.tables;
3157
- vectorDbOptions.searchFields = (_E = (_B = readString(env, "POSTGRES_SEARCH_FIELDS")) == null ? void 0 : _B.split(",").map((f) => f.trim())) != null ? _E : (_D = (_C = base == null ? void 0 : base.vectorDb) == null ? void 0 : _C.options) == null ? void 0 : _D.searchFields;
3156
+ vectorDbOptions.connectionString = (_y = (_x = (_u = readString(env, "PGVECTOR_CONNECTION_STRING")) != null ? _u : readString(env, "POSTGRES_URL")) != null ? _x : (_w = (_v = base == null ? void 0 : base.vectorDb) == null ? void 0 : _v.options) == null ? void 0 : _w.connectionString) != null ? _y : "";
3157
+ vectorDbOptions.tables = (_D = (_A = (_z = readString(env, "VECTOR_DB_TABLES")) != null ? _z : readString(env, "POSTGRES_TABLES")) == null ? void 0 : _A.split(",").map((t) => t.trim())) != null ? _D : (_C = (_B = base == null ? void 0 : base.vectorDb) == null ? void 0 : _B.options) == null ? void 0 : _C.tables;
3158
+ vectorDbOptions.searchFields = (_H = (_E = readString(env, "POSTGRES_SEARCH_FIELDS")) == null ? void 0 : _E.split(",").map((f) => f.trim())) != null ? _H : (_G = (_F = base == null ? void 0 : base.vectorDb) == null ? void 0 : _F.options) == null ? void 0 : _G.searchFields;
3158
3159
  vectorDbOptions.dimensions = embeddingDimensions;
3159
3160
  } else if (vectorProvider === "mongodb") {
3160
- vectorDbOptions.uri = (_I = (_H = readString(env, "MONGODB_URI")) != null ? _H : (_G = (_F = base == null ? void 0 : base.vectorDb) == null ? void 0 : _F.options) == null ? void 0 : _G.uri) != null ? _I : "";
3161
- vectorDbOptions.database = (_M = (_L = readString(env, "MONGODB_DB")) != null ? _L : (_K = (_J = base == null ? void 0 : base.vectorDb) == null ? void 0 : _J.options) == null ? void 0 : _K.database) != null ? _M : "";
3162
- vectorDbOptions.collection = (_Q = (_P = readString(env, "MONGODB_COLLECTION")) != null ? _P : (_O = (_N = base == null ? void 0 : base.vectorDb) == null ? void 0 : _N.options) == null ? void 0 : _O.collection) != null ? _Q : "";
3163
- vectorDbOptions.indexName = (_W = (_V = (_S = readString(env, "MONGODB_INDEX_NAME")) != null ? _S : (_R = base == null ? void 0 : base.vectorDb) == null ? void 0 : _R.indexName) != null ? _V : (_U = (_T = base == null ? void 0 : base.vectorDb) == null ? void 0 : _T.options) == null ? void 0 : _U.indexName) != null ? _W : "vector_index";
3161
+ vectorDbOptions.uri = (_L = (_K = readString(env, "MONGODB_URI")) != null ? _K : (_J = (_I = base == null ? void 0 : base.vectorDb) == null ? void 0 : _I.options) == null ? void 0 : _J.uri) != null ? _L : "";
3162
+ vectorDbOptions.database = (_P = (_O = readString(env, "MONGODB_DB")) != null ? _O : (_N = (_M = base == null ? void 0 : base.vectorDb) == null ? void 0 : _M.options) == null ? void 0 : _N.database) != null ? _P : "";
3163
+ vectorDbOptions.collection = (_T = (_S = readString(env, "MONGODB_COLLECTION")) != null ? _S : (_R = (_Q = base == null ? void 0 : base.vectorDb) == null ? void 0 : _Q.options) == null ? void 0 : _R.collection) != null ? _T : "";
3164
+ vectorDbOptions.indexName = (_Z = (_Y = (_V = readString(env, "MONGODB_INDEX_NAME")) != null ? _V : (_U = base == null ? void 0 : base.vectorDb) == null ? void 0 : _U.indexName) != null ? _Y : (_X = (_W = base == null ? void 0 : base.vectorDb) == null ? void 0 : _W.options) == null ? void 0 : _X.indexName) != null ? _Z : "vector_index";
3164
3165
  } else if (vectorProvider === "qdrant") {
3165
- vectorDbOptions.baseUrl = (__ = (_Z = readString(env, "QDRANT_URL")) != null ? _Z : (_Y = (_X = base == null ? void 0 : base.vectorDb) == null ? void 0 : _X.options) == null ? void 0 : _Y.baseUrl) != null ? __ : "http://localhost:6333";
3166
- vectorDbOptions.apiKey = (_ba = readString(env, "QDRANT_API_KEY")) != null ? _ba : (_aa = (_$ = base == null ? void 0 : base.vectorDb) == null ? void 0 : _$.options) == null ? void 0 : _aa.apiKey;
3166
+ vectorDbOptions.baseUrl = (_ba = (_aa = readString(env, "QDRANT_URL")) != null ? _aa : (_$ = (__ = base == null ? void 0 : base.vectorDb) == null ? void 0 : __.options) == null ? void 0 : _$.baseUrl) != null ? _ba : "http://localhost:6333";
3167
+ vectorDbOptions.apiKey = (_ea = readString(env, "QDRANT_API_KEY")) != null ? _ea : (_da = (_ca = base == null ? void 0 : base.vectorDb) == null ? void 0 : _ca.options) == null ? void 0 : _da.apiKey;
3167
3168
  vectorDbOptions.dimensions = embeddingDimensions;
3168
3169
  } else if (vectorProvider === "milvus") {
3169
- vectorDbOptions.baseUrl = (_ca = readString(env, "MILVUS_URL")) != null ? _ca : "http://localhost:19530";
3170
+ vectorDbOptions.baseUrl = (_fa = readString(env, "MILVUS_URL")) != null ? _fa : "http://localhost:19530";
3170
3171
  vectorDbOptions.apiKey = readString(env, "MILVUS_API_KEY");
3171
3172
  } else if (vectorProvider === "chromadb") {
3172
- vectorDbOptions.baseUrl = (_da = readString(env, "CHROMADB_URL")) != null ? _da : "http://localhost:8000";
3173
+ vectorDbOptions.baseUrl = (_ga = readString(env, "CHROMADB_URL")) != null ? _ga : "http://localhost:8000";
3173
3174
  } else if (vectorProvider === "weaviate") {
3174
- vectorDbOptions.baseUrl = (_ea = readString(env, "WEAVIATE_URL")) != null ? _ea : "http://localhost:8080";
3175
+ vectorDbOptions.baseUrl = (_ha = readString(env, "WEAVIATE_URL")) != null ? _ha : "http://localhost:8080";
3175
3176
  vectorDbOptions.apiKey = readString(env, "WEAVIATE_API_KEY");
3176
3177
  } else if (vectorProvider === "redis") {
3177
- vectorDbOptions.baseUrl = (_fa = readString(env, "REDIS_URL")) != null ? _fa : "";
3178
+ vectorDbOptions.baseUrl = (_ia = readString(env, "REDIS_URL")) != null ? _ia : "";
3178
3179
  vectorDbOptions.apiKey = readString(env, "REDIS_API_KEY");
3179
3180
  } else if (vectorProvider === "rest") {
3180
- vectorDbOptions.baseUrl = (_ga = readString(env, "VECTOR_DB_REST_URL")) != null ? _ga : "";
3181
+ vectorDbOptions.baseUrl = (_ja = readString(env, "VECTOR_DB_REST_URL")) != null ? _ja : "";
3181
3182
  vectorDbOptions.headers = readString(env, "VECTOR_DB_REST_API_KEY") ? { "api-key": readString(env, "VECTOR_DB_REST_API_KEY") } : {};
3182
3183
  } else if (vectorProvider === "universal_rest") {
3183
- vectorDbOptions.baseUrl = (_ia = (_ha = readString(env, "VECTOR_BASE_URL")) != null ? _ha : readString(env, "VECTOR_DB_REST_URL")) != null ? _ia : "";
3184
+ vectorDbOptions.baseUrl = (_la = (_ka = readString(env, "VECTOR_BASE_URL")) != null ? _ka : readString(env, "VECTOR_DB_REST_URL")) != null ? _la : "";
3184
3185
  vectorDbOptions.profile = readString(env, "VECTOR_UNIVERSAL_PROFILE");
3185
3186
  vectorDbOptions.headers = readString(env, "VECTOR_DB_REST_API_KEY") ? { Authorization: `Bearer ${readString(env, "VECTOR_DB_REST_API_KEY")}` } : {};
3186
3187
  }
@@ -3199,8 +3200,8 @@ function getEnvConfig(env = process.env, base) {
3199
3200
  // Anthropic needs a separate embedding provider; key kept for completeness
3200
3201
  gemini: readString(env, "GEMINI_API_KEY"),
3201
3202
  ollama: void 0,
3202
- universal_rest: (_ja = readString(env, "EMBEDDING_API_KEY")) != null ? _ja : readString(env, "OPENAI_API_KEY"),
3203
- custom: (_ka = readString(env, "EMBEDDING_API_KEY")) != null ? _ka : readString(env, "OPENAI_API_KEY")
3203
+ universal_rest: (_ma = readString(env, "EMBEDDING_API_KEY")) != null ? _ma : readString(env, "OPENAI_API_KEY"),
3204
+ custom: (_na = readString(env, "EMBEDDING_API_KEY")) != null ? _na : readString(env, "OPENAI_API_KEY")
3204
3205
  };
3205
3206
  const DEFAULT_MODEL_BY_PROVIDER = {
3206
3207
  openai: "gpt-4o",
@@ -3221,25 +3222,25 @@ function getEnvConfig(env = process.env, base) {
3221
3222
  return true;
3222
3223
  }
3223
3224
  })();
3224
- const defaultGatewayUrl = (_ma = (_la = readString(env, "LITELLM_BASE_URL")) != null ? _la : readString(env, "LLM_BASE_URL")) != null ? _ma : "https://llm.retrivora.com/api/v1";
3225
+ const defaultGatewayUrl = (_pa = (_oa = readString(env, "LITELLM_BASE_URL")) != null ? _oa : readString(env, "LLM_BASE_URL")) != null ? _pa : "https://llm.retrivora.com/api/v1";
3225
3226
  const defaultLlmProvider = isFreeTier ? "universal_rest" : "universal_rest";
3226
- const llmProvider = (_pa = (_oa = readEnum(env, "LLM_PROVIDER", defaultLlmProvider, LLM_PROVIDERS)) != null ? _oa : (_na = base == null ? void 0 : base.llm) == null ? void 0 : _na.provider) != null ? _pa : defaultLlmProvider;
3227
- const llmBaseUrl = (_ta = (_sa = (_qa = readString(env, "LITELLM_BASE_URL")) != null ? _qa : readString(env, "LLM_BASE_URL")) != null ? _sa : (_ra = base == null ? void 0 : base.llm) == null ? void 0 : _ra.baseUrl) != null ? _ta : defaultGatewayUrl;
3228
- const llmModel = (_xa = (_va = readString(env, "LLM_MODEL")) != null ? _va : (_ua = base == null ? void 0 : base.llm) == null ? void 0 : _ua.model) != null ? _xa : isFreeTier ? "llama-3.1-8b-instant" : (_wa = DEFAULT_MODEL_BY_PROVIDER[llmProvider]) != null ? _wa : "gpt-4o";
3229
- const llmApiKey = (_Da = (_Ca = (_Aa = (_za = (_ya = llmApiKeyByProvider[llmProvider]) != null ? _ya : readString(env, "LLM_API_KEY")) != null ? _za : readString(env, "LITELLM_MASTER_KEY")) != null ? _Aa : readString(env, "LITELLM_API_KEY")) != null ? _Ca : (_Ba = base == null ? void 0 : base.llm) == null ? void 0 : _Ba.apiKey) != null ? _Da : licenseKey;
3230
- const llmProfile = (_Ha = (_Ga = readString(env, "LLM_UNIVERSAL_PROFILE")) != null ? _Ga : (_Fa = (_Ea = base == null ? void 0 : base.llm) == null ? void 0 : _Ea.options) == null ? void 0 : _Fa.profile) != null ? _Ha : "litellm";
3227
+ const llmProvider = (_sa = (_ra = readEnum(env, "LLM_PROVIDER", defaultLlmProvider, LLM_PROVIDERS)) != null ? _ra : (_qa = base == null ? void 0 : base.llm) == null ? void 0 : _qa.provider) != null ? _sa : defaultLlmProvider;
3228
+ const llmBaseUrl = (_wa = (_va = (_ta = readString(env, "LITELLM_BASE_URL")) != null ? _ta : readString(env, "LLM_BASE_URL")) != null ? _va : (_ua = base == null ? void 0 : base.llm) == null ? void 0 : _ua.baseUrl) != null ? _wa : defaultGatewayUrl;
3229
+ const llmModel = (_Aa = (_ya = readString(env, "LLM_MODEL")) != null ? _ya : (_xa = base == null ? void 0 : base.llm) == null ? void 0 : _xa.model) != null ? _Aa : isFreeTier ? "llama-3.1-8b-instant" : (_za = DEFAULT_MODEL_BY_PROVIDER[llmProvider]) != null ? _za : "gpt-4o";
3230
+ const llmApiKey = (_Ga = (_Fa = (_Da = (_Ca = (_Ba = llmApiKeyByProvider[llmProvider]) != null ? _Ba : readString(env, "LLM_API_KEY")) != null ? _Ca : readString(env, "LITELLM_MASTER_KEY")) != null ? _Da : readString(env, "LITELLM_API_KEY")) != null ? _Fa : (_Ea = base == null ? void 0 : base.llm) == null ? void 0 : _Ea.apiKey) != null ? _Ga : licenseKey;
3231
+ 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";
3231
3232
  const defaultEmbeddingProvider = isFreeTier ? "universal_rest" : "universal_rest";
3232
- const embeddingProvider = (_Ka = (_Ja = readEnum(env, "EMBEDDING_PROVIDER", defaultEmbeddingProvider, EMBEDDING_PROVIDERS)) != null ? _Ja : (_Ia = base == null ? void 0 : base.embedding) == null ? void 0 : _Ia.provider) != null ? _Ka : defaultEmbeddingProvider;
3233
- const embeddingBaseUrl = (_Pa = (_Oa = (_Ma = (_La = readString(env, "LITELLM_BASE_URL")) != null ? _La : readString(env, "EMBEDDING_BASE_URL")) != null ? _Ma : readString(env, "LLM_BASE_URL")) != null ? _Oa : (_Na = base == null ? void 0 : base.embedding) == null ? void 0 : _Na.baseUrl) != null ? _Pa : defaultGatewayUrl;
3234
- const embeddingModel = (_Sa = (_Ra = readString(env, "EMBEDDING_MODEL")) != null ? _Ra : (_Qa = base == null ? void 0 : base.embedding) == null ? void 0 : _Qa.model) != null ? _Sa : "text-embedding-004";
3235
- const embeddingApiKey = (_Za = (_Ya = (_Wa = (_Va = (_Ua = (_Ta = embeddingApiKeyByProvider[embeddingProvider]) != null ? _Ta : readString(env, "EMBEDDING_API_KEY")) != null ? _Ua : readString(env, "LLM_API_KEY")) != null ? _Va : readString(env, "LITELLM_MASTER_KEY")) != null ? _Wa : readString(env, "LITELLM_API_KEY")) != null ? _Ya : (_Xa = base == null ? void 0 : base.embedding) == null ? void 0 : _Xa.apiKey) != null ? _Za : licenseKey;
3236
- const embeddingProfile = (_bb = (_ab = readString(env, "EMBEDDING_UNIVERSAL_PROFILE")) != null ? _ab : (_$a = (__a = base == null ? void 0 : base.embedding) == null ? void 0 : __a.options) == null ? void 0 : _$a.profile) != null ? _bb : "litellm";
3233
+ 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;
3234
+ const embeddingBaseUrl = (_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 : defaultGatewayUrl;
3235
+ const embeddingModel = (_Va = (_Ua = readString(env, "EMBEDDING_MODEL")) != null ? _Ua : (_Ta = base == null ? void 0 : base.embedding) == null ? void 0 : _Ta.model) != null ? _Va : "text-embedding-004";
3236
+ const embeddingApiKey = (_ab = (_$a = (_Za = (_Ya = (_Xa = (_Wa = embeddingApiKeyByProvider[embeddingProvider]) != null ? _Wa : readString(env, "EMBEDDING_API_KEY")) != null ? _Xa : readString(env, "LLM_API_KEY")) != null ? _Ya : readString(env, "LITELLM_MASTER_KEY")) != null ? _Za : readString(env, "LITELLM_API_KEY")) != null ? _$a : (__a = base == null ? void 0 : base.embedding) == null ? void 0 : __a.apiKey) != null ? _ab : licenseKey;
3237
+ 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";
3237
3238
  return __spreadProps(__spreadValues({
3238
3239
  projectId,
3239
3240
  licenseKey,
3240
3241
  vectorDb: {
3241
3242
  provider: vectorProvider,
3242
- indexName: (_db = (_cb = readString(env, "VECTOR_DB_INDEX")) != null ? _cb : vectorDbOptions.indexName) != null ? _db : "rag-index",
3243
+ indexName: (_gb = (_fb = readString(env, "VECTOR_DB_INDEX")) != null ? _fb : vectorDbOptions.indexName) != null ? _gb : "rag-index",
3243
3244
  options: vectorDbOptions
3244
3245
  },
3245
3246
  llm: {
@@ -3269,30 +3270,30 @@ function getEnvConfig(env = process.env, base) {
3269
3270
  }
3270
3271
  },
3271
3272
  ui: {
3272
- title: (_fb = (_eb = readString(env, "NEXT_PUBLIC_UI_TITLE")) != null ? _eb : readString(env, "UI_TITLE")) != null ? _fb : "AI Assistant",
3273
- subtitle: (_hb = (_gb = readString(env, "NEXT_PUBLIC_UI_SUBTITLE")) != null ? _gb : readString(env, "UI_SUBTITLE")) != null ? _hb : "Powered by RAG",
3274
- primaryColor: (_jb = (_ib = readString(env, "NEXT_PUBLIC_PRIMARY_COLOR")) != null ? _ib : readString(env, "UI_PRIMARY_COLOR")) != null ? _jb : "#10b981",
3275
- accentColor: (_lb = (_kb = readString(env, "NEXT_PUBLIC_ACCENT_COLOR")) != null ? _kb : readString(env, "UI_ACCENT_COLOR")) != null ? _lb : "#3b82f6",
3276
- logoUrl: (_mb = readString(env, "NEXT_PUBLIC_LOGO_URL")) != null ? _mb : readString(env, "UI_LOGO_URL"),
3277
- placeholder: (_ob = (_nb = readString(env, "NEXT_PUBLIC_PLACEHOLDER")) != null ? _nb : readString(env, "UI_PLACEHOLDER")) != null ? _ob : "Ask me anything\u2026",
3278
- showSources: ((_qb = (_pb = readString(env, "NEXT_PUBLIC_SHOW_SOURCES")) != null ? _pb : readString(env, "UI_SHOW_SOURCES")) != null ? _qb : "true") !== "false",
3279
- welcomeMessage: (_sb = (_rb = readString(env, "NEXT_PUBLIC_WELCOME_MESSAGE")) != null ? _rb : readString(env, "UI_WELCOME_MESSAGE")) != null ? _sb : "Hello! I'm your AI assistant. Ask me anything about your documents.",
3280
- visualStyle: (_ub = (_tb = readString(env, "NEXT_PUBLIC_UI_VISUAL_STYLE")) != null ? _tb : readString(env, "UI_VISUAL_STYLE")) != null ? _ub : "glass",
3281
- borderRadius: (_wb = (_vb = readString(env, "NEXT_PUBLIC_UI_BORDER_RADIUS")) != null ? _vb : readString(env, "UI_BORDER_RADIUS")) != null ? _wb : "xl",
3282
- allowUpload: ((_yb = (_xb = readString(env, "NEXT_PUBLIC_ALLOW_UPLOAD")) != null ? _xb : readString(env, "UI_ALLOW_UPLOAD")) != null ? _yb : "false") === "true"
3273
+ title: (_ib = (_hb = readString(env, "NEXT_PUBLIC_UI_TITLE")) != null ? _hb : readString(env, "UI_TITLE")) != null ? _ib : "AI Assistant",
3274
+ subtitle: (_kb = (_jb = readString(env, "NEXT_PUBLIC_UI_SUBTITLE")) != null ? _jb : readString(env, "UI_SUBTITLE")) != null ? _kb : "Powered by RAG",
3275
+ primaryColor: (_mb = (_lb = readString(env, "NEXT_PUBLIC_PRIMARY_COLOR")) != null ? _lb : readString(env, "UI_PRIMARY_COLOR")) != null ? _mb : "#10b981",
3276
+ accentColor: (_ob = (_nb = readString(env, "NEXT_PUBLIC_ACCENT_COLOR")) != null ? _nb : readString(env, "UI_ACCENT_COLOR")) != null ? _ob : "#3b82f6",
3277
+ logoUrl: (_pb = readString(env, "NEXT_PUBLIC_LOGO_URL")) != null ? _pb : readString(env, "UI_LOGO_URL"),
3278
+ placeholder: (_rb = (_qb = readString(env, "NEXT_PUBLIC_PLACEHOLDER")) != null ? _qb : readString(env, "UI_PLACEHOLDER")) != null ? _rb : "Ask me anything\u2026",
3279
+ showSources: ((_tb = (_sb = readString(env, "NEXT_PUBLIC_SHOW_SOURCES")) != null ? _sb : readString(env, "UI_SHOW_SOURCES")) != null ? _tb : "true") !== "false",
3280
+ welcomeMessage: (_vb = (_ub = readString(env, "NEXT_PUBLIC_WELCOME_MESSAGE")) != null ? _ub : readString(env, "UI_WELCOME_MESSAGE")) != null ? _vb : "Hello! I'm your AI assistant. Ask me anything about your documents.",
3281
+ visualStyle: (_xb = (_wb = readString(env, "NEXT_PUBLIC_UI_VISUAL_STYLE")) != null ? _wb : readString(env, "UI_VISUAL_STYLE")) != null ? _xb : "glass",
3282
+ borderRadius: (_zb = (_yb = readString(env, "NEXT_PUBLIC_UI_BORDER_RADIUS")) != null ? _yb : readString(env, "UI_BORDER_RADIUS")) != null ? _zb : "xl",
3283
+ allowUpload: ((_Bb = (_Ab = readString(env, "NEXT_PUBLIC_ALLOW_UPLOAD")) != null ? _Ab : readString(env, "UI_ALLOW_UPLOAD")) != null ? _Bb : "false") === "true"
3283
3284
  },
3284
3285
  rag: {
3285
3286
  topK: readNumber(env, "RAG_TOP_K", 5),
3286
3287
  scoreThreshold: readNumber(env, "RAG_SCORE_THRESHOLD", 0),
3287
3288
  chunkSize: readNumber(env, "RAG_CHUNK_SIZE", 1e3),
3288
3289
  chunkOverlap: readNumber(env, "RAG_CHUNK_OVERLAP", 200),
3289
- filterableFields: (_zb = readString(env, "RAG_FILTERABLE_FIELDS")) == null ? void 0 : _zb.split(",").map((f) => f.trim()),
3290
+ filterableFields: (_Cb = readString(env, "RAG_FILTERABLE_FIELDS")) == null ? void 0 : _Cb.split(",").map((f) => f.trim()),
3290
3291
  // Query pipeline toggles — read from .env.local
3291
3292
  useQueryTransformation: readString(env, "RAG_USE_QUERY_TRANSFORMATION") === "true",
3292
3293
  useReranking: readString(env, "RAG_USE_RERANKING") === "true",
3293
3294
  useGraphRetrieval: readString(env, "RAG_USE_GRAPH_RETRIEVAL") === "true",
3294
- architecture: (_Ab = readString(env, "RAG_ARCHITECTURE")) != null ? _Ab : "simple",
3295
- chunkingStrategy: (_Bb = readString(env, "RAG_CHUNKING_STRATEGY")) != null ? _Bb : "recursive",
3295
+ architecture: (_Db = readString(env, "RAG_ARCHITECTURE")) != null ? _Db : "simple",
3296
+ chunkingStrategy: (_Eb = readString(env, "RAG_CHUNKING_STRATEGY")) != null ? _Eb : "recursive",
3296
3297
  uiMapping: (() => {
3297
3298
  const raw = readString(env, "RAG_UI_MAPPING");
3298
3299
  if (!raw) return void 0;
@@ -3305,7 +3306,7 @@ function getEnvConfig(env = process.env, base) {
3305
3306
  },
3306
3307
  telemetry: {
3307
3308
  enabled: telemetryEnabled,
3308
- url: (_Fb = (_Eb = (_Cb = readString(env, "TELEMETRY_URL")) != null ? _Cb : readString(env, "NEXT_PUBLIC_TELEMETRY_URL")) != null ? _Eb : (_Db = base == null ? void 0 : base.telemetry) == null ? void 0 : _Db.url) != null ? _Fb : process.env.NODE_ENV === "development" ? "http://localhost:3001/api/telemetry" : "https://retrivora.com/api/telemetry"
3309
+ url: (_Ib = (_Hb = (_Fb = readString(env, "TELEMETRY_URL")) != null ? _Fb : readString(env, "NEXT_PUBLIC_TELEMETRY_URL")) != null ? _Hb : (_Gb = base == null ? void 0 : base.telemetry) == null ? void 0 : _Gb.url) != null ? _Ib : process.env.NODE_ENV === "development" ? "http://localhost:3001/api/telemetry" : "https://retrivora.com/api/telemetry"
3309
3310
  }
3310
3311
  }, readString(env, "GRAPH_DB_PROVIDER") ? {
3311
3312
  graphDb: {
@@ -5344,6 +5345,147 @@ var ConfigValidator = class {
5344
5345
  }
5345
5346
  };
5346
5347
 
5348
+ // package.json
5349
+ var package_default = {
5350
+ name: "@retrivora-ai/rag-engine",
5351
+ version: "2.1.4",
5352
+ description: "Retrivora AI is a plug-and-play AI engine for RAG chat experiences \u2014 generic vector DB + LLM provider, embeddable or standalone.",
5353
+ author: "Abhinav Alkuchi",
5354
+ license: "UNLICENSED",
5355
+ keywords: [
5356
+ "rag",
5357
+ "retrieval-augmented-generation",
5358
+ "chatbot",
5359
+ "vector-database",
5360
+ "pinecone",
5361
+ "pgvector",
5362
+ "postgresql",
5363
+ "milvus",
5364
+ "qdrant",
5365
+ "chromadb",
5366
+ "redis",
5367
+ "weaviate",
5368
+ "mongodb",
5369
+ "openai",
5370
+ "anthropic",
5371
+ "ollama",
5372
+ "nextjs",
5373
+ "react",
5374
+ "ai",
5375
+ "llm",
5376
+ "embeddings"
5377
+ ],
5378
+ main: "dist/index.js",
5379
+ module: "dist/index.mjs",
5380
+ types: "dist/index.d.ts",
5381
+ exports: {
5382
+ ".": {
5383
+ types: "./dist/index.d.ts",
5384
+ require: "./dist/index.js",
5385
+ import: "./dist/index.mjs"
5386
+ },
5387
+ "./style.css": "./dist/index.css",
5388
+ "./handlers": {
5389
+ types: "./dist/handlers/index.d.ts",
5390
+ require: "./dist/handlers/index.js",
5391
+ import: "./dist/handlers/index.mjs"
5392
+ },
5393
+ "./server": {
5394
+ types: "./dist/server.d.ts",
5395
+ require: "./dist/server.js",
5396
+ import: "./dist/server.mjs"
5397
+ }
5398
+ },
5399
+ browser: {
5400
+ child_process: false,
5401
+ fs: false,
5402
+ net: false,
5403
+ tls: false,
5404
+ crypto: false,
5405
+ os: false,
5406
+ path: false,
5407
+ stream: false,
5408
+ http: false,
5409
+ https: false,
5410
+ zlib: false,
5411
+ mongodb: false,
5412
+ pg: false,
5413
+ "pdf-parse": false,
5414
+ mammoth: false
5415
+ },
5416
+ files: [
5417
+ "dist",
5418
+ "src",
5419
+ ".env.example",
5420
+ "README.md",
5421
+ "FREE_TIER_ARCHITECTURE.md"
5422
+ ],
5423
+ scripts: {
5424
+ dev: "npx @tailwindcss/cli -i src/tailwind.css -o src/index.css && tsup src/index.ts src/handlers/index.ts src/server.ts --format cjs,esm --watch --tsconfig tsconfig.build.json --external react,react-dom,next,mongodb,pg,openai,@anthropic-ai/sdk,@pinecone-database/pinecone,axios,lucide-react,mammoth,pdf-parse,xlsx,react-markdown,remark-gfm,next-themes,langchain,@langchain/core,@langchain/openai,llamaindex --inject-style",
5425
+ build: "npm run build:pkg",
5426
+ "build:pkg": "npx @tailwindcss/cli -i src/tailwind.css -o src/index.css && tsup src/index.ts src/handlers/index.ts src/server.ts --format cjs,esm --dts --clean --no-splitting --tsconfig tsconfig.build.json --external react,react-dom,next,mongodb,pg,openai,@anthropic-ai/sdk,@pinecone-database/pinecone,axios,lucide-react,mammoth,pdf-parse,xlsx,react-markdown,remark-gfm,next-themes,langchain,@langchain/core,@langchain/openai,llamaindex --inject-style && npx @tailwindcss/cli -i src/tailwind.css -o dist/index.css",
5427
+ lint: "eslint",
5428
+ clean: "rm -rf dist"
5429
+ },
5430
+ peerDependencies: {
5431
+ next: ">=15.0.0",
5432
+ react: ">=18.0.0",
5433
+ "react-dom": ">=18.0.0"
5434
+ },
5435
+ peerDependenciesMeta: {
5436
+ next: {
5437
+ optional: true
5438
+ }
5439
+ },
5440
+ dependencies: {
5441
+ "@anthropic-ai/sdk": "^0.95.1",
5442
+ "@google/genai": "^0.8.0",
5443
+ "@google/generative-ai": "^0.24.1",
5444
+ "@pinecone-database/pinecone": "^7.2.0",
5445
+ "@types/papaparse": "^5.5.2",
5446
+ axios: "^1.15.0",
5447
+ "lucide-react": "^1.8.0",
5448
+ "next-themes": "^0.4.6",
5449
+ openai: "^6.34.0",
5450
+ papaparse: "^5.5.3",
5451
+ "react-is": "^18.3.1",
5452
+ "react-markdown": "^10.1.0",
5453
+ recharts: "^3.8.1",
5454
+ "remark-gfm": "^4.0.1",
5455
+ xlsx: "^0.18.5"
5456
+ },
5457
+ optionalDependencies: {
5458
+ "@langchain/core": "^1.1.42",
5459
+ "@langchain/openai": "^1.4.5",
5460
+ langchain: "^1.3.5",
5461
+ llamaindex: "^0.11.9",
5462
+ mammoth: "^1.8.0",
5463
+ mongodb: "^7.1.1",
5464
+ "pdf-parse": "^1.1.1",
5465
+ pg: "^8.20.0"
5466
+ },
5467
+ devDependencies: {
5468
+ "@tailwindcss/cli": "^4",
5469
+ "@tailwindcss/postcss": "^4",
5470
+ "@types/estree": "^1.0.9",
5471
+ "@types/node": "^20",
5472
+ "@types/pdf-parse": "^1.1.5",
5473
+ "@types/pg": "^8.20.0",
5474
+ "@types/react": "^19.2.14",
5475
+ "@types/react-dom": "^19.2.3",
5476
+ dotenv: "^17.4.2",
5477
+ eslint: "^9",
5478
+ "eslint-config-next": "16.2.4",
5479
+ next: "16.2.10",
5480
+ tailwindcss: "^4",
5481
+ tsup: "^8.5.1",
5482
+ typescript: "^5"
5483
+ }
5484
+ };
5485
+
5486
+ // src/version.ts
5487
+ var SDK_VERSION = package_default.version || "2.1.3";
5488
+
5347
5489
  // src/rag/DocumentChunker.ts
5348
5490
  var DocumentChunker = class {
5349
5491
  constructor(chunkSize = 1e3, chunkOverlap = 200, separators = ["\n# ", "\n## ", "\n### ", "\n#### ", "\n\n", "\n", " ", ""]) {
@@ -9627,6 +9769,7 @@ ${context}`;
9627
9769
  const telemetryUrl = ((_B = this.config.telemetry) == null ? void 0 : _B.url) || process.env.TELEMETRY_URL || process.env.NEXT_PUBLIC_TELEMETRY_URL || defaultUrl;
9628
9770
  const absoluteUrl = telemetryUrl.startsWith("http") ? telemetryUrl : (process.env.NEXT_PUBLIC_APP_URL || `http://localhost:${process.env.PORT || 3e3}`) + telemetryUrl;
9629
9771
  (async () => {
9772
+ var _a3, _b2, _c2, _d2, _e2;
9630
9773
  try {
9631
9774
  let finalTrace = trace;
9632
9775
  if (!awaitHallucination && runHallucination) {
@@ -9635,6 +9778,12 @@ ${context}`;
9635
9778
  finalTrace = buildTrace(backgroundScoreResult);
9636
9779
  }
9637
9780
  }
9781
+ const modelName = (finalTrace == null ? void 0 : finalTrace.model) || ((_a3 = this.config.llm) == null ? void 0 : _a3.model) || "llama-3.1-8b-instant";
9782
+ const providerName = (finalTrace == null ? void 0 : finalTrace.provider) || ((_b2 = this.config.llm) == null ? void 0 : _b2.provider) || "groq";
9783
+ const tokenCount = Number(((_c2 = finalTrace == null ? void 0 : finalTrace.tokens) == null ? void 0 : _c2.totalTokens) || 0);
9784
+ const costEst = Number(((_d2 = finalTrace == null ? void 0 : finalTrace.tokens) == null ? void 0 : _d2.estimatedCostUsd) || 0);
9785
+ const latencyDuration = Number(((_e2 = finalTrace == null ? void 0 : finalTrace.latency) == null ? void 0 : _e2.totalMs) || 0);
9786
+ console.log(`[Retrivora Pipeline Telemetry] \u{1F4CA} Dispatching RAG telemetry -> Project: "${ns}", Model: "${providerName}/${modelName}", Tokens: ${tokenCount}, Latency: ${latencyDuration}ms`);
9638
9787
  await fetch(absoluteUrl, {
9639
9788
  method: "POST",
9640
9789
  headers: {
@@ -9643,7 +9792,20 @@ ${context}`;
9643
9792
  body: JSON.stringify({
9644
9793
  trace: finalTrace,
9645
9794
  licenseKey: this.config.licenseKey,
9646
- projectId: ns
9795
+ projectId: ns,
9796
+ organization: process.env.RETRIVORA_ORGANIZATION || "default-org",
9797
+ sdkVersion: SDK_VERSION,
9798
+ model: modelName,
9799
+ provider: providerName,
9800
+ tokens: tokenCount,
9801
+ cost: costEst,
9802
+ costUsd: costEst,
9803
+ latencyMs: latencyDuration,
9804
+ status: "success",
9805
+ action: "RAG_QUERY",
9806
+ feature: "RAG",
9807
+ timestamp: (/* @__PURE__ */ new Date()).toISOString(),
9808
+ details: `Org: default-org | Model: ${providerName}/${modelName} | Tokens: ${tokenCount} | Latency: ${latencyDuration}ms | Cost: $${costEst} | SDK: v${SDK_VERSION} | Feature: RAG`
9647
9809
  })
9648
9810
  });
9649
9811
  } catch (err) {
@@ -11039,7 +11201,7 @@ function getOrCreatePlugin(configOrPlugin) {
11039
11201
  return _g[cacheKey];
11040
11202
  }
11041
11203
  function reportTelemetry(req, plugin, action, status, details, trace) {
11042
- var _a2;
11204
+ var _a2, _b, _c, _d, _e, _f, _g2, _h;
11043
11205
  try {
11044
11206
  const config = plugin.getConfig();
11045
11207
  const licenseKey = config.licenseKey || process.env.RAG_LICENSE_KEY || process.env.RETRIVORA_LICENSE_KEY || process.env.NEXT_PUBLIC_RETRIVORA_LICENSE_KEY;
@@ -11048,29 +11210,49 @@ function reportTelemetry(req, plugin, action, status, details, trace) {
11048
11210
  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";
11049
11211
  const telemetryUrl = (telemetryConfig == null ? void 0 : telemetryConfig.url) || process.env.TELEMETRY_URL || process.env.NEXT_PUBLIC_TELEMETRY_URL || defaultUrl;
11050
11212
  const host = req.headers.get("host") || "localhost";
11213
+ const userAgent = req.headers.get("user-agent") || `Retrivora-SDK/${SDK_VERSION}`;
11051
11214
  let absoluteUrl = telemetryUrl;
11052
11215
  if (!telemetryUrl.startsWith("http")) {
11053
11216
  const proto = req.headers.get("x-forwarded-proto") || "http";
11054
11217
  absoluteUrl = `${proto}://${host}${telemetryUrl}`;
11055
11218
  }
11056
11219
  const projectId = config.projectId || "default";
11220
+ const model = (trace == null ? void 0 : trace.model) || ((_b = config.llm) == null ? void 0 : _b.model) || ((_c = config.embedding) == null ? void 0 : _c.model) || "llama-3.1-8b-instant";
11221
+ const provider = (trace == null ? void 0 : trace.provider) || ((_d = config.llm) == null ? void 0 : _d.provider) || ((_e = config.embedding) == null ? void 0 : _e.provider) || "groq";
11222
+ const tokens = Number(((_f = trace == null ? void 0 : trace.tokens) == null ? void 0 : _f.totalTokens) || (trace == null ? void 0 : trace.totalTokens) || 0);
11223
+ const costUsd = Number(((_g2 = trace == null ? void 0 : trace.tokens) == null ? void 0 : _g2.estimatedCostUsd) || (trace == null ? void 0 : trace.costUsd) || 0);
11224
+ const latencyMs = Number(((_h = trace == null ? void 0 : trace.latency) == null ? void 0 : _h.totalMs) || (trace == null ? void 0 : trace.latencyMs) || 0);
11225
+ const payload = {
11226
+ trace,
11227
+ licenseKey,
11228
+ projectId,
11229
+ organization: process.env.RETRIVORA_ORGANIZATION || "default-org",
11230
+ sdkVersion: SDK_VERSION,
11231
+ model,
11232
+ provider,
11233
+ tokens,
11234
+ cost: costUsd,
11235
+ costUsd,
11236
+ latencyMs,
11237
+ status,
11238
+ action,
11239
+ feature: action,
11240
+ userAgent,
11241
+ timestamp: (/* @__PURE__ */ new Date()).toISOString(),
11242
+ details
11243
+ };
11244
+ console.log(`[Retrivora SDK Telemetry] \u{1F4CA} Dispatching telemetry -> Feature: "${action}", Status: "${status}", Project: "${projectId}", Model: "${provider}/${model}", Latency: ${latencyMs}ms`);
11057
11245
  fetch(absoluteUrl, {
11058
11246
  method: "POST",
11059
11247
  headers: {
11060
11248
  "Content-Type": "application/json",
11061
11249
  "x-forwarded-for": req.headers.get("x-forwarded-for") || "",
11062
- "x-real-ip": req.headers.get("x-real-ip") || ""
11250
+ "x-real-ip": req.headers.get("x-real-ip") || "",
11251
+ "user-agent": userAgent
11063
11252
  },
11064
- body: JSON.stringify({
11065
- trace,
11066
- licenseKey,
11067
- projectId,
11068
- action,
11069
- status,
11070
- details
11071
- })
11253
+ body: JSON.stringify(payload)
11072
11254
  }).catch((err) => {
11073
- console.warn("[Retrivora Telemetry] Async report warning:", err.message);
11255
+ console.warn("[Retrivora SDK Telemetry] Async report warning:", err.message);
11074
11256
  });
11075
11257
  } catch (e) {
11076
11258
  }
@@ -11725,6 +11907,7 @@ function createRagHandler(configOrPlugin, options) {
11725
11907
  Rule6SmallResultSetRule,
11726
11908
  Rule7LargeTableRule,
11727
11909
  RuleEngine,
11910
+ SDK_VERSION,
11728
11911
  TableRendererStrategy,
11729
11912
  TextRendererStrategy,
11730
11913
  UniversalLLMAdapter,