QdrantVectorStore#

pydantic model llama_index.vector_stores.QdrantVectorStore#

Qdrant Vector Store.

In this vector store, embeddings and docs are stored within a Qdrant collection.

During query time, the index uses Qdrant to query for the top k most similar nodes.

Parameters
  • collection_name – (str): name of the Qdrant collection

  • client (Optional[Any]) – QdrantClient instance from qdrant-client package

  • aclient (Optional[Any]) – AsyncQdrantClient instance from qdrant-client package

  • url (Optional[str]) – url of the Qdrant instance

  • api_key (Optional[str]) – API key for authenticating with Qdrant

  • batch_size (int) – number of points to upload in a single request to Qdrant. Defaults to 64

  • parallel (int) – number of parallel processes to use during upload. Defaults to 1

  • max_retries (int) – maximum number of retries in case of a failure. Defaults to 3

  • client_kwargs (Optional[dict]) – additional kwargs for QdrantClient and AsyncQdrantClient

  • enable_hybrid (bool) – whether to enable hybrid search using dense and sparse vectors

  • sparse_doc_fn (Optional[SparseEncoderCallable]) – function to encode sparse vectors

  • sparse_query_fn (Optional[SparseEncoderCallable]) – function to encode sparse queries

  • hybrid_fusion_fn (Optional[HybridFusionCallable]) – function to fuse hybrid search results

Show JSON schema
{
   "title": "QdrantVectorStore",
   "description": "Qdrant Vector Store.\n\nIn this vector store, embeddings and docs are stored within a\nQdrant collection.\n\nDuring query time, the index uses Qdrant to query for the top\nk most similar nodes.\n\nArgs:\n    collection_name: (str): name of the Qdrant collection\n    client (Optional[Any]): QdrantClient instance from `qdrant-client` package\n    aclient (Optional[Any]): AsyncQdrantClient instance from `qdrant-client` package\n    url (Optional[str]): url of the Qdrant instance\n    api_key (Optional[str]): API key for authenticating with Qdrant\n    batch_size (int): number of points to upload in a single request to Qdrant. Defaults to 64\n    parallel (int): number of parallel processes to use during upload. Defaults to 1\n    max_retries (int): maximum number of retries in case of a failure. Defaults to 3\n    client_kwargs (Optional[dict]): additional kwargs for QdrantClient and AsyncQdrantClient\n    enable_hybrid (bool): whether to enable hybrid search using dense and sparse vectors\n    sparse_doc_fn (Optional[SparseEncoderCallable]): function to encode sparse vectors\n    sparse_query_fn (Optional[SparseEncoderCallable]): function to encode sparse queries\n    hybrid_fusion_fn (Optional[HybridFusionCallable]): function to fuse hybrid search results",
   "type": "object",
   "properties": {
      "stores_text": {
         "title": "Stores Text",
         "default": true,
         "type": "boolean"
      },
      "is_embedding_query": {
         "title": "Is Embedding Query",
         "default": true,
         "type": "boolean"
      },
      "flat_metadata": {
         "title": "Flat Metadata",
         "default": false,
         "type": "boolean"
      },
      "collection_name": {
         "title": "Collection Name",
         "type": "string"
      },
      "path": {
         "title": "Path",
         "type": "string"
      },
      "url": {
         "title": "Url",
         "type": "string"
      },
      "api_key": {
         "title": "Api Key",
         "type": "string"
      },
      "batch_size": {
         "title": "Batch Size",
         "type": "integer"
      },
      "parallel": {
         "title": "Parallel",
         "type": "integer"
      },
      "max_retries": {
         "title": "Max Retries",
         "type": "integer"
      },
      "client_kwargs": {
         "title": "Client Kwargs",
         "type": "object"
      },
      "enable_hybrid": {
         "title": "Enable Hybrid",
         "type": "boolean"
      },
      "class_name": {
         "title": "Class Name",
         "type": "string",
         "default": "QdrantVectorStore"
      }
   },
   "required": [
      "collection_name",
      "batch_size",
      "parallel",
      "max_retries",
      "enable_hybrid"
   ]
}

Config
  • schema_extra: function = <function BaseComponent.Config.schema_extra at 0x7ff1e41e53a0>

Fields
  • api_key (Optional[str])

  • batch_size (int)

  • client_kwargs (dict)

  • collection_name (str)

  • enable_hybrid (bool)

  • flat_metadata (bool)

  • max_retries (int)

  • parallel (int)

  • path (Optional[str])

  • stores_text (bool)

  • url (Optional[str])

field api_key: Optional[str] = None#
field batch_size: int [Required]#
field client_kwargs: dict [Optional]#
field collection_name: str [Required]#
field enable_hybrid: bool [Required]#
field flat_metadata: bool = False#
field max_retries: int [Required]#
field parallel: int [Required]#
field path: Optional[str] = None#
field stores_text: bool = True#
field url: Optional[str] = None#
add(nodes: List[BaseNode], **add_kwargs: Any) List[str]#

Add nodes to index.

Parameters

nodes – List[BaseNode]: list of nodes with embeddings

async adelete(ref_doc_id: str, **delete_kwargs: Any) None#

Asynchronous method to delete nodes using with ref_doc_id.

Parameters

ref_doc_id (str) – The doc_id of the document to delete.

async aquery(query: VectorStoreQuery, **kwargs: Any) VectorStoreQueryResult#

Asynchronous method to query index for top k most similar nodes.

Parameters

query (VectorStoreQuery) – query

async async_add(nodes: List[BaseNode], **kwargs: Any) List[str]#

Asynchronous method to add nodes to Qdrant index.

Parameters

nodes – List[BaseNode]: List of nodes with embeddings.

Returns

List of node IDs that were added to the index.

Raises

ValueError – If trying to using async methods without aclient

classmethod class_name() str#

Get the class name, used as a unique ID in serialization.

This provides a key that makes serialization robust against actual class name changes.

delete(ref_doc_id: str, **delete_kwargs: Any) None#

Delete nodes using with ref_doc_id.

Parameters

ref_doc_id (str) – The doc_id of the document to delete.

parse_to_query_result(response: List[Any]) VectorStoreQueryResult#

Convert vector store response to VectorStoreQueryResult.

Parameters

response – List[Any]: List of results returned from the vector store.

query(query: VectorStoreQuery, **kwargs: Any) VectorStoreQueryResult#

Query index for top k most similar nodes.

Parameters

query (VectorStoreQuery) – query

property client: Any#

Return the Qdrant client.