Skip to content

The agent engineering platform.

community[patch]: apply embedding functions during query if defined (#16646)

Rashedul Hasan Rijul481493dbce6e
diff --git a/libs/community/langchain_community/vectorstores/bageldb.py b/libs/community/langchain_community/vectorstores/bageldb.py
index fee0cdf1f9..a7b9ddc47d 100644
--- a/libs/community/langchain_community/vectorstores/bageldb.py
+++ b/libs/community/langchain_community/vectorstores/bageldb.py
@@ -109,6 +109,12 @@ class Bagel(VectorStore):
import bagel # noqa: F401
except ImportError:
raise ImportError("Please install bagel `pip install betabageldb`.")
+
+ if self._embedding_function and query_embeddings is None and query_texts:
+ texts = list(query_texts)
+ query_embeddings = self._embedding_function.embed_documents(texts)
+ query_texts = None
+
return self._cluster.find(
query_texts=query_texts,
query_embeddings=query_embeddings,