Skip to content

Commit

Permalink
Merge pull request #623 from Anush008/qdrant-query-api
Browse files Browse the repository at this point in the history
refactor: Use Qdrant's Query API
  • Loading branch information
zainhoda authored Aug 28, 2024
2 parents 27fbb3b + 58417a8 commit f571c09
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions src/vanna/qdrant/qdrant.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

import pandas as pd
from qdrant_client import QdrantClient, grpc, models
from qdrant_client.http.models.models import UpdateStatus

from ..base import VannaBase
from ..utils import deterministic_uuid
Expand Down Expand Up @@ -234,32 +233,32 @@ def embeddings_dimension(self):
return len(self.generate_embedding("ABCDEF"))

def get_similar_question_sql(self, question: str, **kwargs) -> list:
results = self._client.search(
results = self._client.query_points(
self.sql_collection_name,
query_vector=self.generate_embedding(question),
query=self.generate_embedding(question),
limit=self.n_results,
with_payload=True,
)
).points

return [dict(result.payload) for result in results]

def get_related_ddl(self, question: str, **kwargs) -> list:
results = self._client.search(
results = self._client.query_points(
self.ddl_collection_name,
query_vector=self.generate_embedding(question),
query=self.generate_embedding(question),
limit=self.n_results,
with_payload=True,
)
).points

return [result.payload["ddl"] for result in results]

def get_related_documentation(self, question: str, **kwargs) -> list:
results = self._client.search(
results = self._client.query_points(
self.documentation_collection_name,
query_vector=self.generate_embedding(question),
query=self.generate_embedding(question),
limit=self.n_results,
with_payload=True,
)
).points

return [result.payload["documentation"] for result in results]

Expand Down

0 comments on commit f571c09

Please sign in to comment.