"""Model routing configuration management.""" import yaml import os from typing import Dict, Any, Optional def load_config(plugin_dir: str) -> Dict[str, Any]: """Load model routing config from default_config.yaml.""" config_path = os.path.join(plugin_dir, "default_config.yaml") try: with open(config_path, "r") as f: config = yaml.safe_load(f) or {} return config.get("model_routing", {}) except (FileNotFoundError, yaml.YAMLError) as e: return {} def get_role_preset(role: str, config: Dict[str, Any]) -> Optional[str]: """Get the model preset for a given role.""" roles = config.get("roles", {}) role_config = roles.get(role, {}) return role_config.get("preset") def list_roles(config: Dict[str, Any]) -> list: """Return list of defined role names.""" return list(config.get("roles", {}).keys())