πͺNested Configurations
Hypster enables hierarchical configuration management through the hp.nest() method, allowing you to compose complex configurations from smaller, reusable components.
For an in depth tutorial, please check out the article on Medium: Implementing Modular-RAG using Haystack and Hypster
nest Function Signature
nest Function Signaturedef nest(
config_func: Union[str, Path, "Hypster"],
*,
name: Optional[str] = None,
final_vars: List[str] = [],
exclude_vars: List[str] = [],
values: Dict[str, Any] = {}
) -> Dict[str, Any]Parameters
config_func: Either a path to a saved configuration or a Hypster config objectname: Optional name for the nested configuration (used in dot notation)final_vars: List of variables that cannot be modified by parent configsexclude_vars: List of variables to exclude from the configurationvalues: Dictionary of values to override in the nested configuration
Steps for nesting
Configuration Sources
hp.nest() accepts two types of sources:
Path to Configuration File
Direct Configuration Object
Value Assignment
Values for nested configurations can be set using either dot notation or nested dictionaries:
Hierarchical Nesting
Configurations can be nested multiple times to create modular, reusable components:
Passing Values to Nested Configs
Use the values parameter to pass dependent values to nested configuration values:
final_vars and exclude_vars are also supported.
Best Practices
Modular Design
Create small, focused configurations for specific components
Combine configurations only when there are clear dependencies
Keep configurations reusable across different use cases
Clear Naming
Value Dependencies
File Organization
Last updated
Was this helpful?