@retrivora-ai/rag-engine 0.4.2 → 0.4.3
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.
|
@@ -963,13 +963,13 @@ ${context}`;
|
|
|
963
963
|
return data.message.content;
|
|
964
964
|
}
|
|
965
965
|
async embed(text, options) {
|
|
966
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
966
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
967
967
|
const model = (_c = (_b = options == null ? void 0 : options.model) != null ? _b : (_a = this.embeddingConfig) == null ? void 0 : _a.model) != null ? _c : "nomic-embed-text";
|
|
968
968
|
const baseURL = (_f = (_e = (_d = this.embeddingConfig) == null ? void 0 : _d.baseUrl) != null ? _e : this.llmConfig.baseUrl) != null ? _f : "http://localhost:11434";
|
|
969
969
|
const client = baseURL !== ((_g = this.llmConfig.baseUrl) != null ? _g : "http://localhost:11434") ? axios.create({ baseURL, timeout: 6e4 }) : this.http;
|
|
970
970
|
let prompt = text;
|
|
971
|
-
const queryPrefix = (_h = this.embeddingConfig) == null ? void 0 : _h.queryPrefix;
|
|
972
|
-
const docPrefix = (
|
|
971
|
+
const queryPrefix = (_i = (_h = this.embeddingConfig) == null ? void 0 : _h.queryPrefix) != null ? _i : model.includes("nomic") ? "search_query: " : "";
|
|
972
|
+
const docPrefix = (_k = (_j = this.embeddingConfig) == null ? void 0 : _j.documentPrefix) != null ? _k : model.includes("nomic") ? "search_document: " : "";
|
|
973
973
|
if ((options == null ? void 0 : options.taskType) === "query" && queryPrefix) {
|
|
974
974
|
if (!prompt.startsWith(queryPrefix)) {
|
|
975
975
|
prompt = `${queryPrefix}${text}`;
|
package/dist/handlers/index.js
CHANGED
|
@@ -2159,13 +2159,13 @@ ${context}`;
|
|
|
2159
2159
|
return data.message.content;
|
|
2160
2160
|
}
|
|
2161
2161
|
async embed(text, options) {
|
|
2162
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
2162
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
2163
2163
|
const model = (_c = (_b = options == null ? void 0 : options.model) != null ? _b : (_a = this.embeddingConfig) == null ? void 0 : _a.model) != null ? _c : "nomic-embed-text";
|
|
2164
2164
|
const baseURL = (_f = (_e = (_d = this.embeddingConfig) == null ? void 0 : _d.baseUrl) != null ? _e : this.llmConfig.baseUrl) != null ? _f : "http://localhost:11434";
|
|
2165
2165
|
const client = baseURL !== ((_g = this.llmConfig.baseUrl) != null ? _g : "http://localhost:11434") ? import_axios.default.create({ baseURL, timeout: 6e4 }) : this.http;
|
|
2166
2166
|
let prompt = text;
|
|
2167
|
-
const queryPrefix = (_h = this.embeddingConfig) == null ? void 0 : _h.queryPrefix;
|
|
2168
|
-
const docPrefix = (
|
|
2167
|
+
const queryPrefix = (_i = (_h = this.embeddingConfig) == null ? void 0 : _h.queryPrefix) != null ? _i : model.includes("nomic") ? "search_query: " : "";
|
|
2168
|
+
const docPrefix = (_k = (_j = this.embeddingConfig) == null ? void 0 : _j.documentPrefix) != null ? _k : model.includes("nomic") ? "search_document: " : "";
|
|
2169
2169
|
if ((options == null ? void 0 : options.taskType) === "query" && queryPrefix) {
|
|
2170
2170
|
if (!prompt.startsWith(queryPrefix)) {
|
|
2171
2171
|
prompt = `${queryPrefix}${text}`;
|
package/dist/handlers/index.mjs
CHANGED
package/dist/server.js
CHANGED
|
@@ -2203,13 +2203,13 @@ ${context}`;
|
|
|
2203
2203
|
return data.message.content;
|
|
2204
2204
|
}
|
|
2205
2205
|
async embed(text, options) {
|
|
2206
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
2206
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
2207
2207
|
const model = (_c = (_b = options == null ? void 0 : options.model) != null ? _b : (_a = this.embeddingConfig) == null ? void 0 : _a.model) != null ? _c : "nomic-embed-text";
|
|
2208
2208
|
const baseURL = (_f = (_e = (_d = this.embeddingConfig) == null ? void 0 : _d.baseUrl) != null ? _e : this.llmConfig.baseUrl) != null ? _f : "http://localhost:11434";
|
|
2209
2209
|
const client = baseURL !== ((_g = this.llmConfig.baseUrl) != null ? _g : "http://localhost:11434") ? import_axios.default.create({ baseURL, timeout: 6e4 }) : this.http;
|
|
2210
2210
|
let prompt = text;
|
|
2211
|
-
const queryPrefix = (_h = this.embeddingConfig) == null ? void 0 : _h.queryPrefix;
|
|
2212
|
-
const docPrefix = (
|
|
2211
|
+
const queryPrefix = (_i = (_h = this.embeddingConfig) == null ? void 0 : _h.queryPrefix) != null ? _i : model.includes("nomic") ? "search_query: " : "";
|
|
2212
|
+
const docPrefix = (_k = (_j = this.embeddingConfig) == null ? void 0 : _j.documentPrefix) != null ? _k : model.includes("nomic") ? "search_document: " : "";
|
|
2213
2213
|
if ((options == null ? void 0 : options.taskType) === "query" && queryPrefix) {
|
|
2214
2214
|
if (!prompt.startsWith(queryPrefix)) {
|
|
2215
2215
|
prompt = `${queryPrefix}${text}`;
|
package/dist/server.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@retrivora-ai/rag-engine",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.3",
|
|
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": "MIT",
|
|
@@ -76,8 +76,9 @@ export class OllamaProvider implements ILLMProvider {
|
|
|
76
76
|
let prompt = text;
|
|
77
77
|
|
|
78
78
|
// Dynamically apply prefixes from configuration if they exist
|
|
79
|
-
|
|
80
|
-
const
|
|
79
|
+
// Fallback to standard nomic-embed-text prefixes if not provided
|
|
80
|
+
const queryPrefix = this.embeddingConfig?.queryPrefix ?? (model.includes('nomic') ? 'search_query: ' : '');
|
|
81
|
+
const docPrefix = this.embeddingConfig?.documentPrefix ?? (model.includes('nomic') ? 'search_document: ' : '');
|
|
81
82
|
|
|
82
83
|
if (options?.taskType === 'query' && queryPrefix) {
|
|
83
84
|
if (!prompt.startsWith(queryPrefix)) {
|