RedisVectorStore#

pydantic model llama_index.vector_stores.RedisVectorStore#

Show JSON schema
{
   "title": "RedisVectorStore",
   "description": "Abstract vector store protocol.",
   "type": "object",
   "properties": {
      "stores_text": {
         "title": "Stores Text",
         "default": true,
         "type": "boolean"
      },
      "is_embedding_query": {
         "title": "Is Embedding Query",
         "default": true,
         "type": "boolean"
      },
      "stores_node": {
         "title": "Stores Node",
         "default": true,
         "type": "boolean"
      },
      "flat_metadata": {
         "title": "Flat Metadata",
         "default": false,
         "type": "boolean"
      },
      "class_name": {
         "title": "Class Name",
         "type": "string",
         "default": "base_component"
      }
   }
}

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

Fields

add(nodes: List[BaseNode], **add_kwargs: Any) List[str]#

Add nodes to the index.

Parameters

nodes (List[BaseNode]) – List of nodes with embeddings

Returns

List of ids of the documents added to the index.

Return type

List[str]

Raises

ValueError – If the index already exists and overwrite is False.

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.

delete_index() None#

Delete the index and all documents.

persist(persist_path: str, fs: Optional[AbstractFileSystem] = None, in_background: bool = True) None#

Persist the vector store to disk.

Parameters
  • persist_path (str) – Path to persist the vector store to. (doesn’t apply)

  • in_background (bool, optional) – Persist in background. Defaults to True.

  • fs (fsspec.AbstractFileSystem, optional) – Filesystem to persist to. (doesn’t apply)

Raises

redis.exceptions.RedisError – If there is an error persisting the index to disk.

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

Query the index.

Parameters

query (VectorStoreQuery) – query object

Returns

query result

Return type

VectorStoreQueryResult

Raises
  • ValueError – If query.query_embedding is None.

  • redis.exceptions.RedisError – If there is an error querying the index.

  • redis.exceptions.TimeoutError – If there is a timeout querying the index.

  • ValueError – If no documents are found when querying the index.

property client: RedisType#

Return the redis client instance.