fix: strip provider prefix from model name in Ollama health check

Update model_params["model"] after get_llm_provider() strips the provider
prefix. This ensures health check calls to Ollama use bare model names
(e.g. "llama2") instead of prefixed names (e.g. "ollama/llama2").

Fixes BerriAI/litellm#17842
This commit is contained in:
Ethan T. 2026-03-13 13:29:22 +08:00
parent 92d39c308c
commit 9352b1d395

View file

@ -7155,6 +7155,7 @@ async def ahealth_check(
api_base=api_base_from_params,
api_key=api_key_from_params,
)
model_params["model"] = model # update model to use the provider-stripped name (e.g. "ollama/llama2" -> "llama2")
if model in litellm.model_cost and mode is None:
mode = litellm.model_cost[model].get("mode")