@retrivora-ai/rag-engine 0.1.2 → 0.1.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.
|
@@ -1022,9 +1022,12 @@ var RAGPipeline = class {
|
|
|
1022
1022
|
const ns = namespace != null ? namespace : this.config.projectId;
|
|
1023
1023
|
const topK = (_b = (_a = this.config.rag) == null ? void 0 : _a.topK) != null ? _b : 5;
|
|
1024
1024
|
const scoreThreshold = (_d = (_c = this.config.rag) == null ? void 0 : _c.scoreThreshold) != null ? _d : 0;
|
|
1025
|
+
console.log(`[RAGPipeline] Searching Pinecone (Namespace: "${ns}", TopK: ${topK})...`);
|
|
1025
1026
|
const queryVector = await this.embeddingProvider.embed(question);
|
|
1026
1027
|
const rawMatches = await this.vectorDB.query(queryVector, topK, ns);
|
|
1028
|
+
console.log(`[RAGPipeline] Found ${rawMatches.length} raw matches in Pinecone.`);
|
|
1027
1029
|
const sources = rawMatches.filter((m) => m.score >= scoreThreshold);
|
|
1030
|
+
console.log(`[RAGPipeline] ${sources.length} sources remaining after threshold filter (min: ${scoreThreshold}).`);
|
|
1028
1031
|
const context = sources.length ? sources.map((m, i) => `[Source ${i + 1}]
|
|
1029
1032
|
${m.content}`).join("\n\n---\n\n") : "No relevant context found.";
|
|
1030
1033
|
const messages = [
|
package/dist/handlers/index.js
CHANGED
|
@@ -1097,9 +1097,12 @@ var RAGPipeline = class {
|
|
|
1097
1097
|
const ns = namespace != null ? namespace : this.config.projectId;
|
|
1098
1098
|
const topK = (_b = (_a = this.config.rag) == null ? void 0 : _a.topK) != null ? _b : 5;
|
|
1099
1099
|
const scoreThreshold = (_d = (_c = this.config.rag) == null ? void 0 : _c.scoreThreshold) != null ? _d : 0;
|
|
1100
|
+
console.log(`[RAGPipeline] Searching Pinecone (Namespace: "${ns}", TopK: ${topK})...`);
|
|
1100
1101
|
const queryVector = await this.embeddingProvider.embed(question);
|
|
1101
1102
|
const rawMatches = await this.vectorDB.query(queryVector, topK, ns);
|
|
1103
|
+
console.log(`[RAGPipeline] Found ${rawMatches.length} raw matches in Pinecone.`);
|
|
1102
1104
|
const sources = rawMatches.filter((m) => m.score >= scoreThreshold);
|
|
1105
|
+
console.log(`[RAGPipeline] ${sources.length} sources remaining after threshold filter (min: ${scoreThreshold}).`);
|
|
1103
1106
|
const context = sources.length ? sources.map((m, i) => `[Source ${i + 1}]
|
|
1104
1107
|
${m.content}`).join("\n\n---\n\n") : "No relevant context found.";
|
|
1105
1108
|
const messages = [
|
package/dist/handlers/index.mjs
CHANGED
package/dist/server.js
CHANGED
|
@@ -1107,9 +1107,12 @@ var RAGPipeline = class {
|
|
|
1107
1107
|
const ns = namespace != null ? namespace : this.config.projectId;
|
|
1108
1108
|
const topK = (_b = (_a = this.config.rag) == null ? void 0 : _a.topK) != null ? _b : 5;
|
|
1109
1109
|
const scoreThreshold = (_d = (_c = this.config.rag) == null ? void 0 : _c.scoreThreshold) != null ? _d : 0;
|
|
1110
|
+
console.log(`[RAGPipeline] Searching Pinecone (Namespace: "${ns}", TopK: ${topK})...`);
|
|
1110
1111
|
const queryVector = await this.embeddingProvider.embed(question);
|
|
1111
1112
|
const rawMatches = await this.vectorDB.query(queryVector, topK, ns);
|
|
1113
|
+
console.log(`[RAGPipeline] Found ${rawMatches.length} raw matches in Pinecone.`);
|
|
1112
1114
|
const sources = rawMatches.filter((m) => m.score >= scoreThreshold);
|
|
1115
|
+
console.log(`[RAGPipeline] ${sources.length} sources remaining after threshold filter (min: ${scoreThreshold}).`);
|
|
1113
1116
|
const context = sources.length ? sources.map((m, i) => `[Source ${i + 1}]
|
|
1114
1117
|
${m.content}`).join("\n\n---\n\n") : "No relevant context found.";
|
|
1115
1118
|
const messages = [
|
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.1.
|
|
3
|
+
"version": "0.1.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",
|
package/src/rag/RAGPipeline.ts
CHANGED
|
@@ -140,14 +140,18 @@ export class RAGPipeline {
|
|
|
140
140
|
const topK = this.config.rag?.topK ?? 5;
|
|
141
141
|
const scoreThreshold = this.config.rag?.scoreThreshold ?? 0.0;
|
|
142
142
|
|
|
143
|
+
console.log(`[RAGPipeline] Searching Pinecone (Namespace: "${ns}", TopK: ${topK})...`);
|
|
144
|
+
|
|
143
145
|
// 1. Embed the question
|
|
144
146
|
const queryVector = await this.embeddingProvider.embed(question);
|
|
145
147
|
|
|
146
148
|
// 2. Retrieve relevant chunks
|
|
147
149
|
const rawMatches = await this.vectorDB.query(queryVector, topK, ns);
|
|
150
|
+
console.log(`[RAGPipeline] Found ${rawMatches.length} raw matches in Pinecone.`);
|
|
148
151
|
|
|
149
152
|
// 3. Apply score threshold filter
|
|
150
153
|
const sources = rawMatches.filter((m) => m.score >= scoreThreshold);
|
|
154
|
+
console.log(`[RAGPipeline] ${sources.length} sources remaining after threshold filter (min: ${scoreThreshold}).`);
|
|
151
155
|
|
|
152
156
|
// 4. Build context
|
|
153
157
|
const context = sources.length
|