mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-05 08:07:05 +00:00
fix: handle explicit None model_info in LowestLatencyLoggingHandler (#21633)
When model_info is explicitly set to None in litellm_params (via
get_litellm_params.py), the pattern .get("model_info", {}) returns
None instead of {}, causing AttributeError on the chained .get("id").
This commonly occurs when Anthropic API returns usage limit errors,
the router falls back to Vertex AI, and the fallback succeeds — the
log_success_event callback fires with model_info=None.
Uses the (x or {}) pattern already established in router.py.
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
d2bdf7d618
commit
0f2516e9cd
1 changed files with 3 additions and 3 deletions
|
|
@ -52,7 +52,7 @@ class LowestLatencyLoggingHandler(CustomLogger):
|
|||
"model_group", None
|
||||
)
|
||||
|
||||
id = kwargs["litellm_params"].get("model_info", {}).get("id", None)
|
||||
id = (kwargs["litellm_params"].get("model_info") or {}).get("id", None)
|
||||
if model_group is None or id is None:
|
||||
return
|
||||
elif isinstance(id, int):
|
||||
|
|
@ -204,7 +204,7 @@ class LowestLatencyLoggingHandler(CustomLogger):
|
|||
"model_group", None
|
||||
)
|
||||
|
||||
id = kwargs["litellm_params"].get("model_info", {}).get("id", None)
|
||||
id = (kwargs["litellm_params"].get("model_info") or {}).get("id", None)
|
||||
if model_group is None or id is None:
|
||||
return
|
||||
elif isinstance(id, int):
|
||||
|
|
@ -273,7 +273,7 @@ class LowestLatencyLoggingHandler(CustomLogger):
|
|||
"model_group", None
|
||||
)
|
||||
|
||||
id = kwargs["litellm_params"].get("model_info", {}).get("id", None)
|
||||
id = (kwargs["litellm_params"].get("model_info") or {}).get("id", None)
|
||||
if model_group is None or id is None:
|
||||
return
|
||||
elif isinstance(id, int):
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue