"""Load routing YAML configs from CONFIG_DIR.""" from __future__ import annotations import os from functools import lru_cache from pathlib import Path from typing import Any import yaml CONFIG_DIR = Path(os.environ.get("CONFIG_DIR", "/app/config")) @lru_cache(maxsize=1) def load_routing_rules() -> dict[str, Any]: path = CONFIG_DIR / "routing_rules.yaml" with path.open(encoding="utf-8") as f: return yaml.safe_load(f) or {} @lru_cache(maxsize=1) def load_model_matrix() -> dict[str, Any]: path = CONFIG_DIR / "model_matrix.yaml" with path.open(encoding="utf-8") as f: return yaml.safe_load(f) or {} @lru_cache(maxsize=1) def load_orchestration() -> dict[str, Any]: path = CONFIG_DIR / "orchestration.yaml" with path.open(encoding="utf-8") as f: return yaml.safe_load(f) or {} def reload_configs() -> None: load_routing_rules.cache_clear() load_model_matrix.cache_clear() load_orchestration.cache_clear()