@retrivora-ai/rag-engine 2.1.7 → 2.1.9
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/handlers/index.js +62 -56
- package/dist/handlers/index.mjs +62 -56
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/dist/server.js +62 -56
- package/dist/server.mjs +62 -56
- package/package.json +1 -1
- package/src/config/serverConfig.ts +1 -2
- package/src/providers/vectordb/PineconeProvider.ts +16 -7
package/dist/handlers/index.js
CHANGED
|
@@ -807,20 +807,22 @@ var init_PineconeProvider = __esm({
|
|
|
807
807
|
PineconeProvider = class extends BaseVectorProvider {
|
|
808
808
|
constructor(config) {
|
|
809
809
|
super(config);
|
|
810
|
-
const opts = config.options;
|
|
811
|
-
|
|
812
|
-
this.apiKey = opts.apiKey;
|
|
810
|
+
const opts = config.options || {};
|
|
811
|
+
this.apiKey = opts.apiKey || process.env.PINECONE_API_KEY || "";
|
|
813
812
|
}
|
|
814
813
|
static getValidator() {
|
|
815
814
|
return {
|
|
816
815
|
validate(config) {
|
|
817
816
|
const errors = [];
|
|
818
817
|
const opts = config.options || {};
|
|
819
|
-
|
|
818
|
+
const hasLicenseKey = Boolean(
|
|
819
|
+
config.licenseKey || process.env.RETRIVORA_LICENSE_KEY || process.env.NEXT_PUBLIC_RETRIVORA_LICENSE_KEY
|
|
820
|
+
);
|
|
821
|
+
if (!opts.apiKey && !hasLicenseKey) {
|
|
820
822
|
errors.push({
|
|
821
823
|
field: "vectorDb.options.apiKey",
|
|
822
|
-
message: "Pinecone API key is required",
|
|
823
|
-
suggestion: "Set PINECONE_API_KEY environment variable",
|
|
824
|
+
message: "Pinecone API key is required when RETRIVORA_LICENSE_KEY is not set",
|
|
825
|
+
suggestion: "Set PINECONE_API_KEY environment variable or supply RETRIVORA_LICENSE_KEY for keyless vector storage",
|
|
824
826
|
severity: "error"
|
|
825
827
|
});
|
|
826
828
|
}
|
|
@@ -867,7 +869,12 @@ var init_PineconeProvider = __esm({
|
|
|
867
869
|
}
|
|
868
870
|
async initialize() {
|
|
869
871
|
var _a2, _b;
|
|
870
|
-
|
|
872
|
+
const key = this.apiKey || process.env.PINECONE_API_KEY || "";
|
|
873
|
+
if (!key) {
|
|
874
|
+
console.log("[PineconeProvider] Keyless Mode active \u2014 Vector operations managed via Retrivora Cloud Gateway.");
|
|
875
|
+
return;
|
|
876
|
+
}
|
|
877
|
+
this.client = new import_pinecone.Pinecone({ apiKey: key });
|
|
871
878
|
const indexes = await this.client.listIndexes();
|
|
872
879
|
const names = (_b = (_a2 = indexes.indexes) == null ? void 0 : _a2.map((i) => i.name)) != null ? _b : [];
|
|
873
880
|
if (!names.includes(this.indexName)) {
|
|
@@ -3080,7 +3087,7 @@ function readEnum(env, name, fallback, allowed) {
|
|
|
3080
3087
|
throw new Error(`[getRagConfig] ${name} must be one of: ${allowed.join(", ")}`);
|
|
3081
3088
|
}
|
|
3082
3089
|
function getEnvConfig(env = process.env, base) {
|
|
3083
|
-
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;
|
|
3090
|
+
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;
|
|
3084
3091
|
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__";
|
|
3085
3092
|
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;
|
|
3086
3093
|
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);
|
|
@@ -3088,39 +3095,38 @@ function getEnvConfig(env = process.env, base) {
|
|
|
3088
3095
|
const embeddingDimensions = readNumber(env, "EMBEDDING_DIMENSIONS", 768);
|
|
3089
3096
|
const vectorDbOptions = {};
|
|
3090
3097
|
if (vectorProvider === "pinecone") {
|
|
3091
|
-
|
|
3092
|
-
vectorDbOptions.
|
|
3093
|
-
vectorDbOptions.indexName = (_s = (_r = (_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) != null ? _r : process.env.PINECONE_INDEX) != null ? _s : "retrivora-free";
|
|
3098
|
+
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 : "";
|
|
3099
|
+
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";
|
|
3094
3100
|
} else if (vectorProvider === "pgvector" || vectorProvider === "postgresql") {
|
|
3095
|
-
vectorDbOptions.connectionString = (
|
|
3096
|
-
vectorDbOptions.tables = (
|
|
3097
|
-
vectorDbOptions.searchFields = (
|
|
3101
|
+
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 : "";
|
|
3102
|
+
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;
|
|
3103
|
+
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;
|
|
3098
3104
|
vectorDbOptions.dimensions = embeddingDimensions;
|
|
3099
3105
|
} else if (vectorProvider === "mongodb") {
|
|
3100
|
-
vectorDbOptions.uri = (
|
|
3101
|
-
vectorDbOptions.database = (
|
|
3102
|
-
vectorDbOptions.collection = (
|
|
3103
|
-
vectorDbOptions.indexName = (
|
|
3106
|
+
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 : "";
|
|
3107
|
+
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 : "";
|
|
3108
|
+
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 : "";
|
|
3109
|
+
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";
|
|
3104
3110
|
} else if (vectorProvider === "qdrant") {
|
|
3105
|
-
vectorDbOptions.baseUrl = (
|
|
3106
|
-
vectorDbOptions.apiKey = (
|
|
3111
|
+
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";
|
|
3112
|
+
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;
|
|
3107
3113
|
vectorDbOptions.dimensions = embeddingDimensions;
|
|
3108
3114
|
} else if (vectorProvider === "milvus") {
|
|
3109
|
-
vectorDbOptions.baseUrl = (
|
|
3115
|
+
vectorDbOptions.baseUrl = (_fa = readString(env, "MILVUS_URL")) != null ? _fa : "http://localhost:19530";
|
|
3110
3116
|
vectorDbOptions.apiKey = readString(env, "MILVUS_API_KEY");
|
|
3111
3117
|
} else if (vectorProvider === "chromadb") {
|
|
3112
|
-
vectorDbOptions.baseUrl = (
|
|
3118
|
+
vectorDbOptions.baseUrl = (_ga = readString(env, "CHROMADB_URL")) != null ? _ga : "http://localhost:8000";
|
|
3113
3119
|
} else if (vectorProvider === "weaviate") {
|
|
3114
|
-
vectorDbOptions.baseUrl = (
|
|
3120
|
+
vectorDbOptions.baseUrl = (_ha = readString(env, "WEAVIATE_URL")) != null ? _ha : "http://localhost:8080";
|
|
3115
3121
|
vectorDbOptions.apiKey = readString(env, "WEAVIATE_API_KEY");
|
|
3116
3122
|
} else if (vectorProvider === "redis") {
|
|
3117
|
-
vectorDbOptions.baseUrl = (
|
|
3123
|
+
vectorDbOptions.baseUrl = (_ia = readString(env, "REDIS_URL")) != null ? _ia : "";
|
|
3118
3124
|
vectorDbOptions.apiKey = readString(env, "REDIS_API_KEY");
|
|
3119
3125
|
} else if (vectorProvider === "rest") {
|
|
3120
|
-
vectorDbOptions.baseUrl = (
|
|
3126
|
+
vectorDbOptions.baseUrl = (_ja = readString(env, "VECTOR_DB_REST_URL")) != null ? _ja : "";
|
|
3121
3127
|
vectorDbOptions.headers = readString(env, "VECTOR_DB_REST_API_KEY") ? { "api-key": readString(env, "VECTOR_DB_REST_API_KEY") } : {};
|
|
3122
3128
|
} else if (vectorProvider === "universal_rest") {
|
|
3123
|
-
vectorDbOptions.baseUrl = (
|
|
3129
|
+
vectorDbOptions.baseUrl = (_la = (_ka = readString(env, "VECTOR_BASE_URL")) != null ? _ka : readString(env, "VECTOR_DB_REST_URL")) != null ? _la : "";
|
|
3124
3130
|
vectorDbOptions.profile = readString(env, "VECTOR_UNIVERSAL_PROFILE");
|
|
3125
3131
|
vectorDbOptions.headers = readString(env, "VECTOR_DB_REST_API_KEY") ? { Authorization: `Bearer ${readString(env, "VECTOR_DB_REST_API_KEY")}` } : {};
|
|
3126
3132
|
}
|
|
@@ -3139,8 +3145,8 @@ function getEnvConfig(env = process.env, base) {
|
|
|
3139
3145
|
// Anthropic needs a separate embedding provider; key kept for completeness
|
|
3140
3146
|
gemini: readString(env, "GEMINI_API_KEY"),
|
|
3141
3147
|
ollama: void 0,
|
|
3142
|
-
universal_rest: (
|
|
3143
|
-
custom: (
|
|
3148
|
+
universal_rest: (_ma = readString(env, "EMBEDDING_API_KEY")) != null ? _ma : readString(env, "OPENAI_API_KEY"),
|
|
3149
|
+
custom: (_na = readString(env, "EMBEDDING_API_KEY")) != null ? _na : readString(env, "OPENAI_API_KEY")
|
|
3144
3150
|
};
|
|
3145
3151
|
const DEFAULT_MODEL_BY_PROVIDER = {
|
|
3146
3152
|
openai: "gpt-4o",
|
|
@@ -3161,25 +3167,25 @@ function getEnvConfig(env = process.env, base) {
|
|
|
3161
3167
|
return true;
|
|
3162
3168
|
}
|
|
3163
3169
|
})();
|
|
3164
|
-
const defaultGatewayUrl = (
|
|
3170
|
+
const defaultGatewayUrl = (_pa = (_oa = readString(env, "LITELLM_BASE_URL")) != null ? _oa : readString(env, "LLM_BASE_URL")) != null ? _pa : "https://llm.retrivora.com/api/v1";
|
|
3165
3171
|
const defaultLlmProvider = isFreeTier ? "universal_rest" : "universal_rest";
|
|
3166
|
-
const llmProvider = (
|
|
3167
|
-
const llmBaseUrl = (
|
|
3168
|
-
const llmModel = (
|
|
3169
|
-
const llmApiKey = (
|
|
3170
|
-
const llmProfile = (
|
|
3172
|
+
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;
|
|
3173
|
+
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;
|
|
3174
|
+
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";
|
|
3175
|
+
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;
|
|
3176
|
+
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";
|
|
3171
3177
|
const defaultEmbeddingProvider = isFreeTier ? "universal_rest" : "universal_rest";
|
|
3172
|
-
const embeddingProvider = (
|
|
3173
|
-
const embeddingBaseUrl = (
|
|
3174
|
-
const embeddingModel = (
|
|
3175
|
-
const embeddingApiKey = (_$a = (
|
|
3176
|
-
const embeddingProfile = (
|
|
3178
|
+
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;
|
|
3179
|
+
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;
|
|
3180
|
+
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";
|
|
3181
|
+
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;
|
|
3182
|
+
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";
|
|
3177
3183
|
return __spreadProps(__spreadValues({
|
|
3178
3184
|
projectId,
|
|
3179
3185
|
licenseKey,
|
|
3180
3186
|
vectorDb: {
|
|
3181
3187
|
provider: vectorProvider,
|
|
3182
|
-
indexName: (
|
|
3188
|
+
indexName: (_gb = (_fb = readString(env, "VECTOR_DB_INDEX")) != null ? _fb : vectorDbOptions.indexName) != null ? _gb : "rag-index",
|
|
3183
3189
|
options: vectorDbOptions
|
|
3184
3190
|
},
|
|
3185
3191
|
llm: {
|
|
@@ -3209,30 +3215,30 @@ function getEnvConfig(env = process.env, base) {
|
|
|
3209
3215
|
}
|
|
3210
3216
|
},
|
|
3211
3217
|
ui: {
|
|
3212
|
-
title: (
|
|
3213
|
-
subtitle: (
|
|
3214
|
-
primaryColor: (
|
|
3215
|
-
accentColor: (
|
|
3216
|
-
logoUrl: (
|
|
3217
|
-
placeholder: (
|
|
3218
|
-
showSources: ((
|
|
3219
|
-
welcomeMessage: (
|
|
3220
|
-
visualStyle: (
|
|
3221
|
-
borderRadius: (
|
|
3222
|
-
allowUpload: ((
|
|
3218
|
+
title: (_ib = (_hb = readString(env, "NEXT_PUBLIC_UI_TITLE")) != null ? _hb : readString(env, "UI_TITLE")) != null ? _ib : "AI Assistant",
|
|
3219
|
+
subtitle: (_kb = (_jb = readString(env, "NEXT_PUBLIC_UI_SUBTITLE")) != null ? _jb : readString(env, "UI_SUBTITLE")) != null ? _kb : "Powered by RAG",
|
|
3220
|
+
primaryColor: (_mb = (_lb = readString(env, "NEXT_PUBLIC_PRIMARY_COLOR")) != null ? _lb : readString(env, "UI_PRIMARY_COLOR")) != null ? _mb : "#10b981",
|
|
3221
|
+
accentColor: (_ob = (_nb = readString(env, "NEXT_PUBLIC_ACCENT_COLOR")) != null ? _nb : readString(env, "UI_ACCENT_COLOR")) != null ? _ob : "#3b82f6",
|
|
3222
|
+
logoUrl: (_pb = readString(env, "NEXT_PUBLIC_LOGO_URL")) != null ? _pb : readString(env, "UI_LOGO_URL"),
|
|
3223
|
+
placeholder: (_rb = (_qb = readString(env, "NEXT_PUBLIC_PLACEHOLDER")) != null ? _qb : readString(env, "UI_PLACEHOLDER")) != null ? _rb : "Ask me anything\u2026",
|
|
3224
|
+
showSources: ((_tb = (_sb = readString(env, "NEXT_PUBLIC_SHOW_SOURCES")) != null ? _sb : readString(env, "UI_SHOW_SOURCES")) != null ? _tb : "true") !== "false",
|
|
3225
|
+
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.",
|
|
3226
|
+
visualStyle: (_xb = (_wb = readString(env, "NEXT_PUBLIC_UI_VISUAL_STYLE")) != null ? _wb : readString(env, "UI_VISUAL_STYLE")) != null ? _xb : "glass",
|
|
3227
|
+
borderRadius: (_zb = (_yb = readString(env, "NEXT_PUBLIC_UI_BORDER_RADIUS")) != null ? _yb : readString(env, "UI_BORDER_RADIUS")) != null ? _zb : "xl",
|
|
3228
|
+
allowUpload: ((_Bb = (_Ab = readString(env, "NEXT_PUBLIC_ALLOW_UPLOAD")) != null ? _Ab : readString(env, "UI_ALLOW_UPLOAD")) != null ? _Bb : "false") === "true"
|
|
3223
3229
|
},
|
|
3224
3230
|
rag: {
|
|
3225
3231
|
topK: readNumber(env, "RAG_TOP_K", 5),
|
|
3226
3232
|
scoreThreshold: readNumber(env, "RAG_SCORE_THRESHOLD", 0),
|
|
3227
3233
|
chunkSize: readNumber(env, "RAG_CHUNK_SIZE", 1e3),
|
|
3228
3234
|
chunkOverlap: readNumber(env, "RAG_CHUNK_OVERLAP", 200),
|
|
3229
|
-
filterableFields: (
|
|
3235
|
+
filterableFields: (_Cb = readString(env, "RAG_FILTERABLE_FIELDS")) == null ? void 0 : _Cb.split(",").map((f) => f.trim()),
|
|
3230
3236
|
// Query pipeline toggles — read from .env.local
|
|
3231
3237
|
useQueryTransformation: readString(env, "RAG_USE_QUERY_TRANSFORMATION") === "true",
|
|
3232
3238
|
useReranking: readString(env, "RAG_USE_RERANKING") === "true",
|
|
3233
3239
|
useGraphRetrieval: readString(env, "RAG_USE_GRAPH_RETRIEVAL") === "true",
|
|
3234
|
-
architecture: (
|
|
3235
|
-
chunkingStrategy: (
|
|
3240
|
+
architecture: (_Db = readString(env, "RAG_ARCHITECTURE")) != null ? _Db : "simple",
|
|
3241
|
+
chunkingStrategy: (_Eb = readString(env, "RAG_CHUNKING_STRATEGY")) != null ? _Eb : "recursive",
|
|
3236
3242
|
uiMapping: (() => {
|
|
3237
3243
|
const raw = readString(env, "RAG_UI_MAPPING");
|
|
3238
3244
|
if (!raw) return void 0;
|
|
@@ -3245,7 +3251,7 @@ function getEnvConfig(env = process.env, base) {
|
|
|
3245
3251
|
},
|
|
3246
3252
|
telemetry: {
|
|
3247
3253
|
enabled: telemetryEnabled,
|
|
3248
|
-
url: (
|
|
3254
|
+
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"
|
|
3249
3255
|
}
|
|
3250
3256
|
}, readString(env, "GRAPH_DB_PROVIDER") ? {
|
|
3251
3257
|
graphDb: {
|
|
@@ -5248,7 +5254,7 @@ var ConfigValidator = class {
|
|
|
5248
5254
|
// package.json
|
|
5249
5255
|
var package_default = {
|
|
5250
5256
|
name: "@retrivora-ai/rag-engine",
|
|
5251
|
-
version: "2.1.
|
|
5257
|
+
version: "2.1.9",
|
|
5252
5258
|
description: "Retrivora AI is a plug-and-play AI engine for RAG chat experiences \u2014 generic vector DB + LLM provider, embeddable or standalone.",
|
|
5253
5259
|
author: "Abhinav Alkuchi",
|
|
5254
5260
|
license: "UNLICENSED",
|
package/dist/handlers/index.mjs
CHANGED
|
@@ -792,20 +792,22 @@ var init_PineconeProvider = __esm({
|
|
|
792
792
|
PineconeProvider = class extends BaseVectorProvider {
|
|
793
793
|
constructor(config) {
|
|
794
794
|
super(config);
|
|
795
|
-
const opts = config.options;
|
|
796
|
-
|
|
797
|
-
this.apiKey = opts.apiKey;
|
|
795
|
+
const opts = config.options || {};
|
|
796
|
+
this.apiKey = opts.apiKey || process.env.PINECONE_API_KEY || "";
|
|
798
797
|
}
|
|
799
798
|
static getValidator() {
|
|
800
799
|
return {
|
|
801
800
|
validate(config) {
|
|
802
801
|
const errors = [];
|
|
803
802
|
const opts = config.options || {};
|
|
804
|
-
|
|
803
|
+
const hasLicenseKey = Boolean(
|
|
804
|
+
config.licenseKey || process.env.RETRIVORA_LICENSE_KEY || process.env.NEXT_PUBLIC_RETRIVORA_LICENSE_KEY
|
|
805
|
+
);
|
|
806
|
+
if (!opts.apiKey && !hasLicenseKey) {
|
|
805
807
|
errors.push({
|
|
806
808
|
field: "vectorDb.options.apiKey",
|
|
807
|
-
message: "Pinecone API key is required",
|
|
808
|
-
suggestion: "Set PINECONE_API_KEY environment variable",
|
|
809
|
+
message: "Pinecone API key is required when RETRIVORA_LICENSE_KEY is not set",
|
|
810
|
+
suggestion: "Set PINECONE_API_KEY environment variable or supply RETRIVORA_LICENSE_KEY for keyless vector storage",
|
|
809
811
|
severity: "error"
|
|
810
812
|
});
|
|
811
813
|
}
|
|
@@ -852,7 +854,12 @@ var init_PineconeProvider = __esm({
|
|
|
852
854
|
}
|
|
853
855
|
async initialize() {
|
|
854
856
|
var _a2, _b;
|
|
855
|
-
|
|
857
|
+
const key = this.apiKey || process.env.PINECONE_API_KEY || "";
|
|
858
|
+
if (!key) {
|
|
859
|
+
console.log("[PineconeProvider] Keyless Mode active \u2014 Vector operations managed via Retrivora Cloud Gateway.");
|
|
860
|
+
return;
|
|
861
|
+
}
|
|
862
|
+
this.client = new Pinecone({ apiKey: key });
|
|
856
863
|
const indexes = await this.client.listIndexes();
|
|
857
864
|
const names = (_b = (_a2 = indexes.indexes) == null ? void 0 : _a2.map((i) => i.name)) != null ? _b : [];
|
|
858
865
|
if (!names.includes(this.indexName)) {
|
|
@@ -3045,7 +3052,7 @@ function readEnum(env, name, fallback, allowed) {
|
|
|
3045
3052
|
throw new Error(`[getRagConfig] ${name} must be one of: ${allowed.join(", ")}`);
|
|
3046
3053
|
}
|
|
3047
3054
|
function getEnvConfig(env = process.env, base) {
|
|
3048
|
-
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;
|
|
3055
|
+
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;
|
|
3049
3056
|
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__";
|
|
3050
3057
|
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;
|
|
3051
3058
|
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);
|
|
@@ -3053,39 +3060,38 @@ function getEnvConfig(env = process.env, base) {
|
|
|
3053
3060
|
const embeddingDimensions = readNumber(env, "EMBEDDING_DIMENSIONS", 768);
|
|
3054
3061
|
const vectorDbOptions = {};
|
|
3055
3062
|
if (vectorProvider === "pinecone") {
|
|
3056
|
-
|
|
3057
|
-
vectorDbOptions.
|
|
3058
|
-
vectorDbOptions.indexName = (_s = (_r = (_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) != null ? _r : process.env.PINECONE_INDEX) != null ? _s : "retrivora-free";
|
|
3063
|
+
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 : "";
|
|
3064
|
+
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";
|
|
3059
3065
|
} else if (vectorProvider === "pgvector" || vectorProvider === "postgresql") {
|
|
3060
|
-
vectorDbOptions.connectionString = (
|
|
3061
|
-
vectorDbOptions.tables = (
|
|
3062
|
-
vectorDbOptions.searchFields = (
|
|
3066
|
+
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 : "";
|
|
3067
|
+
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;
|
|
3068
|
+
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;
|
|
3063
3069
|
vectorDbOptions.dimensions = embeddingDimensions;
|
|
3064
3070
|
} else if (vectorProvider === "mongodb") {
|
|
3065
|
-
vectorDbOptions.uri = (
|
|
3066
|
-
vectorDbOptions.database = (
|
|
3067
|
-
vectorDbOptions.collection = (
|
|
3068
|
-
vectorDbOptions.indexName = (
|
|
3071
|
+
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 : "";
|
|
3072
|
+
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 : "";
|
|
3073
|
+
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 : "";
|
|
3074
|
+
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";
|
|
3069
3075
|
} else if (vectorProvider === "qdrant") {
|
|
3070
|
-
vectorDbOptions.baseUrl = (
|
|
3071
|
-
vectorDbOptions.apiKey = (
|
|
3076
|
+
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";
|
|
3077
|
+
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;
|
|
3072
3078
|
vectorDbOptions.dimensions = embeddingDimensions;
|
|
3073
3079
|
} else if (vectorProvider === "milvus") {
|
|
3074
|
-
vectorDbOptions.baseUrl = (
|
|
3080
|
+
vectorDbOptions.baseUrl = (_fa = readString(env, "MILVUS_URL")) != null ? _fa : "http://localhost:19530";
|
|
3075
3081
|
vectorDbOptions.apiKey = readString(env, "MILVUS_API_KEY");
|
|
3076
3082
|
} else if (vectorProvider === "chromadb") {
|
|
3077
|
-
vectorDbOptions.baseUrl = (
|
|
3083
|
+
vectorDbOptions.baseUrl = (_ga = readString(env, "CHROMADB_URL")) != null ? _ga : "http://localhost:8000";
|
|
3078
3084
|
} else if (vectorProvider === "weaviate") {
|
|
3079
|
-
vectorDbOptions.baseUrl = (
|
|
3085
|
+
vectorDbOptions.baseUrl = (_ha = readString(env, "WEAVIATE_URL")) != null ? _ha : "http://localhost:8080";
|
|
3080
3086
|
vectorDbOptions.apiKey = readString(env, "WEAVIATE_API_KEY");
|
|
3081
3087
|
} else if (vectorProvider === "redis") {
|
|
3082
|
-
vectorDbOptions.baseUrl = (
|
|
3088
|
+
vectorDbOptions.baseUrl = (_ia = readString(env, "REDIS_URL")) != null ? _ia : "";
|
|
3083
3089
|
vectorDbOptions.apiKey = readString(env, "REDIS_API_KEY");
|
|
3084
3090
|
} else if (vectorProvider === "rest") {
|
|
3085
|
-
vectorDbOptions.baseUrl = (
|
|
3091
|
+
vectorDbOptions.baseUrl = (_ja = readString(env, "VECTOR_DB_REST_URL")) != null ? _ja : "";
|
|
3086
3092
|
vectorDbOptions.headers = readString(env, "VECTOR_DB_REST_API_KEY") ? { "api-key": readString(env, "VECTOR_DB_REST_API_KEY") } : {};
|
|
3087
3093
|
} else if (vectorProvider === "universal_rest") {
|
|
3088
|
-
vectorDbOptions.baseUrl = (
|
|
3094
|
+
vectorDbOptions.baseUrl = (_la = (_ka = readString(env, "VECTOR_BASE_URL")) != null ? _ka : readString(env, "VECTOR_DB_REST_URL")) != null ? _la : "";
|
|
3089
3095
|
vectorDbOptions.profile = readString(env, "VECTOR_UNIVERSAL_PROFILE");
|
|
3090
3096
|
vectorDbOptions.headers = readString(env, "VECTOR_DB_REST_API_KEY") ? { Authorization: `Bearer ${readString(env, "VECTOR_DB_REST_API_KEY")}` } : {};
|
|
3091
3097
|
}
|
|
@@ -3104,8 +3110,8 @@ function getEnvConfig(env = process.env, base) {
|
|
|
3104
3110
|
// Anthropic needs a separate embedding provider; key kept for completeness
|
|
3105
3111
|
gemini: readString(env, "GEMINI_API_KEY"),
|
|
3106
3112
|
ollama: void 0,
|
|
3107
|
-
universal_rest: (
|
|
3108
|
-
custom: (
|
|
3113
|
+
universal_rest: (_ma = readString(env, "EMBEDDING_API_KEY")) != null ? _ma : readString(env, "OPENAI_API_KEY"),
|
|
3114
|
+
custom: (_na = readString(env, "EMBEDDING_API_KEY")) != null ? _na : readString(env, "OPENAI_API_KEY")
|
|
3109
3115
|
};
|
|
3110
3116
|
const DEFAULT_MODEL_BY_PROVIDER = {
|
|
3111
3117
|
openai: "gpt-4o",
|
|
@@ -3126,25 +3132,25 @@ function getEnvConfig(env = process.env, base) {
|
|
|
3126
3132
|
return true;
|
|
3127
3133
|
}
|
|
3128
3134
|
})();
|
|
3129
|
-
const defaultGatewayUrl = (
|
|
3135
|
+
const defaultGatewayUrl = (_pa = (_oa = readString(env, "LITELLM_BASE_URL")) != null ? _oa : readString(env, "LLM_BASE_URL")) != null ? _pa : "https://llm.retrivora.com/api/v1";
|
|
3130
3136
|
const defaultLlmProvider = isFreeTier ? "universal_rest" : "universal_rest";
|
|
3131
|
-
const llmProvider = (
|
|
3132
|
-
const llmBaseUrl = (
|
|
3133
|
-
const llmModel = (
|
|
3134
|
-
const llmApiKey = (
|
|
3135
|
-
const llmProfile = (
|
|
3137
|
+
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;
|
|
3138
|
+
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;
|
|
3139
|
+
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";
|
|
3140
|
+
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;
|
|
3141
|
+
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";
|
|
3136
3142
|
const defaultEmbeddingProvider = isFreeTier ? "universal_rest" : "universal_rest";
|
|
3137
|
-
const embeddingProvider = (
|
|
3138
|
-
const embeddingBaseUrl = (
|
|
3139
|
-
const embeddingModel = (
|
|
3140
|
-
const embeddingApiKey = (_$a = (
|
|
3141
|
-
const embeddingProfile = (
|
|
3143
|
+
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;
|
|
3144
|
+
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;
|
|
3145
|
+
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";
|
|
3146
|
+
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;
|
|
3147
|
+
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";
|
|
3142
3148
|
return __spreadProps(__spreadValues({
|
|
3143
3149
|
projectId,
|
|
3144
3150
|
licenseKey,
|
|
3145
3151
|
vectorDb: {
|
|
3146
3152
|
provider: vectorProvider,
|
|
3147
|
-
indexName: (
|
|
3153
|
+
indexName: (_gb = (_fb = readString(env, "VECTOR_DB_INDEX")) != null ? _fb : vectorDbOptions.indexName) != null ? _gb : "rag-index",
|
|
3148
3154
|
options: vectorDbOptions
|
|
3149
3155
|
},
|
|
3150
3156
|
llm: {
|
|
@@ -3174,30 +3180,30 @@ function getEnvConfig(env = process.env, base) {
|
|
|
3174
3180
|
}
|
|
3175
3181
|
},
|
|
3176
3182
|
ui: {
|
|
3177
|
-
title: (
|
|
3178
|
-
subtitle: (
|
|
3179
|
-
primaryColor: (
|
|
3180
|
-
accentColor: (
|
|
3181
|
-
logoUrl: (
|
|
3182
|
-
placeholder: (
|
|
3183
|
-
showSources: ((
|
|
3184
|
-
welcomeMessage: (
|
|
3185
|
-
visualStyle: (
|
|
3186
|
-
borderRadius: (
|
|
3187
|
-
allowUpload: ((
|
|
3183
|
+
title: (_ib = (_hb = readString(env, "NEXT_PUBLIC_UI_TITLE")) != null ? _hb : readString(env, "UI_TITLE")) != null ? _ib : "AI Assistant",
|
|
3184
|
+
subtitle: (_kb = (_jb = readString(env, "NEXT_PUBLIC_UI_SUBTITLE")) != null ? _jb : readString(env, "UI_SUBTITLE")) != null ? _kb : "Powered by RAG",
|
|
3185
|
+
primaryColor: (_mb = (_lb = readString(env, "NEXT_PUBLIC_PRIMARY_COLOR")) != null ? _lb : readString(env, "UI_PRIMARY_COLOR")) != null ? _mb : "#10b981",
|
|
3186
|
+
accentColor: (_ob = (_nb = readString(env, "NEXT_PUBLIC_ACCENT_COLOR")) != null ? _nb : readString(env, "UI_ACCENT_COLOR")) != null ? _ob : "#3b82f6",
|
|
3187
|
+
logoUrl: (_pb = readString(env, "NEXT_PUBLIC_LOGO_URL")) != null ? _pb : readString(env, "UI_LOGO_URL"),
|
|
3188
|
+
placeholder: (_rb = (_qb = readString(env, "NEXT_PUBLIC_PLACEHOLDER")) != null ? _qb : readString(env, "UI_PLACEHOLDER")) != null ? _rb : "Ask me anything\u2026",
|
|
3189
|
+
showSources: ((_tb = (_sb = readString(env, "NEXT_PUBLIC_SHOW_SOURCES")) != null ? _sb : readString(env, "UI_SHOW_SOURCES")) != null ? _tb : "true") !== "false",
|
|
3190
|
+
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.",
|
|
3191
|
+
visualStyle: (_xb = (_wb = readString(env, "NEXT_PUBLIC_UI_VISUAL_STYLE")) != null ? _wb : readString(env, "UI_VISUAL_STYLE")) != null ? _xb : "glass",
|
|
3192
|
+
borderRadius: (_zb = (_yb = readString(env, "NEXT_PUBLIC_UI_BORDER_RADIUS")) != null ? _yb : readString(env, "UI_BORDER_RADIUS")) != null ? _zb : "xl",
|
|
3193
|
+
allowUpload: ((_Bb = (_Ab = readString(env, "NEXT_PUBLIC_ALLOW_UPLOAD")) != null ? _Ab : readString(env, "UI_ALLOW_UPLOAD")) != null ? _Bb : "false") === "true"
|
|
3188
3194
|
},
|
|
3189
3195
|
rag: {
|
|
3190
3196
|
topK: readNumber(env, "RAG_TOP_K", 5),
|
|
3191
3197
|
scoreThreshold: readNumber(env, "RAG_SCORE_THRESHOLD", 0),
|
|
3192
3198
|
chunkSize: readNumber(env, "RAG_CHUNK_SIZE", 1e3),
|
|
3193
3199
|
chunkOverlap: readNumber(env, "RAG_CHUNK_OVERLAP", 200),
|
|
3194
|
-
filterableFields: (
|
|
3200
|
+
filterableFields: (_Cb = readString(env, "RAG_FILTERABLE_FIELDS")) == null ? void 0 : _Cb.split(",").map((f) => f.trim()),
|
|
3195
3201
|
// Query pipeline toggles — read from .env.local
|
|
3196
3202
|
useQueryTransformation: readString(env, "RAG_USE_QUERY_TRANSFORMATION") === "true",
|
|
3197
3203
|
useReranking: readString(env, "RAG_USE_RERANKING") === "true",
|
|
3198
3204
|
useGraphRetrieval: readString(env, "RAG_USE_GRAPH_RETRIEVAL") === "true",
|
|
3199
|
-
architecture: (
|
|
3200
|
-
chunkingStrategy: (
|
|
3205
|
+
architecture: (_Db = readString(env, "RAG_ARCHITECTURE")) != null ? _Db : "simple",
|
|
3206
|
+
chunkingStrategy: (_Eb = readString(env, "RAG_CHUNKING_STRATEGY")) != null ? _Eb : "recursive",
|
|
3201
3207
|
uiMapping: (() => {
|
|
3202
3208
|
const raw = readString(env, "RAG_UI_MAPPING");
|
|
3203
3209
|
if (!raw) return void 0;
|
|
@@ -3210,7 +3216,7 @@ function getEnvConfig(env = process.env, base) {
|
|
|
3210
3216
|
},
|
|
3211
3217
|
telemetry: {
|
|
3212
3218
|
enabled: telemetryEnabled,
|
|
3213
|
-
url: (
|
|
3219
|
+
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"
|
|
3214
3220
|
}
|
|
3215
3221
|
}, readString(env, "GRAPH_DB_PROVIDER") ? {
|
|
3216
3222
|
graphDb: {
|
|
@@ -5213,7 +5219,7 @@ var ConfigValidator = class {
|
|
|
5213
5219
|
// package.json
|
|
5214
5220
|
var package_default = {
|
|
5215
5221
|
name: "@retrivora-ai/rag-engine",
|
|
5216
|
-
version: "2.1.
|
|
5222
|
+
version: "2.1.9",
|
|
5217
5223
|
description: "Retrivora AI is a plug-and-play AI engine for RAG chat experiences \u2014 generic vector DB + LLM provider, embeddable or standalone.",
|
|
5218
5224
|
author: "Abhinav Alkuchi",
|
|
5219
5225
|
license: "UNLICENSED",
|
package/dist/index.js
CHANGED
|
@@ -3563,7 +3563,7 @@ function ChatWidget({ position = "bottom-right", onAddToCart, apiUrl, retrivoraA
|
|
|
3563
3563
|
// package.json
|
|
3564
3564
|
var package_default = {
|
|
3565
3565
|
name: "@retrivora-ai/rag-engine",
|
|
3566
|
-
version: "2.1.
|
|
3566
|
+
version: "2.1.9",
|
|
3567
3567
|
description: "Retrivora AI is a plug-and-play AI engine for RAG chat experiences \u2014 generic vector DB + LLM provider, embeddable or standalone.",
|
|
3568
3568
|
author: "Abhinav Alkuchi",
|
|
3569
3569
|
license: "UNLICENSED",
|
package/dist/index.mjs
CHANGED
|
@@ -3564,7 +3564,7 @@ function ChatWidget({ position = "bottom-right", onAddToCart, apiUrl, retrivoraA
|
|
|
3564
3564
|
// package.json
|
|
3565
3565
|
var package_default = {
|
|
3566
3566
|
name: "@retrivora-ai/rag-engine",
|
|
3567
|
-
version: "2.1.
|
|
3567
|
+
version: "2.1.9",
|
|
3568
3568
|
description: "Retrivora AI is a plug-and-play AI engine for RAG chat experiences \u2014 generic vector DB + LLM provider, embeddable or standalone.",
|
|
3569
3569
|
author: "Abhinav Alkuchi",
|
|
3570
3570
|
license: "UNLICENSED",
|
package/dist/server.js
CHANGED
|
@@ -807,20 +807,22 @@ var init_PineconeProvider = __esm({
|
|
|
807
807
|
PineconeProvider = class extends BaseVectorProvider {
|
|
808
808
|
constructor(config) {
|
|
809
809
|
super(config);
|
|
810
|
-
const opts = config.options;
|
|
811
|
-
|
|
812
|
-
this.apiKey = opts.apiKey;
|
|
810
|
+
const opts = config.options || {};
|
|
811
|
+
this.apiKey = opts.apiKey || process.env.PINECONE_API_KEY || "";
|
|
813
812
|
}
|
|
814
813
|
static getValidator() {
|
|
815
814
|
return {
|
|
816
815
|
validate(config) {
|
|
817
816
|
const errors = [];
|
|
818
817
|
const opts = config.options || {};
|
|
819
|
-
|
|
818
|
+
const hasLicenseKey = Boolean(
|
|
819
|
+
config.licenseKey || process.env.RETRIVORA_LICENSE_KEY || process.env.NEXT_PUBLIC_RETRIVORA_LICENSE_KEY
|
|
820
|
+
);
|
|
821
|
+
if (!opts.apiKey && !hasLicenseKey) {
|
|
820
822
|
errors.push({
|
|
821
823
|
field: "vectorDb.options.apiKey",
|
|
822
|
-
message: "Pinecone API key is required",
|
|
823
|
-
suggestion: "Set PINECONE_API_KEY environment variable",
|
|
824
|
+
message: "Pinecone API key is required when RETRIVORA_LICENSE_KEY is not set",
|
|
825
|
+
suggestion: "Set PINECONE_API_KEY environment variable or supply RETRIVORA_LICENSE_KEY for keyless vector storage",
|
|
824
826
|
severity: "error"
|
|
825
827
|
});
|
|
826
828
|
}
|
|
@@ -867,7 +869,12 @@ var init_PineconeProvider = __esm({
|
|
|
867
869
|
}
|
|
868
870
|
async initialize() {
|
|
869
871
|
var _a2, _b;
|
|
870
|
-
|
|
872
|
+
const key = this.apiKey || process.env.PINECONE_API_KEY || "";
|
|
873
|
+
if (!key) {
|
|
874
|
+
console.log("[PineconeProvider] Keyless Mode active \u2014 Vector operations managed via Retrivora Cloud Gateway.");
|
|
875
|
+
return;
|
|
876
|
+
}
|
|
877
|
+
this.client = new import_pinecone.Pinecone({ apiKey: key });
|
|
871
878
|
const indexes = await this.client.listIndexes();
|
|
872
879
|
const names = (_b = (_a2 = indexes.indexes) == null ? void 0 : _a2.map((i) => i.name)) != null ? _b : [];
|
|
873
880
|
if (!names.includes(this.indexName)) {
|
|
@@ -3142,7 +3149,7 @@ function getRagConfig(baseConfig, env = process.env) {
|
|
|
3142
3149
|
return getEnvConfig(env, baseConfig);
|
|
3143
3150
|
}
|
|
3144
3151
|
function getEnvConfig(env = process.env, base) {
|
|
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;
|
|
3152
|
+
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;
|
|
3146
3153
|
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__";
|
|
3147
3154
|
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;
|
|
3148
3155
|
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);
|
|
@@ -3150,39 +3157,38 @@ function getEnvConfig(env = process.env, base) {
|
|
|
3150
3157
|
const embeddingDimensions = readNumber(env, "EMBEDDING_DIMENSIONS", 768);
|
|
3151
3158
|
const vectorDbOptions = {};
|
|
3152
3159
|
if (vectorProvider === "pinecone") {
|
|
3153
|
-
|
|
3154
|
-
vectorDbOptions.
|
|
3155
|
-
vectorDbOptions.indexName = (_s = (_r = (_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) != null ? _r : process.env.PINECONE_INDEX) != null ? _s : "retrivora-free";
|
|
3160
|
+
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 : "";
|
|
3161
|
+
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";
|
|
3156
3162
|
} else if (vectorProvider === "pgvector" || vectorProvider === "postgresql") {
|
|
3157
|
-
vectorDbOptions.connectionString = (
|
|
3158
|
-
vectorDbOptions.tables = (
|
|
3159
|
-
vectorDbOptions.searchFields = (
|
|
3163
|
+
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 : "";
|
|
3164
|
+
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;
|
|
3165
|
+
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;
|
|
3160
3166
|
vectorDbOptions.dimensions = embeddingDimensions;
|
|
3161
3167
|
} else if (vectorProvider === "mongodb") {
|
|
3162
|
-
vectorDbOptions.uri = (
|
|
3163
|
-
vectorDbOptions.database = (
|
|
3164
|
-
vectorDbOptions.collection = (
|
|
3165
|
-
vectorDbOptions.indexName = (
|
|
3168
|
+
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 : "";
|
|
3169
|
+
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 : "";
|
|
3170
|
+
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 : "";
|
|
3171
|
+
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";
|
|
3166
3172
|
} else if (vectorProvider === "qdrant") {
|
|
3167
|
-
vectorDbOptions.baseUrl = (
|
|
3168
|
-
vectorDbOptions.apiKey = (
|
|
3173
|
+
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";
|
|
3174
|
+
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;
|
|
3169
3175
|
vectorDbOptions.dimensions = embeddingDimensions;
|
|
3170
3176
|
} else if (vectorProvider === "milvus") {
|
|
3171
|
-
vectorDbOptions.baseUrl = (
|
|
3177
|
+
vectorDbOptions.baseUrl = (_fa = readString(env, "MILVUS_URL")) != null ? _fa : "http://localhost:19530";
|
|
3172
3178
|
vectorDbOptions.apiKey = readString(env, "MILVUS_API_KEY");
|
|
3173
3179
|
} else if (vectorProvider === "chromadb") {
|
|
3174
|
-
vectorDbOptions.baseUrl = (
|
|
3180
|
+
vectorDbOptions.baseUrl = (_ga = readString(env, "CHROMADB_URL")) != null ? _ga : "http://localhost:8000";
|
|
3175
3181
|
} else if (vectorProvider === "weaviate") {
|
|
3176
|
-
vectorDbOptions.baseUrl = (
|
|
3182
|
+
vectorDbOptions.baseUrl = (_ha = readString(env, "WEAVIATE_URL")) != null ? _ha : "http://localhost:8080";
|
|
3177
3183
|
vectorDbOptions.apiKey = readString(env, "WEAVIATE_API_KEY");
|
|
3178
3184
|
} else if (vectorProvider === "redis") {
|
|
3179
|
-
vectorDbOptions.baseUrl = (
|
|
3185
|
+
vectorDbOptions.baseUrl = (_ia = readString(env, "REDIS_URL")) != null ? _ia : "";
|
|
3180
3186
|
vectorDbOptions.apiKey = readString(env, "REDIS_API_KEY");
|
|
3181
3187
|
} else if (vectorProvider === "rest") {
|
|
3182
|
-
vectorDbOptions.baseUrl = (
|
|
3188
|
+
vectorDbOptions.baseUrl = (_ja = readString(env, "VECTOR_DB_REST_URL")) != null ? _ja : "";
|
|
3183
3189
|
vectorDbOptions.headers = readString(env, "VECTOR_DB_REST_API_KEY") ? { "api-key": readString(env, "VECTOR_DB_REST_API_KEY") } : {};
|
|
3184
3190
|
} else if (vectorProvider === "universal_rest") {
|
|
3185
|
-
vectorDbOptions.baseUrl = (
|
|
3191
|
+
vectorDbOptions.baseUrl = (_la = (_ka = readString(env, "VECTOR_BASE_URL")) != null ? _ka : readString(env, "VECTOR_DB_REST_URL")) != null ? _la : "";
|
|
3186
3192
|
vectorDbOptions.profile = readString(env, "VECTOR_UNIVERSAL_PROFILE");
|
|
3187
3193
|
vectorDbOptions.headers = readString(env, "VECTOR_DB_REST_API_KEY") ? { Authorization: `Bearer ${readString(env, "VECTOR_DB_REST_API_KEY")}` } : {};
|
|
3188
3194
|
}
|
|
@@ -3201,8 +3207,8 @@ function getEnvConfig(env = process.env, base) {
|
|
|
3201
3207
|
// Anthropic needs a separate embedding provider; key kept for completeness
|
|
3202
3208
|
gemini: readString(env, "GEMINI_API_KEY"),
|
|
3203
3209
|
ollama: void 0,
|
|
3204
|
-
universal_rest: (
|
|
3205
|
-
custom: (
|
|
3210
|
+
universal_rest: (_ma = readString(env, "EMBEDDING_API_KEY")) != null ? _ma : readString(env, "OPENAI_API_KEY"),
|
|
3211
|
+
custom: (_na = readString(env, "EMBEDDING_API_KEY")) != null ? _na : readString(env, "OPENAI_API_KEY")
|
|
3206
3212
|
};
|
|
3207
3213
|
const DEFAULT_MODEL_BY_PROVIDER = {
|
|
3208
3214
|
openai: "gpt-4o",
|
|
@@ -3223,25 +3229,25 @@ function getEnvConfig(env = process.env, base) {
|
|
|
3223
3229
|
return true;
|
|
3224
3230
|
}
|
|
3225
3231
|
})();
|
|
3226
|
-
const defaultGatewayUrl = (
|
|
3232
|
+
const defaultGatewayUrl = (_pa = (_oa = readString(env, "LITELLM_BASE_URL")) != null ? _oa : readString(env, "LLM_BASE_URL")) != null ? _pa : "https://llm.retrivora.com/api/v1";
|
|
3227
3233
|
const defaultLlmProvider = isFreeTier ? "universal_rest" : "universal_rest";
|
|
3228
|
-
const llmProvider = (
|
|
3229
|
-
const llmBaseUrl = (
|
|
3230
|
-
const llmModel = (
|
|
3231
|
-
const llmApiKey = (
|
|
3232
|
-
const llmProfile = (
|
|
3234
|
+
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;
|
|
3235
|
+
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;
|
|
3236
|
+
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";
|
|
3237
|
+
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;
|
|
3238
|
+
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";
|
|
3233
3239
|
const defaultEmbeddingProvider = isFreeTier ? "universal_rest" : "universal_rest";
|
|
3234
|
-
const embeddingProvider = (
|
|
3235
|
-
const embeddingBaseUrl = (
|
|
3236
|
-
const embeddingModel = (
|
|
3237
|
-
const embeddingApiKey = (_$a = (
|
|
3238
|
-
const embeddingProfile = (
|
|
3240
|
+
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;
|
|
3241
|
+
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;
|
|
3242
|
+
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";
|
|
3243
|
+
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;
|
|
3244
|
+
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";
|
|
3239
3245
|
return __spreadProps(__spreadValues({
|
|
3240
3246
|
projectId,
|
|
3241
3247
|
licenseKey,
|
|
3242
3248
|
vectorDb: {
|
|
3243
3249
|
provider: vectorProvider,
|
|
3244
|
-
indexName: (
|
|
3250
|
+
indexName: (_gb = (_fb = readString(env, "VECTOR_DB_INDEX")) != null ? _fb : vectorDbOptions.indexName) != null ? _gb : "rag-index",
|
|
3245
3251
|
options: vectorDbOptions
|
|
3246
3252
|
},
|
|
3247
3253
|
llm: {
|
|
@@ -3271,30 +3277,30 @@ function getEnvConfig(env = process.env, base) {
|
|
|
3271
3277
|
}
|
|
3272
3278
|
},
|
|
3273
3279
|
ui: {
|
|
3274
|
-
title: (
|
|
3275
|
-
subtitle: (
|
|
3276
|
-
primaryColor: (
|
|
3277
|
-
accentColor: (
|
|
3278
|
-
logoUrl: (
|
|
3279
|
-
placeholder: (
|
|
3280
|
-
showSources: ((
|
|
3281
|
-
welcomeMessage: (
|
|
3282
|
-
visualStyle: (
|
|
3283
|
-
borderRadius: (
|
|
3284
|
-
allowUpload: ((
|
|
3280
|
+
title: (_ib = (_hb = readString(env, "NEXT_PUBLIC_UI_TITLE")) != null ? _hb : readString(env, "UI_TITLE")) != null ? _ib : "AI Assistant",
|
|
3281
|
+
subtitle: (_kb = (_jb = readString(env, "NEXT_PUBLIC_UI_SUBTITLE")) != null ? _jb : readString(env, "UI_SUBTITLE")) != null ? _kb : "Powered by RAG",
|
|
3282
|
+
primaryColor: (_mb = (_lb = readString(env, "NEXT_PUBLIC_PRIMARY_COLOR")) != null ? _lb : readString(env, "UI_PRIMARY_COLOR")) != null ? _mb : "#10b981",
|
|
3283
|
+
accentColor: (_ob = (_nb = readString(env, "NEXT_PUBLIC_ACCENT_COLOR")) != null ? _nb : readString(env, "UI_ACCENT_COLOR")) != null ? _ob : "#3b82f6",
|
|
3284
|
+
logoUrl: (_pb = readString(env, "NEXT_PUBLIC_LOGO_URL")) != null ? _pb : readString(env, "UI_LOGO_URL"),
|
|
3285
|
+
placeholder: (_rb = (_qb = readString(env, "NEXT_PUBLIC_PLACEHOLDER")) != null ? _qb : readString(env, "UI_PLACEHOLDER")) != null ? _rb : "Ask me anything\u2026",
|
|
3286
|
+
showSources: ((_tb = (_sb = readString(env, "NEXT_PUBLIC_SHOW_SOURCES")) != null ? _sb : readString(env, "UI_SHOW_SOURCES")) != null ? _tb : "true") !== "false",
|
|
3287
|
+
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.",
|
|
3288
|
+
visualStyle: (_xb = (_wb = readString(env, "NEXT_PUBLIC_UI_VISUAL_STYLE")) != null ? _wb : readString(env, "UI_VISUAL_STYLE")) != null ? _xb : "glass",
|
|
3289
|
+
borderRadius: (_zb = (_yb = readString(env, "NEXT_PUBLIC_UI_BORDER_RADIUS")) != null ? _yb : readString(env, "UI_BORDER_RADIUS")) != null ? _zb : "xl",
|
|
3290
|
+
allowUpload: ((_Bb = (_Ab = readString(env, "NEXT_PUBLIC_ALLOW_UPLOAD")) != null ? _Ab : readString(env, "UI_ALLOW_UPLOAD")) != null ? _Bb : "false") === "true"
|
|
3285
3291
|
},
|
|
3286
3292
|
rag: {
|
|
3287
3293
|
topK: readNumber(env, "RAG_TOP_K", 5),
|
|
3288
3294
|
scoreThreshold: readNumber(env, "RAG_SCORE_THRESHOLD", 0),
|
|
3289
3295
|
chunkSize: readNumber(env, "RAG_CHUNK_SIZE", 1e3),
|
|
3290
3296
|
chunkOverlap: readNumber(env, "RAG_CHUNK_OVERLAP", 200),
|
|
3291
|
-
filterableFields: (
|
|
3297
|
+
filterableFields: (_Cb = readString(env, "RAG_FILTERABLE_FIELDS")) == null ? void 0 : _Cb.split(",").map((f) => f.trim()),
|
|
3292
3298
|
// Query pipeline toggles — read from .env.local
|
|
3293
3299
|
useQueryTransformation: readString(env, "RAG_USE_QUERY_TRANSFORMATION") === "true",
|
|
3294
3300
|
useReranking: readString(env, "RAG_USE_RERANKING") === "true",
|
|
3295
3301
|
useGraphRetrieval: readString(env, "RAG_USE_GRAPH_RETRIEVAL") === "true",
|
|
3296
|
-
architecture: (
|
|
3297
|
-
chunkingStrategy: (
|
|
3302
|
+
architecture: (_Db = readString(env, "RAG_ARCHITECTURE")) != null ? _Db : "simple",
|
|
3303
|
+
chunkingStrategy: (_Eb = readString(env, "RAG_CHUNKING_STRATEGY")) != null ? _Eb : "recursive",
|
|
3298
3304
|
uiMapping: (() => {
|
|
3299
3305
|
const raw = readString(env, "RAG_UI_MAPPING");
|
|
3300
3306
|
if (!raw) return void 0;
|
|
@@ -3307,7 +3313,7 @@ function getEnvConfig(env = process.env, base) {
|
|
|
3307
3313
|
},
|
|
3308
3314
|
telemetry: {
|
|
3309
3315
|
enabled: telemetryEnabled,
|
|
3310
|
-
url: (
|
|
3316
|
+
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"
|
|
3311
3317
|
}
|
|
3312
3318
|
}, readString(env, "GRAPH_DB_PROVIDER") ? {
|
|
3313
3319
|
graphDb: {
|
|
@@ -5349,7 +5355,7 @@ var ConfigValidator = class {
|
|
|
5349
5355
|
// package.json
|
|
5350
5356
|
var package_default = {
|
|
5351
5357
|
name: "@retrivora-ai/rag-engine",
|
|
5352
|
-
version: "2.1.
|
|
5358
|
+
version: "2.1.9",
|
|
5353
5359
|
description: "Retrivora AI is a plug-and-play AI engine for RAG chat experiences \u2014 generic vector DB + LLM provider, embeddable or standalone.",
|
|
5354
5360
|
author: "Abhinav Alkuchi",
|
|
5355
5361
|
license: "UNLICENSED",
|
package/dist/server.mjs
CHANGED
|
@@ -792,20 +792,22 @@ var init_PineconeProvider = __esm({
|
|
|
792
792
|
PineconeProvider = class extends BaseVectorProvider {
|
|
793
793
|
constructor(config) {
|
|
794
794
|
super(config);
|
|
795
|
-
const opts = config.options;
|
|
796
|
-
|
|
797
|
-
this.apiKey = opts.apiKey;
|
|
795
|
+
const opts = config.options || {};
|
|
796
|
+
this.apiKey = opts.apiKey || process.env.PINECONE_API_KEY || "";
|
|
798
797
|
}
|
|
799
798
|
static getValidator() {
|
|
800
799
|
return {
|
|
801
800
|
validate(config) {
|
|
802
801
|
const errors = [];
|
|
803
802
|
const opts = config.options || {};
|
|
804
|
-
|
|
803
|
+
const hasLicenseKey = Boolean(
|
|
804
|
+
config.licenseKey || process.env.RETRIVORA_LICENSE_KEY || process.env.NEXT_PUBLIC_RETRIVORA_LICENSE_KEY
|
|
805
|
+
);
|
|
806
|
+
if (!opts.apiKey && !hasLicenseKey) {
|
|
805
807
|
errors.push({
|
|
806
808
|
field: "vectorDb.options.apiKey",
|
|
807
|
-
message: "Pinecone API key is required",
|
|
808
|
-
suggestion: "Set PINECONE_API_KEY environment variable",
|
|
809
|
+
message: "Pinecone API key is required when RETRIVORA_LICENSE_KEY is not set",
|
|
810
|
+
suggestion: "Set PINECONE_API_KEY environment variable or supply RETRIVORA_LICENSE_KEY for keyless vector storage",
|
|
809
811
|
severity: "error"
|
|
810
812
|
});
|
|
811
813
|
}
|
|
@@ -852,7 +854,12 @@ var init_PineconeProvider = __esm({
|
|
|
852
854
|
}
|
|
853
855
|
async initialize() {
|
|
854
856
|
var _a2, _b;
|
|
855
|
-
|
|
857
|
+
const key = this.apiKey || process.env.PINECONE_API_KEY || "";
|
|
858
|
+
if (!key) {
|
|
859
|
+
console.log("[PineconeProvider] Keyless Mode active \u2014 Vector operations managed via Retrivora Cloud Gateway.");
|
|
860
|
+
return;
|
|
861
|
+
}
|
|
862
|
+
this.client = new Pinecone({ apiKey: key });
|
|
856
863
|
const indexes = await this.client.listIndexes();
|
|
857
864
|
const names = (_b = (_a2 = indexes.indexes) == null ? void 0 : _a2.map((i) => i.name)) != null ? _b : [];
|
|
858
865
|
if (!names.includes(this.indexName)) {
|
|
@@ -3045,7 +3052,7 @@ function getRagConfig(baseConfig, env = process.env) {
|
|
|
3045
3052
|
return getEnvConfig(env, baseConfig);
|
|
3046
3053
|
}
|
|
3047
3054
|
function getEnvConfig(env = process.env, base) {
|
|
3048
|
-
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;
|
|
3055
|
+
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;
|
|
3049
3056
|
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__";
|
|
3050
3057
|
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;
|
|
3051
3058
|
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);
|
|
@@ -3053,39 +3060,38 @@ function getEnvConfig(env = process.env, base) {
|
|
|
3053
3060
|
const embeddingDimensions = readNumber(env, "EMBEDDING_DIMENSIONS", 768);
|
|
3054
3061
|
const vectorDbOptions = {};
|
|
3055
3062
|
if (vectorProvider === "pinecone") {
|
|
3056
|
-
|
|
3057
|
-
vectorDbOptions.
|
|
3058
|
-
vectorDbOptions.indexName = (_s = (_r = (_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) != null ? _r : process.env.PINECONE_INDEX) != null ? _s : "retrivora-free";
|
|
3063
|
+
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 : "";
|
|
3064
|
+
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";
|
|
3059
3065
|
} else if (vectorProvider === "pgvector" || vectorProvider === "postgresql") {
|
|
3060
|
-
vectorDbOptions.connectionString = (
|
|
3061
|
-
vectorDbOptions.tables = (
|
|
3062
|
-
vectorDbOptions.searchFields = (
|
|
3066
|
+
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 : "";
|
|
3067
|
+
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;
|
|
3068
|
+
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;
|
|
3063
3069
|
vectorDbOptions.dimensions = embeddingDimensions;
|
|
3064
3070
|
} else if (vectorProvider === "mongodb") {
|
|
3065
|
-
vectorDbOptions.uri = (
|
|
3066
|
-
vectorDbOptions.database = (
|
|
3067
|
-
vectorDbOptions.collection = (
|
|
3068
|
-
vectorDbOptions.indexName = (
|
|
3071
|
+
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 : "";
|
|
3072
|
+
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 : "";
|
|
3073
|
+
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 : "";
|
|
3074
|
+
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";
|
|
3069
3075
|
} else if (vectorProvider === "qdrant") {
|
|
3070
|
-
vectorDbOptions.baseUrl = (
|
|
3071
|
-
vectorDbOptions.apiKey = (
|
|
3076
|
+
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";
|
|
3077
|
+
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;
|
|
3072
3078
|
vectorDbOptions.dimensions = embeddingDimensions;
|
|
3073
3079
|
} else if (vectorProvider === "milvus") {
|
|
3074
|
-
vectorDbOptions.baseUrl = (
|
|
3080
|
+
vectorDbOptions.baseUrl = (_fa = readString(env, "MILVUS_URL")) != null ? _fa : "http://localhost:19530";
|
|
3075
3081
|
vectorDbOptions.apiKey = readString(env, "MILVUS_API_KEY");
|
|
3076
3082
|
} else if (vectorProvider === "chromadb") {
|
|
3077
|
-
vectorDbOptions.baseUrl = (
|
|
3083
|
+
vectorDbOptions.baseUrl = (_ga = readString(env, "CHROMADB_URL")) != null ? _ga : "http://localhost:8000";
|
|
3078
3084
|
} else if (vectorProvider === "weaviate") {
|
|
3079
|
-
vectorDbOptions.baseUrl = (
|
|
3085
|
+
vectorDbOptions.baseUrl = (_ha = readString(env, "WEAVIATE_URL")) != null ? _ha : "http://localhost:8080";
|
|
3080
3086
|
vectorDbOptions.apiKey = readString(env, "WEAVIATE_API_KEY");
|
|
3081
3087
|
} else if (vectorProvider === "redis") {
|
|
3082
|
-
vectorDbOptions.baseUrl = (
|
|
3088
|
+
vectorDbOptions.baseUrl = (_ia = readString(env, "REDIS_URL")) != null ? _ia : "";
|
|
3083
3089
|
vectorDbOptions.apiKey = readString(env, "REDIS_API_KEY");
|
|
3084
3090
|
} else if (vectorProvider === "rest") {
|
|
3085
|
-
vectorDbOptions.baseUrl = (
|
|
3091
|
+
vectorDbOptions.baseUrl = (_ja = readString(env, "VECTOR_DB_REST_URL")) != null ? _ja : "";
|
|
3086
3092
|
vectorDbOptions.headers = readString(env, "VECTOR_DB_REST_API_KEY") ? { "api-key": readString(env, "VECTOR_DB_REST_API_KEY") } : {};
|
|
3087
3093
|
} else if (vectorProvider === "universal_rest") {
|
|
3088
|
-
vectorDbOptions.baseUrl = (
|
|
3094
|
+
vectorDbOptions.baseUrl = (_la = (_ka = readString(env, "VECTOR_BASE_URL")) != null ? _ka : readString(env, "VECTOR_DB_REST_URL")) != null ? _la : "";
|
|
3089
3095
|
vectorDbOptions.profile = readString(env, "VECTOR_UNIVERSAL_PROFILE");
|
|
3090
3096
|
vectorDbOptions.headers = readString(env, "VECTOR_DB_REST_API_KEY") ? { Authorization: `Bearer ${readString(env, "VECTOR_DB_REST_API_KEY")}` } : {};
|
|
3091
3097
|
}
|
|
@@ -3104,8 +3110,8 @@ function getEnvConfig(env = process.env, base) {
|
|
|
3104
3110
|
// Anthropic needs a separate embedding provider; key kept for completeness
|
|
3105
3111
|
gemini: readString(env, "GEMINI_API_KEY"),
|
|
3106
3112
|
ollama: void 0,
|
|
3107
|
-
universal_rest: (
|
|
3108
|
-
custom: (
|
|
3113
|
+
universal_rest: (_ma = readString(env, "EMBEDDING_API_KEY")) != null ? _ma : readString(env, "OPENAI_API_KEY"),
|
|
3114
|
+
custom: (_na = readString(env, "EMBEDDING_API_KEY")) != null ? _na : readString(env, "OPENAI_API_KEY")
|
|
3109
3115
|
};
|
|
3110
3116
|
const DEFAULT_MODEL_BY_PROVIDER = {
|
|
3111
3117
|
openai: "gpt-4o",
|
|
@@ -3126,25 +3132,25 @@ function getEnvConfig(env = process.env, base) {
|
|
|
3126
3132
|
return true;
|
|
3127
3133
|
}
|
|
3128
3134
|
})();
|
|
3129
|
-
const defaultGatewayUrl = (
|
|
3135
|
+
const defaultGatewayUrl = (_pa = (_oa = readString(env, "LITELLM_BASE_URL")) != null ? _oa : readString(env, "LLM_BASE_URL")) != null ? _pa : "https://llm.retrivora.com/api/v1";
|
|
3130
3136
|
const defaultLlmProvider = isFreeTier ? "universal_rest" : "universal_rest";
|
|
3131
|
-
const llmProvider = (
|
|
3132
|
-
const llmBaseUrl = (
|
|
3133
|
-
const llmModel = (
|
|
3134
|
-
const llmApiKey = (
|
|
3135
|
-
const llmProfile = (
|
|
3137
|
+
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;
|
|
3138
|
+
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;
|
|
3139
|
+
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";
|
|
3140
|
+
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;
|
|
3141
|
+
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";
|
|
3136
3142
|
const defaultEmbeddingProvider = isFreeTier ? "universal_rest" : "universal_rest";
|
|
3137
|
-
const embeddingProvider = (
|
|
3138
|
-
const embeddingBaseUrl = (
|
|
3139
|
-
const embeddingModel = (
|
|
3140
|
-
const embeddingApiKey = (_$a = (
|
|
3141
|
-
const embeddingProfile = (
|
|
3143
|
+
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;
|
|
3144
|
+
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;
|
|
3145
|
+
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";
|
|
3146
|
+
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;
|
|
3147
|
+
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";
|
|
3142
3148
|
return __spreadProps(__spreadValues({
|
|
3143
3149
|
projectId,
|
|
3144
3150
|
licenseKey,
|
|
3145
3151
|
vectorDb: {
|
|
3146
3152
|
provider: vectorProvider,
|
|
3147
|
-
indexName: (
|
|
3153
|
+
indexName: (_gb = (_fb = readString(env, "VECTOR_DB_INDEX")) != null ? _fb : vectorDbOptions.indexName) != null ? _gb : "rag-index",
|
|
3148
3154
|
options: vectorDbOptions
|
|
3149
3155
|
},
|
|
3150
3156
|
llm: {
|
|
@@ -3174,30 +3180,30 @@ function getEnvConfig(env = process.env, base) {
|
|
|
3174
3180
|
}
|
|
3175
3181
|
},
|
|
3176
3182
|
ui: {
|
|
3177
|
-
title: (
|
|
3178
|
-
subtitle: (
|
|
3179
|
-
primaryColor: (
|
|
3180
|
-
accentColor: (
|
|
3181
|
-
logoUrl: (
|
|
3182
|
-
placeholder: (
|
|
3183
|
-
showSources: ((
|
|
3184
|
-
welcomeMessage: (
|
|
3185
|
-
visualStyle: (
|
|
3186
|
-
borderRadius: (
|
|
3187
|
-
allowUpload: ((
|
|
3183
|
+
title: (_ib = (_hb = readString(env, "NEXT_PUBLIC_UI_TITLE")) != null ? _hb : readString(env, "UI_TITLE")) != null ? _ib : "AI Assistant",
|
|
3184
|
+
subtitle: (_kb = (_jb = readString(env, "NEXT_PUBLIC_UI_SUBTITLE")) != null ? _jb : readString(env, "UI_SUBTITLE")) != null ? _kb : "Powered by RAG",
|
|
3185
|
+
primaryColor: (_mb = (_lb = readString(env, "NEXT_PUBLIC_PRIMARY_COLOR")) != null ? _lb : readString(env, "UI_PRIMARY_COLOR")) != null ? _mb : "#10b981",
|
|
3186
|
+
accentColor: (_ob = (_nb = readString(env, "NEXT_PUBLIC_ACCENT_COLOR")) != null ? _nb : readString(env, "UI_ACCENT_COLOR")) != null ? _ob : "#3b82f6",
|
|
3187
|
+
logoUrl: (_pb = readString(env, "NEXT_PUBLIC_LOGO_URL")) != null ? _pb : readString(env, "UI_LOGO_URL"),
|
|
3188
|
+
placeholder: (_rb = (_qb = readString(env, "NEXT_PUBLIC_PLACEHOLDER")) != null ? _qb : readString(env, "UI_PLACEHOLDER")) != null ? _rb : "Ask me anything\u2026",
|
|
3189
|
+
showSources: ((_tb = (_sb = readString(env, "NEXT_PUBLIC_SHOW_SOURCES")) != null ? _sb : readString(env, "UI_SHOW_SOURCES")) != null ? _tb : "true") !== "false",
|
|
3190
|
+
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.",
|
|
3191
|
+
visualStyle: (_xb = (_wb = readString(env, "NEXT_PUBLIC_UI_VISUAL_STYLE")) != null ? _wb : readString(env, "UI_VISUAL_STYLE")) != null ? _xb : "glass",
|
|
3192
|
+
borderRadius: (_zb = (_yb = readString(env, "NEXT_PUBLIC_UI_BORDER_RADIUS")) != null ? _yb : readString(env, "UI_BORDER_RADIUS")) != null ? _zb : "xl",
|
|
3193
|
+
allowUpload: ((_Bb = (_Ab = readString(env, "NEXT_PUBLIC_ALLOW_UPLOAD")) != null ? _Ab : readString(env, "UI_ALLOW_UPLOAD")) != null ? _Bb : "false") === "true"
|
|
3188
3194
|
},
|
|
3189
3195
|
rag: {
|
|
3190
3196
|
topK: readNumber(env, "RAG_TOP_K", 5),
|
|
3191
3197
|
scoreThreshold: readNumber(env, "RAG_SCORE_THRESHOLD", 0),
|
|
3192
3198
|
chunkSize: readNumber(env, "RAG_CHUNK_SIZE", 1e3),
|
|
3193
3199
|
chunkOverlap: readNumber(env, "RAG_CHUNK_OVERLAP", 200),
|
|
3194
|
-
filterableFields: (
|
|
3200
|
+
filterableFields: (_Cb = readString(env, "RAG_FILTERABLE_FIELDS")) == null ? void 0 : _Cb.split(",").map((f) => f.trim()),
|
|
3195
3201
|
// Query pipeline toggles — read from .env.local
|
|
3196
3202
|
useQueryTransformation: readString(env, "RAG_USE_QUERY_TRANSFORMATION") === "true",
|
|
3197
3203
|
useReranking: readString(env, "RAG_USE_RERANKING") === "true",
|
|
3198
3204
|
useGraphRetrieval: readString(env, "RAG_USE_GRAPH_RETRIEVAL") === "true",
|
|
3199
|
-
architecture: (
|
|
3200
|
-
chunkingStrategy: (
|
|
3205
|
+
architecture: (_Db = readString(env, "RAG_ARCHITECTURE")) != null ? _Db : "simple",
|
|
3206
|
+
chunkingStrategy: (_Eb = readString(env, "RAG_CHUNKING_STRATEGY")) != null ? _Eb : "recursive",
|
|
3201
3207
|
uiMapping: (() => {
|
|
3202
3208
|
const raw = readString(env, "RAG_UI_MAPPING");
|
|
3203
3209
|
if (!raw) return void 0;
|
|
@@ -3210,7 +3216,7 @@ function getEnvConfig(env = process.env, base) {
|
|
|
3210
3216
|
},
|
|
3211
3217
|
telemetry: {
|
|
3212
3218
|
enabled: telemetryEnabled,
|
|
3213
|
-
url: (
|
|
3219
|
+
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"
|
|
3214
3220
|
}
|
|
3215
3221
|
}, readString(env, "GRAPH_DB_PROVIDER") ? {
|
|
3216
3222
|
graphDb: {
|
|
@@ -5252,7 +5258,7 @@ var ConfigValidator = class {
|
|
|
5252
5258
|
// package.json
|
|
5253
5259
|
var package_default = {
|
|
5254
5260
|
name: "@retrivora-ai/rag-engine",
|
|
5255
|
-
version: "2.1.
|
|
5261
|
+
version: "2.1.9",
|
|
5256
5262
|
description: "Retrivora AI is a plug-and-play AI engine for RAG chat experiences \u2014 generic vector DB + LLM provider, embeddable or standalone.",
|
|
5257
5263
|
author: "Abhinav Alkuchi",
|
|
5258
5264
|
license: "UNLICENSED",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@retrivora-ai/rag-engine",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.9",
|
|
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",
|
|
@@ -85,8 +85,7 @@ export function getEnvConfig(env: Record<string, string | undefined> = process.e
|
|
|
85
85
|
const vectorDbOptions: Record<string, unknown> = {};
|
|
86
86
|
|
|
87
87
|
if (vectorProvider === 'pinecone') {
|
|
88
|
-
|
|
89
|
-
vectorDbOptions.apiKey = rawApiKey || (licenseKey ? 'retrivora-keyless-gateway' : 'keyless-free-tier');
|
|
88
|
+
vectorDbOptions.apiKey = readString(env, 'PINECONE_API_KEY') ?? (base?.vectorDb?.options?.apiKey as string) ?? process.env.PINECONE_API_KEY ?? '';
|
|
90
89
|
vectorDbOptions.indexName = readString(env, 'PINECONE_INDEX') ?? (base?.vectorDb?.indexName as string) ?? (base?.vectorDb?.options?.indexName as string) ?? process.env.PINECONE_INDEX ?? 'retrivora-free';
|
|
91
90
|
} else if (vectorProvider === 'pgvector' || vectorProvider === 'postgresql') {
|
|
92
91
|
vectorDbOptions.connectionString = readString(env, 'PGVECTOR_CONNECTION_STRING') ?? readString(env, 'POSTGRES_URL') ?? (base?.vectorDb?.options?.connectionString as string) ?? '';
|
|
@@ -14,9 +14,8 @@ export class PineconeProvider extends BaseVectorProvider {
|
|
|
14
14
|
|
|
15
15
|
constructor(config: VectorDBConfig) {
|
|
16
16
|
super(config);
|
|
17
|
-
const opts = config.options as Record<string, string>;
|
|
18
|
-
|
|
19
|
-
this.apiKey = opts.apiKey;
|
|
17
|
+
const opts = (config.options || {}) as Record<string, string>;
|
|
18
|
+
this.apiKey = opts.apiKey || process.env.PINECONE_API_KEY || '';
|
|
20
19
|
}
|
|
21
20
|
|
|
22
21
|
static getValidator(): IProviderValidator {
|
|
@@ -24,12 +23,17 @@ export class PineconeProvider extends BaseVectorProvider {
|
|
|
24
23
|
validate(config: Record<string, unknown>): ValidationError[] {
|
|
25
24
|
const errors: ValidationError[] = [];
|
|
26
25
|
const opts = (config.options || {}) as Record<string, unknown>;
|
|
26
|
+
const hasLicenseKey = Boolean(
|
|
27
|
+
config.licenseKey ||
|
|
28
|
+
process.env.RETRIVORA_LICENSE_KEY ||
|
|
29
|
+
process.env.NEXT_PUBLIC_RETRIVORA_LICENSE_KEY
|
|
30
|
+
);
|
|
27
31
|
|
|
28
|
-
if (!opts.apiKey) {
|
|
32
|
+
if (!opts.apiKey && !hasLicenseKey) {
|
|
29
33
|
errors.push({
|
|
30
34
|
field: 'vectorDb.options.apiKey',
|
|
31
|
-
message: 'Pinecone API key is required',
|
|
32
|
-
suggestion: 'Set PINECONE_API_KEY environment variable',
|
|
35
|
+
message: 'Pinecone API key is required when RETRIVORA_LICENSE_KEY is not set',
|
|
36
|
+
suggestion: 'Set PINECONE_API_KEY environment variable or supply RETRIVORA_LICENSE_KEY for keyless vector storage',
|
|
33
37
|
severity: 'error',
|
|
34
38
|
});
|
|
35
39
|
}
|
|
@@ -78,7 +82,12 @@ export class PineconeProvider extends BaseVectorProvider {
|
|
|
78
82
|
}
|
|
79
83
|
|
|
80
84
|
async initialize(): Promise<void> {
|
|
81
|
-
|
|
85
|
+
const key = this.apiKey || process.env.PINECONE_API_KEY || '';
|
|
86
|
+
if (!key) {
|
|
87
|
+
console.log('[PineconeProvider] Keyless Mode active — Vector operations managed via Retrivora Cloud Gateway.');
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
this.client = new Pinecone({ apiKey: key });
|
|
82
91
|
const indexes = await this.client.listIndexes();
|
|
83
92
|
const names = indexes.indexes?.map((i) => i.name) ?? [];
|
|
84
93
|
if (!names.includes(this.indexName)) {
|