Skip to content

Remove qdrant async client #33

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

Merged
merged 1 commit into from
Nov 21, 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
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
Loading