from_kwargs(
cls: Type[RedisConfig],
**kwargs: Any = {},
) -> | Name | Type | Description |
|---|---|---|
**kwargs | Any | Default: {} |
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.
Example:
from langchain_redis import RedisConfig
config = RedisConfig.from_kwargs(
index_name="my_custom_index",
redis_url="redis://custom-host:6379",
distance_metric="COSINE",
embedding_dimensions=768
)
print(config.index_name) # Output: my_custom_index
print(config.distance_metric) # Output: COSINEKeyword arguments that match RedisConfig attributes. These will
override default values.
Common kwargs include:
index_name (str): Name of the index in Redis.redis_url (str): URL of the Redis instance.distance_metric (str): Distance metric for vector similarity.indexing_algorithm (str): Algorithm used for indexing.vector_datatype (str): Data type of the vector.embedding_dimensions (int): Dimensionality of embedding vectors.