Skip to content

Commit 6eb53bc

Browse files
refactor: Improve type safety in QdrantVectorStore client parameters (#17197)
1 parent 3c5ec51 commit 6eb53bc

File tree

1 file changed

+7
-6
lines changed
  • llama-index-integrations/vector_stores/llama-index-vector-stores-qdrant/llama_index/vector_stores/qdrant

1 file changed

+7
-6
lines changed

llama-index-integrations/vector_stores/llama-index-vector-stores-qdrant/llama_index/vector_stores/qdrant/base.py

+7-6
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
from typing import Any, List, Optional, Tuple, cast
1010

1111
import qdrant_client
12+
from qdrant_client import QdrantClient, AsyncQdrantClient
1213
from grpc import RpcError
1314
from llama_index.core.bridge.pydantic import Field, PrivateAttr
1415
from llama_index.core.schema import BaseNode, MetadataMode, TextNode
@@ -74,8 +75,8 @@ class QdrantVectorStore(BasePydanticVectorStore):
7475
7576
Args:
7677
collection_name: (str): name of the Qdrant collection
77-
client (Optional[Any]): QdrantClient instance from `qdrant-client` package
78-
aclient (Optional[Any]): AsyncQdrantClient instance from `qdrant-client` package
78+
client (Optional[QdrantClient]): QdrantClient instance from `qdrant-client` package
79+
aclient (Optional[AsyncQdrantClient]): AsyncQdrantClient instance from `qdrant-client` package
7980
url (Optional[str]): url of the Qdrant instance
8081
api_key (Optional[str]): API key for authenticating with Qdrant
8182
batch_size (int): number of points to upload in a single request to Qdrant. Defaults to 64
@@ -120,8 +121,8 @@ class QdrantVectorStore(BasePydanticVectorStore):
120121
fastembed_sparse_model: Optional[str]
121122
text_key: Optional[str]
122123

123-
_client: qdrant_client.QdrantClient = PrivateAttr()
124-
_aclient: qdrant_client.AsyncQdrantClient = PrivateAttr()
124+
_client: QdrantClient = PrivateAttr()
125+
_aclient: AsyncQdrantClient = PrivateAttr()
125126
_collection_initialized: bool = PrivateAttr()
126127
_sparse_doc_fn: Optional[SparseEncoderCallable] = PrivateAttr()
127128
_sparse_query_fn: Optional[SparseEncoderCallable] = PrivateAttr()
@@ -133,8 +134,8 @@ class QdrantVectorStore(BasePydanticVectorStore):
133134
def __init__(
134135
self,
135136
collection_name: str,
136-
client: Optional[Any] = None,
137-
aclient: Optional[Any] = None,
137+
client: Optional[QdrantClient] = None,
138+
aclient: Optional[AsyncQdrantClient] = None,
138139
url: Optional[str] = None,
139140
api_key: Optional[str] = None,
140141
batch_size: int = 64,

0 commit comments

Comments
 (0)