Initialize, create index, and load Documentsfrom langchain_community.vectorstores import Redis
from langchain_community.embeddings import OpenAIEmbeddings
rds = Redis.from_documents(
    documents, # a list of Document objects from loaders or created
    embeddings, # an Embeddings object
    redis_url="redis://localhost:6379",
)
Initialize, create index, and load Documents with metadatards = Redis.from_texts(
    texts, # a list of strings
    metadata, # a list of metadata dicts
    embeddings, # an Embeddings object
    redis_url="redis://localhost:6379",
)
Initialize, create index, and load Documents with metadata and return keys
rds, keys = Redis.from_texts_return_keys(
    texts, # a list of strings
    metadata, # a list of metadata dicts
    embeddings, # an Embeddings object
    redis_url="redis://localhost:6379",
)
For use cases where the index needs to stay alive, you can initialize
with an index name such that it’s easier to reference later
rds = Redis.from_texts(
    texts, # a list of strings
    metadata, # a list of metadata dicts
    embeddings, # an Embeddings object
    index_name="my-index",
    redis_url="redis://localhost:6379",
)
Initialize and connect to an existing index (from above)
# must pass in schema and key_prefix from another index
existing_rds = Redis.from_existing_index(
    embeddings, # an Embeddings object
    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://localhost:6379",
)
Advanced examples:
Custom vector schema can be supplied to change the way that