mirror of
https://github.com/hwchase17/langchain.git
synced 2025-06-22 14:49:29 +00:00
community[patch]: apply embedding functions during query if defined (#16646)
**Description:** This update ensures that the user-defined embedding function specified during vector store creation is applied during queries. Previously, even if a custom embedding function was defined at the time of store creation, Bagel DB would default to using the standard embedding function during query execution. This pull request addresses this issue by consistently using the user-defined embedding function for queries if one has been specified earlier.
This commit is contained in:
parent
f01fb47597
commit
481493dbce
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user