Index
Vector store index types.
VectorStoreQueryResult
dataclass
#
Vector store query result.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
nodes
|
Sequence[BaseNode] | None
|
|
None
|
similarities
|
List[float] | None
|
|
None
|
ids
|
List[str] | None
|
|
None
|
Source code in llama-index-core/llama_index/core/vector_stores/types.py
36 37 38 39 40 41 42 |
|
VectorStoreQueryMode #
Bases: str
, Enum
Vector store query mode.
Source code in llama-index-core/llama_index/core/vector_stores/types.py
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
|
FilterOperator #
Bases: str
, Enum
Vector store filter operator.
Source code in llama-index-core/llama_index/core/vector_stores/types.py
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
|
FilterCondition #
Bases: str
, Enum
Vector store filter conditions to combine different filters.
Source code in llama-index-core/llama_index/core/vector_stores/types.py
82 83 84 85 86 87 |
|
MetadataFilter #
Bases: BaseModel
Comprehensive metadata filter for vector stores to support more operators.
Value uses Strict* types, as int, float and str are compatible types and were all converted to string before.
See: https://docs.pydantic.dev/latest/usage/types/#strict-types
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
str
|
|
required |
value
|
Annotated[int, Strict] | Annotated[float, Strict] | Annotated[str, Strict] | List[Annotated[str, Strict]] | List[Annotated[float, Strict]] | List[Annotated[int, Strict]] | None
|
|
required |
operator
|
FilterOperator
|
|
<FilterOperator.EQ: '=='>
|
Source code in llama-index-core/llama_index/core/vector_stores/types.py
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 |
|
from_dict
classmethod
#
from_dict(filter_dict: Dict) -> MetadataFilter
Create MetadataFilter from dictionary.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
filter_dict
|
Dict
|
Dict with key, value and operator. |
required |
Source code in llama-index-core/llama_index/core/vector_stores/types.py
112 113 114 115 116 117 118 119 120 121 122 123 |
|
MetadataFilters #
Bases: BaseModel
Metadata filters for vector stores.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
filters
|
List[Union[MetadataFilter, MetadataFilters]]
|
|
required |
condition
|
FilterCondition | None
|
|
<FilterCondition.AND: 'and'>
|
Source code in llama-index-core/llama_index/core/vector_stores/types.py
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 |
|
from_dict
classmethod
#
from_dict(filter_dict: Dict) -> MetadataFilters
Create MetadataFilters from json.
Source code in llama-index-core/llama_index/core/vector_stores/types.py
144 145 146 147 148 149 150 151 152 153 154 155 |
|
from_dicts
classmethod
#
from_dicts(filter_dicts: List[Dict], condition: Optional[FilterCondition] = AND) -> MetadataFilters
Create MetadataFilters from dicts.
This takes in a list of individual MetadataFilter objects, along with the condition.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
filter_dicts
|
List[Dict]
|
List of dicts, each dict is a MetadataFilter. |
required |
condition
|
Optional[FilterCondition]
|
FilterCondition to combine different filters. |
AND
|
Source code in llama-index-core/llama_index/core/vector_stores/types.py
157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 |
|
legacy_filters #
legacy_filters() -> List[ExactMatchFilter]
Convert MetadataFilters to legacy ExactMatchFilters.
Source code in llama-index-core/llama_index/core/vector_stores/types.py
180 181 182 183 184 185 186 187 188 189 190 191 192 193 |
|
VectorStoreQuerySpec #
Bases: BaseModel
Schema for a structured request for vector store (i.e. to be converted to a VectorStoreQuery).
Currently only used by VectorIndexAutoRetriever.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
query
|
str
|
|
required |
filters
|
List[MetadataFilter]
|
|
required |
top_k
|
int | None
|
|
None
|
Source code in llama-index-core/llama_index/core/vector_stores/types.py
196 197 198 199 200 201 202 203 204 205 |
|
MetadataInfo #
Bases: BaseModel
Information about a metadata filter supported by a vector store.
Currently only used by VectorIndexAutoRetriever.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
str
|
|
required |
type
|
str
|
|
required |
description
|
str
|
|
required |
Source code in llama-index-core/llama_index/core/vector_stores/types.py
208 209 210 211 212 213 214 215 216 |
|
VectorStoreInfo #
Bases: BaseModel
Information about a vector store (content and supported metadata filters).
Currently only used by VectorIndexAutoRetriever.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
metadata_info
|
List[MetadataInfo]
|
|
required |
content_info
|
str
|
|
required |
Source code in llama-index-core/llama_index/core/vector_stores/types.py
219 220 221 222 223 224 225 226 |
|
VectorStoreQuery
dataclass
#
Vector store query.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
query_embedding
|
List[float] | None
|
|
None
|
similarity_top_k
|
int
|
|
1
|
doc_ids
|
List[str] | None
|
|
None
|
node_ids
|
List[str] | None
|
|
None
|
query_str
|
str | None
|
|
None
|
output_fields
|
List[str] | None
|
|
None
|
embedding_field
|
str | None
|
|
None
|
mode
|
VectorStoreQueryMode
|
|
<VectorStoreQueryMode.DEFAULT: 'default'>
|
alpha
|
float | None
|
|
None
|
filters
|
MetadataFilters | None
|
|
None
|
mmr_threshold
|
float | None
|
|
None
|
sparse_top_k
|
int | None
|
|
None
|
hybrid_top_k
|
int | None
|
|
None
|
Source code in llama-index-core/llama_index/core/vector_stores/types.py
229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 |
|
VectorStore #
Bases: Protocol
Abstract vector store protocol.
Source code in llama-index-core/llama_index/core/vector_stores/types.py
258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 |
|
add #
add(nodes: List[BaseNode], **add_kwargs: Any) -> List[str]
Add nodes with embedding to vector store.
Source code in llama-index-core/llama_index/core/vector_stores/types.py
270 271 272 273 274 275 276 |
|
async_add
async
#
async_add(nodes: List[BaseNode], **kwargs: Any) -> List[str]
Asynchronously add nodes with embedding to vector store. NOTE: this is not implemented for all vector stores. If not implemented, it will just call add synchronously.
Source code in llama-index-core/llama_index/core/vector_stores/types.py
278 279 280 281 282 283 284 285 286 287 288 |
|
delete #
delete(ref_doc_id: str, **delete_kwargs: Any) -> None
Delete nodes using with ref_doc_id.
Source code in llama-index-core/llama_index/core/vector_stores/types.py
290 291 292 293 |
|
adelete
async
#
adelete(ref_doc_id: str, **delete_kwargs: Any) -> None
Delete nodes using with ref_doc_id. NOTE: this is not implemented for all vector stores. If not implemented, it will just call delete synchronously.
Source code in llama-index-core/llama_index/core/vector_stores/types.py
295 296 297 298 299 300 301 |
|
query #
query(query: VectorStoreQuery, **kwargs: Any) -> VectorStoreQueryResult
Query vector store.
Source code in llama-index-core/llama_index/core/vector_stores/types.py
303 304 305 |
|
aquery
async
#
aquery(query: VectorStoreQuery, **kwargs: Any) -> VectorStoreQueryResult
Asynchronously query vector store. NOTE: this is not implemented for all vector stores. If not implemented, it will just call query synchronously.
Source code in llama-index-core/llama_index/core/vector_stores/types.py
307 308 309 310 311 312 313 314 315 |
|
BasePydanticVectorStore #
Bases: BaseComponent
, ABC
Abstract vector store protocol.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
stores_text
|
bool
|
|
required |
is_embedding_query
|
bool
|
|
True
|
Source code in llama-index-core/llama_index/core/vector_stores/types.py
324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 |
|
get_nodes #
get_nodes(node_ids: Optional[List[str]] = None, filters: Optional[MetadataFilters] = None) -> List[BaseNode]
Get nodes from vector store.
Source code in llama-index-core/llama_index/core/vector_stores/types.py
336 337 338 339 340 341 342 |
|
aget_nodes
async
#
aget_nodes(node_ids: Optional[List[str]] = None, filters: Optional[MetadataFilters] = None) -> List[BaseNode]
Asynchronously get nodes from vector store.
Source code in llama-index-core/llama_index/core/vector_stores/types.py
344 345 346 347 348 349 350 |
|
add
abstractmethod
#
add(nodes: Sequence[BaseNode], **kwargs: Any) -> List[str]
Add nodes to vector store.
Source code in llama-index-core/llama_index/core/vector_stores/types.py
352 353 354 355 356 357 358 |
|
async_add
async
#
async_add(nodes: Sequence[BaseNode], **kwargs: Any) -> List[str]
Asynchronously add nodes to vector store. NOTE: this is not implemented for all vector stores. If not implemented, it will just call add synchronously.
Source code in llama-index-core/llama_index/core/vector_stores/types.py
360 361 362 363 364 365 366 367 368 369 370 |
|
delete
abstractmethod
#
delete(ref_doc_id: str, **delete_kwargs: Any) -> None
Delete nodes using with ref_doc_id.
Source code in llama-index-core/llama_index/core/vector_stores/types.py
372 373 374 375 |
|
adelete
async
#
adelete(ref_doc_id: str, **delete_kwargs: Any) -> None
Delete nodes using with ref_doc_id. NOTE: this is not implemented for all vector stores. If not implemented, it will just call delete synchronously.
Source code in llama-index-core/llama_index/core/vector_stores/types.py
377 378 379 380 381 382 383 |
|
delete_nodes #
delete_nodes(node_ids: Optional[List[str]] = None, filters: Optional[MetadataFilters] = None, **delete_kwargs: Any) -> None
Delete nodes from vector store.
Source code in llama-index-core/llama_index/core/vector_stores/types.py
385 386 387 388 389 390 391 392 |
|
adelete_nodes
async
#
adelete_nodes(node_ids: Optional[List[str]] = None, filters: Optional[MetadataFilters] = None, **delete_kwargs: Any) -> None
Asynchronously delete nodes from vector store.
Source code in llama-index-core/llama_index/core/vector_stores/types.py
394 395 396 397 398 399 400 401 |
|
clear #
clear() -> None
Clear all nodes from configured vector store.
Source code in llama-index-core/llama_index/core/vector_stores/types.py
403 404 405 |
|
aclear
async
#
aclear() -> None
Asynchronously clear all nodes from configured vector store.
Source code in llama-index-core/llama_index/core/vector_stores/types.py
407 408 409 |
|
query
abstractmethod
#
query(query: VectorStoreQuery, **kwargs: Any) -> VectorStoreQueryResult
Query vector store.
Source code in llama-index-core/llama_index/core/vector_stores/types.py
411 412 413 |
|
aquery
async
#
aquery(query: VectorStoreQuery, **kwargs: Any) -> VectorStoreQueryResult
Asynchronously query vector store. NOTE: this is not implemented for all vector stores. If not implemented, it will just call query synchronously.
Source code in llama-index-core/llama_index/core/vector_stores/types.py
415 416 417 418 419 420 421 422 423 |
|