Return VectorStore initialized from documents and embeddings.
classmethod from_existing_index(embedding: Embeddings, index_name: str, schema: Union[Dict[str, str], str, PathLike], **kwargs: Any) → Redis[source]¶
Connect to an existing Redis index.
Example
from langchain.vectorstores import Redis
from langchain.embeddings import OpenAIEmbeddings
embeddings = OpenAIEmbeddings()
redisearch = Redis.from_existing_index(
    embeddings,
    index_name="my-index",
    redis_url="redis://username:password@localhost:6379"
)
Parameters
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]) – Schema of the index
and the vector schema. Can be a dict, or path to yaml file
**kwargs (Any) – Additional keyword arguments to pass to the Redis client.
Returns
Redis VectorStore instance.
Return type
Redis
Raises
ValueError – If the index does not exist.
ImportError – If the redis python package is not installed.
classmethod from_texts(texts: List[str], embedding: Embeddings, metadatas: Optional[List[dict]] = None, index_name: Optional[str] = None, index_schema: Optional[Union[Dict[str, str], str, PathLike]] = None, vector_schema: Optional[Dict[str, Union[str, int]]] = None, **kwargs: Any) → Redis[source]¶
Create a Redis vectorstore from a list of texts.
This is a user-friendly interface that:
Embeds documents.
Creates a new Redis index if it doesn’t already exist
Adds the documents to the newly created Redis index.