)
Advanced examples:
Custom vector schema can be supplied to change the way that
Redis creates the underlying vector schema. This is useful
for production use cases where you want to optimize the
vector schema for your use case. ex. using HNSW instead of
FLAT (knn) which is the default
vector_schema = {
    "algorithm": "HNSW"
}
rds = Redis.from_texts(
    texts, # a list of strings
    metadata, # a list of metadata dicts
    embeddings, # an Embeddings object
    vector_schema=vector_schema,
    redis_url="redis://localhost:6379",
)
Custom index schema can be supplied to change the way that the
metadata is indexed. This is useful for you would like to use the
hybrid querying (filtering) capability of Redis.
By default, this implementation will automatically generate the index
schema according to the following rules:
All strings are indexed as text fields
All numbers are indexed as numeric fields
All lists of strings are indexed as tag fields (joined bylangchain.vectorstores.redis.constants.REDIS_TAG_SEPARATOR)
All None values are not indexed but still stored in Redis these arenot retrievable through the interface here, but the raw Redis client
can be used to retrieve them.
All other types are not indexed
To override these rules, you can pass in a custom index schema like the following
tag:
    - name: credit_score
text:
    - name: user
    - name: job
Typically, the credit_score field would be a text field since it’s a string,
however, we can override this behavior by specifying the field type as shown with
the yaml config (can also be a dictionary) above and the code below.
rds = Redis.from_texts(
    texts, # a list of strings