Configuration class for Redis vector store settings.
This class defines the configuration parameters for setting up and interacting with a Redis vector store. It uses Pydantic for data validation and settings management.
RedisConfig()Example:
from langchain_redis import RedisConfig
config = RedisConfig(
index_name="my_index",
redis_url="redis://localhost:6379",
distance_metric="COSINE",
embedding_dimensions=1536
)
# Use this config to initialize a RedisVectorStore
vector_store = RedisVectorStore(embeddings=my_embeddings, config=config)
Note:
'index_schema', 'schema_path', or 'metadata_schema'
should be specified.'key_prefix' is automatically set to 'index_name' if not provided.'from_existing' is True, it connects to an existing index instead
of creating a new one.Create a RedisConfig object with default values, overwritten by provided
kwargs.
This class method allows for flexible creation of a RedisConfig object,
using default values where not specified and overriding with any provided
keyword arguments. If a 'schema' argument is provided, it will be set as
'index_schema' in the config.
Create a RedisConfig object from an IndexSchema.
This class method creates a RedisConfig instance using the provided
IndexSchema, which defines the structure of the Redis index.
Create a RedisConfig object from a YAML file containing the index schema.
This class method creates a RedisConfig instance using a YAML file that
defines the structure of the Redis index.
Create a RedisConfig object with a specified metadata schema.
This class method creates a RedisConfig instance using a provided
metadata schema, which defines the structure of additional metadata
fields in the Redis index.
Create a RedisConfig object from an existing Redis index.
This class method creates a RedisConfig instance based on the configuration
of an existing index in Redis. It's useful for connecting to and working with
pre-existing Redis vector store indexes.
Convert the RedisConfig to an IndexSchema.
This method creates an IndexSchema object based on the current configuration.
It's useful for generating a schema that can be used to create or update
a Redis index.
Check if the redis_url is a Sentinel URL.