Set or update the configuration for a given key.
(self, key: str, value: Any, update: bool = False)
| 628 | return self.config.to_dict() |
| 629 | |
| 630 | def set_config(self, key: str, value: Any, update: bool = False) -> None: |
| 631 | """Set or update the configuration for a given key.""" |
| 632 | if key is None: |
| 633 | raise ValueError("Key must be provided.") |
| 634 | |
| 635 | if update: |
| 636 | current_value = getattr(self._config, key, {}) |
| 637 | if not isinstance(current_value, dict): |
| 638 | raise TypeError( |
| 639 | f"Expected a dict for key '{key}', got {type(current_value).__name__} instead." |
| 640 | ) |
| 641 | current_value.update(value) |
| 642 | else: |
| 643 | setattr(self._config, key, value) |
| 644 | |
| 645 | def override_metric(self, metric_name: str) -> None: |
| 646 | """ |