mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-24 00:52:24 +00:00
fix(proxy): keep the no-model_list guard to absent reads so model_list: [] still evicts
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
parent
6da7486d7f
commit
f2f4490082
2 changed files with 28 additions and 1 deletions
|
|
@ -6498,7 +6498,7 @@ class ProxyConfig:
|
|||
if (deployment := llm_router.get_deployment(model_id=model_id)) is not None
|
||||
and deployment.model_info.db_model is False
|
||||
)
|
||||
if not model_list
|
||||
if model_list is None
|
||||
else frozenset()
|
||||
)
|
||||
if kept_config_ids:
|
||||
|
|
|
|||
|
|
@ -383,3 +383,30 @@ class TestDeleteDeploymentKeepsConfigModelsOnEmptyConfigRead:
|
|||
assert "model-a-id" in model_ids
|
||||
assert "model-b-id" not in model_ids
|
||||
assert result == frozenset({"model-a-id"})
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_delete_deployment_evicts_config_models_on_explicit_empty_model_list(self, tmp_path):
|
||||
config_file_path = str(tmp_path / "config.yaml")
|
||||
(tmp_path / "config.yaml").write_text("model_list: []\n")
|
||||
|
||||
router = self._router(
|
||||
[
|
||||
{
|
||||
"model_name": "config-model",
|
||||
"litellm_params": {"model": "gpt-4o-mini"},
|
||||
"model_info": {"id": "config-model-1"},
|
||||
},
|
||||
]
|
||||
)
|
||||
proxy_config = ProxyConfig()
|
||||
with (
|
||||
patch("litellm.proxy.proxy_server.llm_router", router), # test-quality-ok: reads module global
|
||||
patch( # test-quality-ok: reads module global
|
||||
"litellm.proxy.proxy_server.user_config_file_path",
|
||||
config_file_path,
|
||||
),
|
||||
):
|
||||
result = await proxy_config._delete_deployment(db_models=[])
|
||||
|
||||
assert router.get_model_ids() == []
|
||||
assert result == frozenset()
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue