From 5eb5490d167367350ac464808c135a75ab74c8a5 Mon Sep 17 00:00:00 2001 From: alpha-nerd-nomyo Date: Sun, 14 Dec 2025 17:58:45 +0100 Subject: [PATCH] feat: improve model version handling in endpoint selection Add logic to only append ":latest" suffix to models without existing version suffixes, preventing duplicate version tags and ensuring correct endpoint selection for models following Ollama naming conventions. --- router.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/router.py b/router.py index fa70991..282494c 100644 --- a/router.py +++ b/router.py @@ -687,7 +687,7 @@ async def choose_endpoint(model: str) -> str: if model in models ] - # 6️⃣ + # 6️⃣ if not candidate_endpoints: if ":latest" in model: #ollama naming convention not applicable to openai model_without_latest = model.split(":latest")[0] @@ -696,7 +696,9 @@ async def choose_endpoint(model: str) -> str: if model_without_latest in models and is_ext_openai_endpoint(ep) ] if not candidate_endpoints: - model = model + ":latest" + # Only add :latest suffix if model doesn't already have a version suffix + if ":" not in model: + model = model + ":latest" candidate_endpoints = [ ep for ep, models in zip(config.endpoints, advertised_sets) if model in models