From 1876272aa2dfe14585bc08e89725c7d47339ce28 Mon Sep 17 00:00:00 2001 From: shin-bot-litellm Date: Sat, 31 Jan 2026 07:20:17 +0000 Subject: [PATCH] litellm_fix(ci): combined CI fixes for timezone import, mypy types, and callback_name This commit combines multiple CI fixes: 1. Fix timezone import in proxy_server.py - Add 'timezone' to datetime imports - timezone.utc was used but not imported 2. Fix mypy type errors in transformation.py - Change Dict[str, Optional[int]] to Dict[str, int] - Values are only assigned when not None 3. Fix mypy type error in opentelemetry.py - Add fallback 'opentelemetry' for callback_name when it's None --- litellm/integrations/opentelemetry.py | 2 +- litellm/proxy/proxy_server.py | 2 +- .../litellm_completion_transformation/transformation.py | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/litellm/integrations/opentelemetry.py b/litellm/integrations/opentelemetry.py index 997dd044a65..18898be7dce 100644 --- a/litellm/integrations/opentelemetry.py +++ b/litellm/integrations/opentelemetry.py @@ -1631,7 +1631,7 @@ class OpenTelemetry(CustomLogger): ) except Exception as e: - self.handle_callback_failure(callback_name= self.callback_name) + self.handle_callback_failure(callback_name=self.callback_name or "opentelemetry") verbose_logger.exception( "OpenTelemetry logging error in set_attributes %s", str(e) ) diff --git a/litellm/proxy/proxy_server.py b/litellm/proxy/proxy_server.py index 078ce0edf27..a00f1f605a9 100644 --- a/litellm/proxy/proxy_server.py +++ b/litellm/proxy/proxy_server.py @@ -11,7 +11,7 @@ import sys import time import traceback import warnings -from datetime import datetime, timedelta +from datetime import datetime, timedelta, timezone import enum from typing import ( TYPE_CHECKING, diff --git a/litellm/responses/litellm_completion_transformation/transformation.py b/litellm/responses/litellm_completion_transformation/transformation.py index 41abbca755c..74cc87713da 100644 --- a/litellm/responses/litellm_completion_transformation/transformation.py +++ b/litellm/responses/litellm_completion_transformation/transformation.py @@ -1743,7 +1743,7 @@ class LiteLLMCompletionResponsesConfig: and usage.prompt_tokens_details is not None ): prompt_details = usage.prompt_tokens_details - input_details_dict: Dict[str, Optional[int]] = {} + input_details_dict: Dict[str, int] = {} if ( hasattr(prompt_details, "cached_tokens") @@ -1776,7 +1776,7 @@ class LiteLLMCompletionResponsesConfig: and usage.completion_tokens_details is not None ): completion_details = usage.completion_tokens_details - output_details_dict: Dict[str, Optional[int]] = {} + output_details_dict: Dict[str, int] = {} if ( hasattr(completion_details, "reasoning_tokens") and completion_details.reasoning_tokens is not None