Skip to content

Commit

Permalink
refactor: Qdrant use Query API (#3428)
Browse files Browse the repository at this point in the history
Co-authored-by: Li Jiang <[email protected]>
  • Loading branch information
Anush008 and thinkall authored Sep 26, 2024
1 parent 94064da commit f958f17
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions autogen/agentchat/contrib/vectordb/qdrant.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ def create_collection(self, collection_name: str, overwrite: bool = False, get_o
elif not get_or_create:
raise ValueError(f"Collection {collection_name} already exists.")

def get_collection(self, collection_name: str = None):
def get_collection(self, collection_name: Optional[str] = None):
"""
Get the collection from the vector database.
Expand Down Expand Up @@ -231,8 +231,8 @@ def retrieve_docs(
"""
embeddings = self.embedding_function(queries)
requests = [
models.SearchRequest(
vector=embedding,
models.QueryRequest(
query=embedding,
limit=n_results,
score_threshold=distance_threshold,
with_payload=True,
Expand All @@ -241,8 +241,8 @@ def retrieve_docs(
for embedding in embeddings
]

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

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

0 comments on commit f958f17

Please sign in to comment.