Skip to content

Commit

Permalink
Rmove qdrant async client (#33)
Browse files Browse the repository at this point in the history
  • Loading branch information
conradocloudera authored Nov 21, 2024
1 parent 1c225ce commit 5902fa1
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions llm-service/app/services/rag_qdrant_vector_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,9 @@
class RagQdrantVectorStore(VectorStore):
host = os.environ.get("QDRANT_HOST", "localhost")
port = 6333
async_port = 6334

def __init__(self, table_name: str, memory_store: bool = False):
self.client, self.aclient = self._create_qdrant_clients(memory_store)
self.client = self._create_qdrant_clients(memory_store)
self.table_name = table_name

def size(self) -> int:
Expand All @@ -71,19 +70,14 @@ def delete(self) -> None:
def exists(self) -> bool:
return self.client.collection_exists(self.table_name)

def _create_qdrant_clients(
self, memory_store: bool
) -> tuple[qdrant_client.QdrantClient, qdrant_client.AsyncQdrantClient]:
def _create_qdrant_clients(self, memory_store: bool) -> qdrant_client.QdrantClient:
if memory_store:
client = qdrant_client.QdrantClient(":memory:")
aclient = qdrant_client.AsyncQdrantClient(":memory:")
else:
client = qdrant_client.QdrantClient(host=self.host, port=self.port)
aclient = qdrant_client.AsyncQdrantClient(
host=self.host, port=self.async_port
)
return client, aclient

return client

def access_vector_store(self) -> BasePydanticVectorStore:
vector_store = QdrantVectorStore(self.table_name, self.client, self.aclient)
vector_store = QdrantVectorStore(self.table_name, self.client)
return vector_store

0 comments on commit 5902fa1

Please sign in to comment.