Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: use Qdrant's Query API #3428

Merged
merged 3 commits into from
Sep 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading