Skip to content

Commit f958f17

Browse files
Anush008thinkall
andauthored
refactor: Qdrant use Query API (#3428)
Co-authored-by: Li Jiang <[email protected]>
1 parent 94064da commit f958f17

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

autogen/agentchat/contrib/vectordb/qdrant.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ def create_collection(self, collection_name: str, overwrite: bool = False, get_o
129129
elif not get_or_create:
130130
raise ValueError(f"Collection {collection_name} already exists.")
131131

132-
def get_collection(self, collection_name: str = None):
132+
def get_collection(self, collection_name: Optional[str] = None):
133133
"""
134134
Get the collection from the vector database.
135135
@@ -231,8 +231,8 @@ def retrieve_docs(
231231
"""
232232
embeddings = self.embedding_function(queries)
233233
requests = [
234-
models.SearchRequest(
235-
vector=embedding,
234+
models.QueryRequest(
235+
query=embedding,
236236
limit=n_results,
237237
score_threshold=distance_threshold,
238238
with_payload=True,
@@ -241,8 +241,8 @@ def retrieve_docs(
241241
for embedding in embeddings
242242
]
243243

244-
batch_results = self.client.search_batch(collection_name, requests)
245-
return [self._scored_points_to_documents(results) for results in batch_results]
244+
batch_results = self.client.query_batch_points(collection_name, requests)
245+
return [self._scored_points_to_documents(results.points) for results in batch_results]
246246

247247
def get_docs_by_ids(
248248
self, ids: List[ItemID] = None, collection_name: str = None, include=True, **kwargs

0 commit comments

Comments
 (0)