Files
a0_software_orchestrator/api/model_routing_get.py
T

18 lines
833 B
Python
Raw Normal View History

"""API: Read current model routing configuration."""
from helpers.api import ApiHandler, Request, Response
import os
from usr.plugins.a0_software_orchestrator.helpers.model_routing import load_config, list_roles, get_role_preset
class ModelRoutingGet(ApiHandler):
async def process(self, input: dict, request: Request) -> dict | Response:
plugin_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
config = load_config(plugin_dir)
roles = list_roles(config)
result = {"roles": {}}
for role in roles:
preset = get_role_preset(role, config)
result["roles"][role] = {"preset": preset}
result["mode"] = config.get("mode", "per_agent_profile")
result["fallback"] = config.get("fallback_to_current_agent_model", True)
return result