Connect to an existing Redis index.
from_existing_index(
cls,
embedding: Embeddings,
index_name: str,
schema: Union[Dict[str, ListOfDict], str, os.PathLike, Dict[str, ListOfDict]],
key_prefix: Optional[str] = None,
**kwargs: Any = {}
) -> RedisExample:
.. code-block:: python
from langchain_community.vectorstores import Redis from langchain_community.embeddings import OpenAIEmbeddings
embeddings = OpenAIEmbeddings()
existing_rds = Redis.from_existing_index( embeddings, index_name="my-index", schema=rds.schema, # schema dumped from another index key_prefix=rds.key_prefix, # key prefix from another index redis_url="redis://username:password@localhost:6379", )
| Name | Type | Description |
|---|---|---|
embedding* | Embeddings | Embedding model class (i.e. OpenAIEmbeddings) for embedding queries. |
index_name* | str | Name of the index to connect to. |
schema* | Union[Dict[str, str], str, os.PathLike, Dict[str, ListOfDict]] | Schema of the index and the vector schema. Can be a dict, or path to yaml file. |
key_prefix | Optional[str] | Default: NonePrefix to use for all keys in Redis associated with this index. |
**kwargs | Any | Default: {}Additional keyword arguments to pass to the Redis client. |