from_yaml(
cls,
schema_path: str,
kwargs: Any = {},
) -> RedisConfig| Name | Type | Description |
|---|---|---|
schema_path* | str | Path to the YAML file containing the index schema definition. |
**kwargs | Any | Default: {}Additional Common kwargs include:
|
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.
Example:
from langchain_redis import RedisConfig
# Assuming 'index_schema.yaml' contains a valid index schema
config = RedisConfig.from_yaml(
schema_path="path/to/index_schema.yaml",
redis_url="redis://localhost:6379"
)
# The YAML file is read when the schema is built
schema = config.to_index_schema()
print(schema.index.name) # Output: Name defined in YAML
print(schema.index.storage_type) # Output: Storage type defined in YAML
Note:
to_index_schema() and used as-is to
build the index.