Files
EventHubAiRouter/router/rules_loader.py
T
aleksey 83d516afa1
CI / build-gateway (push) Successful in 27s
CI / sync-config (push) Successful in 1s
feat(ift): EventHub AI Router stack for Zed
FastAPI gateway with A/B/C lane orchestration, LiteLLM proxy config,
Swarm stack (postgres, redis, VPN off-by-default), deploy/smoke/audit scripts.
2026-08-07 22:06:41 +03:00

40 lines
978 B
Python

"""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()