mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-10 22:41:41 +00:00
litellm_fix: combined code quality fixes (ruff + mypy)
This PR combines multiple code quality fixes: 1. **Ruff PLR0915** - Add noqa for base_process_llm_request (too many statements) 2. **MyPy** - Fix callback_name type error in opentelemetry.py 3. **MyPy** - Fix Dict type annotations in transformation.py 4. **MyPy** - Add missing timezone import in proxy_server.py Fixes: check_code_and_doc_quality and mypy_linting CI jobs
This commit is contained in:
parent
3f1bda57e2
commit
5f0b1be05e
5 changed files with 6 additions and 6 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -98,4 +98,4 @@ LAZY_LOADING_IMPROVEMENTS.md
|
|||
**/test-results
|
||||
**/playwright-report
|
||||
**/*.storageState.json
|
||||
**/coverage
|
||||
**/coveragelitellm/.mypy_cache/
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
)
|
||||
|
|
|
|||
|
|
@ -623,7 +623,7 @@ class ProxyBaseLLMRequestProcessing:
|
|||
|
||||
return self.data, logging_obj
|
||||
|
||||
async def base_process_llm_request(
|
||||
async def base_process_llm_request( # noqa: PLR0915
|
||||
self,
|
||||
request: Request,
|
||||
fastapi_response: Response,
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue