mirror of
https://github.com/hwchase17/langchain
synced 2024-11-04 06:00:26 +00:00
supabase embedding usage fix (#10335)
Should be calling Embeddings.embed_query instead of embed_documents when searching
This commit is contained in:
parent
f0ccce76fe
commit
25ec655e4f
@ -168,10 +168,8 @@ class SupabaseVectorStore(VectorStore):
|
|||||||
filter: Optional[Dict[str, Any]] = None,
|
filter: Optional[Dict[str, Any]] = None,
|
||||||
**kwargs: Any,
|
**kwargs: Any,
|
||||||
) -> List[Document]:
|
) -> List[Document]:
|
||||||
vectors = self._embedding.embed_documents([query])
|
vector = self._embedding.embed_query(query)
|
||||||
return self.similarity_search_by_vector(
|
return self.similarity_search_by_vector(vector, k=k, filter=filter, **kwargs)
|
||||||
vectors[0], k=k, filter=filter, **kwargs
|
|
||||||
)
|
|
||||||
|
|
||||||
def similarity_search_by_vector(
|
def similarity_search_by_vector(
|
||||||
self,
|
self,
|
||||||
@ -195,9 +193,9 @@ class SupabaseVectorStore(VectorStore):
|
|||||||
filter: Optional[Dict[str, Any]] = None,
|
filter: Optional[Dict[str, Any]] = None,
|
||||||
**kwargs: Any,
|
**kwargs: Any,
|
||||||
) -> List[Tuple[Document, float]]:
|
) -> List[Tuple[Document, float]]:
|
||||||
vectors = self._embedding.embed_documents([query])
|
vector = self._embedding.embed_query(query)
|
||||||
return self.similarity_search_by_vector_with_relevance_scores(
|
return self.similarity_search_by_vector_with_relevance_scores(
|
||||||
vectors[0], k=k, filter=filter
|
vector, k=k, filter=filter
|
||||||
)
|
)
|
||||||
|
|
||||||
def match_args(
|
def match_args(
|
||||||
@ -407,9 +405,9 @@ class SupabaseVectorStore(VectorStore):
|
|||||||
$$;
|
$$;
|
||||||
```
|
```
|
||||||
"""
|
"""
|
||||||
embedding = self._embedding.embed_documents([query])
|
embedding = self._embedding.embed_query(query)
|
||||||
docs = self.max_marginal_relevance_search_by_vector(
|
docs = self.max_marginal_relevance_search_by_vector(
|
||||||
embedding[0], k, fetch_k, lambda_mult=lambda_mult
|
embedding, k, fetch_k, lambda_mult=lambda_mult
|
||||||
)
|
)
|
||||||
return docs
|
return docs
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user