qdrant_vector_store_driver
CONTENT_PAYLOAD_KEY = 'data'
module-attribute
DEFAULT_DISTANCE = 'Cosine'
module-attribute
QdrantVectorStoreDriver
Bases: BaseVectorStoreDriver
Vector Store Driver for Qdrant.
Attributes:
Name | Type | Description |
---|---|---|
location |
Optional[str]
|
An optional location for the Qdrant client. If set to ':memory:', an in-memory client is used. |
url |
Optional[str]
|
An optional Qdrant API URL. |
host |
Optional[str]
|
An optional Qdrant host. |
path |
Optional[str]
|
Persistence path for QdrantLocal. Default: None |
port |
int
|
The port number for the Qdrant client. Defaults: 6333. |
grpc_port |
int
|
The gRPC port number for the Qdrant client. Defaults: 6334. |
prefer_grpc |
bool
|
A boolean indicating whether to prefer gRPC over HTTP. Defaults: False. |
force_disable_check_same_thread |
Optional[bool]
|
For QdrantLocal, force disable check_same_thread. Default: False Only use this if you can guarantee that you can resolve the thread safety outside QdrantClient. |
timeout |
Optional[int]
|
Timeout for REST and gRPC API requests. Default: 5 seconds for REST and unlimited for gRPC |
api_key |
Optional[str]
|
API key for authentication in Qdrant Cloud. Defaults: False |
https |
bool
|
If true - use HTTPS(SSL) protocol. Default: None |
prefix |
Optional[str]
|
Add prefix to the REST URL path. Example: service/v1 will result in Example: service/v1 will result in http://localhost:6333/service/v1/{qdrant-endpoint} for REST API. Defaults: None |
distance |
str
|
The distance metric to be used for the vectors. Defaults: 'COSINE'. |
collection_name |
str
|
The name of the Qdrant collection. |
vector_name |
Optional[str]
|
An optional name for the vectors. |
content_payload_key |
str
|
The key for the content payload in the metadata. Defaults: 'data'. |
Source code in griptape/drivers/vector/qdrant_vector_store_driver.py
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 |
|
api_key: Optional[str] = field(default=None, kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
collection_name: str = field(kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
content_payload_key: str = field(default=CONTENT_PAYLOAD_KEY, kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
distance: str = field(default=DEFAULT_DISTANCE, kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
force_disable_check_same_thread: Optional[bool] = field(default=False, kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
grpc_port: int = field(default=6334, kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
host: Optional[str] = field(default=None, kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
https: bool = field(default=None, kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
location: Optional[str] = field(default=None, kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
path: Optional[str] = field(default=None, kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
port: int = field(default=6333, kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
prefer_grpc: bool = field(default=False, kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
prefix: Optional[str] = field(default=None, kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
timeout: Optional[int] = field(default=5, kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
url: Optional[str] = field(default=None, kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
vector_name: Optional[str] = field(default=None, kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
client()
Source code in griptape/drivers/vector/qdrant_vector_store_driver.py
delete_vector(vector_id)
Delete a vector from the Qdrant collection based on its ID.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
vector_id |
str | id
|
ID of the vector to delete. |
required |
Source code in griptape/drivers/vector/qdrant_vector_store_driver.py
load_entries(*, namespace=None, **kwargs)
Load vector entries from the Qdrant collection.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
namespace |
Optional[str]
|
Optional namespace of the vectors. |
None
|
Returns:
Type | Description |
---|---|
list[Entry]
|
List of points. |
Source code in griptape/drivers/vector/qdrant_vector_store_driver.py
load_entry(vector_id, *, namespace=None)
Load a vector entry from the Qdrant collection based on its ID.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
vector_id |
str
|
ID of the vector to load. |
required |
namespace |
str
|
Optional namespace of the vector. |
None
|
Returns:
Type | Description |
---|---|
Optional[Entry]
|
Optional[BaseVectorStoreDriver.Entry]: Vector entry if found, else None. |
Source code in griptape/drivers/vector/qdrant_vector_store_driver.py
query(query, *, count=None, namespace=None, include_vectors=False, **kwargs)
Query the Qdrant collection based on a query vector.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
query |
str
|
Query string. |
required |
count |
Optional[int]
|
Optional number of results to return. |
None
|
namespace |
Optional[str]
|
Optional namespace of the vectors. |
None
|
include_vectors |
bool
|
Whether to include vectors in the results. |
False
|
Returns:
Type | Description |
---|---|
list[Entry]
|
list[BaseVectorStoreDriver.Entry]: List of Entry objects. |
Source code in griptape/drivers/vector/qdrant_vector_store_driver.py
upsert_vector(vector, *, vector_id=None, namespace=None, meta=None, content=None, **kwargs)
Upsert vectors into the Qdrant collection.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
vector |
list[float]
|
The vector to be upserted. |
required |
vector_id |
Optional[str]
|
Optional vector ID. |
None
|
namespace |
Optional[str]
|
Optional namespace for the vector. |
None
|
meta |
Optional[dict]
|
Optional dictionary containing metadata. |
None
|
content |
Optional[str]
|
The text content to be included in the payload. |
None
|
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
The ID of the upserted vector. |