@@ -939,7 +939,7 @@ def similarity_search(
939
939
List of Documents most similar to the query.
940
940
"""
941
941
assert not self ._async_engine , "This method must be called without async_mode"
942
- embedding = self .embedding_function .embed_query (text = query )
942
+ embedding = self .embeddings .embed_query (query )
943
943
return self .similarity_search_by_vector (
944
944
embedding = embedding ,
945
945
k = k ,
@@ -964,7 +964,7 @@ async def asimilarity_search(
964
964
List of Documents most similar to the query.
965
965
"""
966
966
await self .__apost_init__ () # Lazy async init
967
- embedding = self .embedding_function . embed_query ( text = query )
967
+ embedding = await self .embeddings . aembed_query ( query )
968
968
return await self .asimilarity_search_by_vector (
969
969
embedding = embedding ,
970
970
k = k ,
@@ -988,7 +988,7 @@ def similarity_search_with_score(
988
988
List of Documents most similar to the query and score for each.
989
989
"""
990
990
assert not self ._async_engine , "This method must be called without async_mode"
991
- embedding = self .embedding_function .embed_query (query )
991
+ embedding = self .embeddings .embed_query (query )
992
992
docs = self .similarity_search_with_score_by_vector (
993
993
embedding = embedding , k = k , filter = filter
994
994
)
@@ -1011,7 +1011,7 @@ async def asimilarity_search_with_score(
1011
1011
List of Documents most similar to the query and score for each.
1012
1012
"""
1013
1013
await self .__apost_init__ () # Lazy async init
1014
- embedding = self .embedding_function . embed_query (query )
1014
+ embedding = await self .embeddings . aembed_query (query )
1015
1015
docs = await self .asimilarity_search_with_score_by_vector (
1016
1016
embedding = embedding , k = k , filter = filter
1017
1017
)
@@ -1065,7 +1065,7 @@ def _results_to_docs_and_scores(self, results: Any) -> List[Tuple[Document, floa
1065
1065
page_content = result .EmbeddingStore .document ,
1066
1066
metadata = result .EmbeddingStore .cmetadata ,
1067
1067
),
1068
- result .distance if self .embedding_function is not None else None ,
1068
+ result .distance if self .embeddings is not None else None ,
1069
1069
)
1070
1070
for result in results
1071
1071
]
@@ -1569,7 +1569,7 @@ async def afrom_texts(
1569
1569
** kwargs : Any ,
1570
1570
) -> PGVector :
1571
1571
"""Return VectorStore initialized from documents and embeddings."""
1572
- embeddings = embedding .embed_documents (list (texts ))
1572
+ embeddings = await embedding .aembed_documents (list (texts ))
1573
1573
return await cls .__afrom (
1574
1574
texts ,
1575
1575
embeddings ,
@@ -1992,7 +1992,7 @@ def max_marginal_relevance_search(
1992
1992
Returns:
1993
1993
List[Document]: List of Documents selected by maximal marginal relevance.
1994
1994
"""
1995
- embedding = self .embedding_function .embed_query (query )
1995
+ embedding = self .embeddings .embed_query (query )
1996
1996
return self .max_marginal_relevance_search_by_vector (
1997
1997
embedding ,
1998
1998
k = k ,
@@ -2031,7 +2031,7 @@ async def amax_marginal_relevance_search(
2031
2031
List[Document]: List of Documents selected by maximal marginal relevance.
2032
2032
"""
2033
2033
await self .__apost_init__ () # Lazy async init
2034
- embedding = self .embedding_function . embed_query (query )
2034
+ embedding = await self .embeddings . aembed_query (query )
2035
2035
return await self .amax_marginal_relevance_search_by_vector (
2036
2036
embedding ,
2037
2037
k = k ,
@@ -2070,7 +2070,7 @@ def max_marginal_relevance_search_with_score(
2070
2070
List[Tuple[Document, float]]: List of Documents selected by maximal marginal
2071
2071
relevance to the query and score for each.
2072
2072
"""
2073
- embedding = self .embedding_function .embed_query (query )
2073
+ embedding = self .embeddings .embed_query (query )
2074
2074
docs = self .max_marginal_relevance_search_with_score_by_vector (
2075
2075
embedding = embedding ,
2076
2076
k = k ,
@@ -2111,7 +2111,7 @@ async def amax_marginal_relevance_search_with_score(
2111
2111
relevance to the query and score for each.
2112
2112
"""
2113
2113
await self .__apost_init__ () # Lazy async init
2114
- embedding = self .embedding_function . embed_query (query )
2114
+ embedding = await self .embeddings . aembed_query (query )
2115
2115
docs = await self .amax_marginal_relevance_search_with_score_by_vector (
2116
2116
embedding = embedding ,
2117
2117
k = k ,
0 commit comments