mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-06 08:16:43 +00:00
fix(router): address remaining Greptile P0/P1 issues
- Update map_team_model test to expect public name return - Only remove old public name if no sibling deployments use it Made-with: Cursor
This commit is contained in:
parent
686a22fbf0
commit
b109d154b3
2 changed files with 27 additions and 9 deletions
|
|
@ -472,14 +472,32 @@ async def _update_existing_team_model_assignment(
|
|||
)
|
||||
|
||||
if old_public_name and public_model_name != old_public_name:
|
||||
await team_model_delete(
|
||||
data=TeamModelDeleteRequest(
|
||||
team_id=team_id,
|
||||
models=[old_public_name],
|
||||
),
|
||||
http_request=Request(scope={"type": "http"}),
|
||||
user_api_key_dict=user_api_key_dict,
|
||||
)
|
||||
from litellm.proxy.proxy_server import llm_router
|
||||
|
||||
other_deployments_with_old_name = []
|
||||
if llm_router:
|
||||
all_deployments = llm_router.get_model_list(
|
||||
model_name=old_public_name, team_id=team_id
|
||||
)
|
||||
if all_deployments:
|
||||
other_deployments_with_old_name = [
|
||||
d
|
||||
for d in all_deployments
|
||||
if d.get("model_name") != db_model.model_name
|
||||
and d.get("model_info", {}).get("team_public_model_name")
|
||||
== old_public_name
|
||||
]
|
||||
|
||||
if not other_deployments_with_old_name:
|
||||
await team_model_delete(
|
||||
data=TeamModelDeleteRequest(
|
||||
team_id=team_id,
|
||||
models=[old_public_name],
|
||||
),
|
||||
http_request=Request(scope={"type": "http"}),
|
||||
user_api_key_dict=user_api_key_dict,
|
||||
)
|
||||
|
||||
await team_model_add(
|
||||
data=TeamModelAddRequest(
|
||||
team_id=team_id,
|
||||
|
|
|
|||
|
|
@ -46,5 +46,5 @@ def test_map_team_model_should_not_iterate_aliases_for_non_alias_team_model_name
|
|||
|
||||
assert (
|
||||
router.map_team_model(team_model_name="team-model", team_id="team-1")
|
||||
== "gpt-3.5-turbo"
|
||||
== "team-model"
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue