ceca2ae8e3
LiteLLM baut auf Python 3.14 nicht (orjson-Pin ohne cp314-Wheel). Stattdessen eingebauter Gateway in MC2: routers/gateway_proxy.py (/v1/chat/completions, /completions, /models) + services/router_logic.py (Komplexitaets-Routing fast<->heavy, Streaming-Passthrough). gateway.py/routing.py/connect.py auf builtin umgestellt (Endpunkt = MC :PORT/v1). Gleicher OpenAI-Vertrag, spaeter gegen LiteLLM austauschbar. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
31 lines
1.1 KiB
Python
31 lines
1.1 KiB
Python
"""
|
|
Routing-Gateway-Status (eingebauter Modus). MC2 IST der Gateway: serviert
|
|
`/v1/*` mit `model: auto`-Komplexitäts-Routing vor llama-swap. Kein externer
|
|
LiteLLM-Dienst nötig (baut auf Python 3.14 nicht); bleibt später austauschbar.
|
|
"""
|
|
|
|
from config import PORT
|
|
from services.llamaswap import engine_reachable
|
|
from services.router_logic import FAST, HEAVY, HEAVY_CHARS
|
|
|
|
|
|
def routing_summary() -> dict:
|
|
return {
|
|
"mode": "builtin",
|
|
"endpoint": f":{PORT}/v1 (OpenAI-kompatibel)",
|
|
"routes": [
|
|
{"name": "auto", "target": f"{FAST} ↔ {HEAVY} (nach Komplexität)"},
|
|
{"name": FAST, "target": "llama-swap-Alias 'fast'"},
|
|
{"name": HEAVY, "target": "llama-swap-Alias 'heavy'"},
|
|
{"name": "<alias>", "target": "llama-swap-Passthrough (lädt bei Bedarf)"},
|
|
],
|
|
"heavy_threshold_chars": HEAVY_CHARS,
|
|
"fallbacks": [],
|
|
"context_window_fallbacks": [],
|
|
}
|
|
|
|
|
|
def gateway_reachable() -> bool:
|
|
# Der eingebaute Gateway lebt in MC und proxyt llama-swap → erreichbar, wenn Engine läuft.
|
|
return engine_reachable()
|