aiq.cli.cli_utils.config_override#
Attributes#
Classes#
Functions#
|
Load config file and apply any overrides |
|
Decorator to add override option to a command |
Module Contents#
- logger#
- class LayeredConfig(base_config: dict[str, Any])#
- base_config#
- set_override(path: str, value: str) None #
Set an override value with type conversion based on original config value.
- Args:
path: Configuration path in dot notation (e.g., “llms.nim_llm.temperature”) value: String value from CLI to override with
- Raises:
click.BadParameter: If path doesn’t exist or type conversion fails Exception: For other unexpected errors
- _update_config_value( ) None #
Update a single value in the config dictionary at the specified path.
- Args:
config: The configuration dictionary to update path: String representing the path to the value using dot notation (e.g. “llms.nim_llm.temperature”) value: The new value to set at the specified path
- Example:
If config is {“llms”: {“nim_llm”: {“temperature”: 0.5}}} and path is “llms.nim_llm.temperature” with value 0.7, this will update config to {“llms”: {“nim_llm”: {“temperature”: 0.7}}}
- get_effective_config() dict[str, Any] #
Get the configuration with all overrides applied.
Creates a new configuration dictionary by applying all stored overrides to a deep copy of the base configuration. Caches the result to avoid recomputing unless overrides change.
- Returns:
Dict containing the full configuration with all overrides applied
- Note:
The configuration is cached in self._effective_config and only recomputed when new overrides are added via set_override()
- load_and_override_config(
- config_file: pathlib.Path,
- overrides: tuple[tuple[str, str], Ellipsis],
Load config file and apply any overrides
- add_override_option(command)#
Decorator to add override option to a command