mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-09 03:18:44 +00:00
fix(proxy): translate internal model routing keys to public names in team info and update
Fixes #30798
This commit is contained in:
parent
7e5699c7ab
commit
ad6a0acf19
1 changed files with 32 additions and 0 deletions
|
|
@ -1780,6 +1780,21 @@ async def update_team(
|
|||
data, user_api_key_dict, entity="team"
|
||||
)
|
||||
|
||||
if data.models is not None:
|
||||
from litellm.proxy.proxy_server import llm_router
|
||||
if llm_router is not None:
|
||||
translated_models = []
|
||||
for m in data.models:
|
||||
if m.startswith(f"model_name_{data.team_id}_"):
|
||||
model_info = llm_router.get_model_info(m)
|
||||
if model_info and isinstance(model_info, dict):
|
||||
team_public = model_info.get("team_public_model_name")
|
||||
if team_public:
|
||||
translated_models.append(team_public)
|
||||
continue
|
||||
translated_models.append(m)
|
||||
data.models = list(dict.fromkeys(translated_models))
|
||||
|
||||
if data.soft_budget is not None:
|
||||
max_budget_to_check = (
|
||||
data.max_budget
|
||||
|
|
@ -3686,6 +3701,23 @@ async def team_info(
|
|||
# Resolve resources inherited from access groups
|
||||
await _resolve_team_access_group_resources(_team_info)
|
||||
|
||||
# TRANSLATE MODEL ROUTING KEYS TO PUBLIC NAMES
|
||||
if _team_info.models is not None:
|
||||
from litellm.proxy.proxy_server import llm_router
|
||||
if llm_router is not None:
|
||||
translated_models = []
|
||||
for m in _team_info.models:
|
||||
if m.startswith(f"model_name_{team_id}_"):
|
||||
model_info = llm_router.get_model_info(m)
|
||||
if model_info and isinstance(model_info, dict):
|
||||
team_public = model_info.get("team_public_model_name")
|
||||
if team_public:
|
||||
translated_models.append(team_public)
|
||||
continue
|
||||
translated_models.append(m)
|
||||
# Remove duplicates in case multiple internal keys map to the same public name
|
||||
_team_info.models = list(dict.fromkeys(translated_models))
|
||||
|
||||
response_object = TeamInfoResponseObject(
|
||||
team_id=team_id,
|
||||
team_info=_team_info,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue