Skip to content

Commit 33ce955

Browse files
committed
add missing _getEmbedding)
1 parent bc3baae commit 33ce955

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/core/MongoRAG.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,21 @@ class MongoRAG {
188188
}
189189
}
190190

191+
/**
192+
* Retrieves an embedding for a given text.
193+
* @param {string} text - The text to embed.
194+
* @returns {Promise<Array<number>>} The embedded text.
195+
*/
196+
197+
async _getEmbedding(text) {
198+
if (!this.embeddingProvider) {
199+
await this._initializeEmbeddingProvider();
200+
}
201+
const [embedding] = await this.embeddingProvider.getEmbeddings([text]);
202+
return embedding;
203+
}
204+
205+
191206
/**
192207
* Closes the MongoDB connection.
193208
* @returns {Promise<void>}

0 commit comments

Comments
 (0)