Adds the documents to the newly created Redis index.
This method will generate schema based on the metadata passed in
if the index_schema is not defined. If the index_schema is defined,
it will compare against the generated schema and warn if there are
differences. If you are purposefully defining the schema for the
metadata, then you can ignore that warning.
To examine the schema options, initialize an instance of this class
and print out the schema using the Redis.schema` property. This
will include the content and content_vector classes which are
always present in the langchain schema.
Example
from langchain.vectorstores import Redis
from langchain.embeddings import OpenAIEmbeddings
embeddings = OpenAIEmbeddings()
redisearch = RediSearch.from_texts(
    texts,
    embeddings,
    redis_url="redis://username:password@localhost:6379"
)
Parameters
texts (List[str]) – List of texts to add to the vectorstore.
embedding (Embeddings) – Embedding model class (i.e. OpenAIEmbeddings)
for embedding queries.
metadatas (Optional[List[dict]], optional) – Optional list of metadata dicts
to add to the vectorstore. Defaults to None.
index_name (Optional[str], optional) – Optional name of the index to create
or add to. Defaults to None.
index_schema (Optional[Union[Dict[str, str], str, os.PathLike]], optional) – Optional fields to index within the metadata. Overrides generated
schema. Defaults to None.
vector_schema (Optional[Dict[str, Union[str, int]]], optional) – Optional
vector schema to use. Defaults to None.
**kwargs (Any) – Additional keyword arguments to pass to the Redis client.
Returns
Redis VectorStore instance.
Return type
Redis
Raises