fix: address review and validation findings for PR 44819

This commit is contained in:
D41910 2026-10-15 01:22:12 +08:00
parent 65962a2f52
commit 88284c5ffa

View file

@ -82,9 +82,7 @@ def _store_response_cost_before_usage_flattening(completion_response: object, kw
litellm_logging_obj = litellm_logging_obj_from_kwargs(kwargs)
if litellm_logging_obj is None:
return
# cast-ok: the adapter hands back an OpenAI-shaped ModelResponse; the calculator
# accepts it as-is and only the usage fields are read.
model_response: Final = cast(ModelResponse, completion_response)
model_response: Final = cast(ModelResponse, completion_response) # cast-ok: adapter returns ModelResponse
usage: Final = getattr(model_response, "usage", None)
if not isinstance(usage, Usage):
return