mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-16 23:41:43 +00:00
fix(ci): fix mypy type ignores, MCP test mocks, model prices schema
- Fix mypy: use correct error codes [typeddict-item] instead of [misc], remove variable redefinition in spend_log_cleanup, use type: ignore for cost_tracking_settings assignment - Fix MCP tests: add tool_name_to_display_name and tool_name_to_description dict fields to mock objects for test_add_update_server_with_alias and test_add_update_server_fallback_to_server_id - Fix model prices schema: add 'realtime' to allowed mode enum for gemini-live models Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
b7f2c7648e
commit
2ebaa32d1c
6 changed files with 10 additions and 5 deletions
|
|
@ -131,7 +131,7 @@ class SpendLogCleanup:
|
|||
|
||||
# If we have a pod lock manager, try to acquire the lock
|
||||
if self.pod_lock_manager and self.pod_lock_manager.redis_cache:
|
||||
lock_acquired: bool = await self.pod_lock_manager.acquire_lock(
|
||||
lock_acquired = await self.pod_lock_manager.acquire_lock(
|
||||
cronjob_id=SPEND_LOG_CLEANUP_JOB_NAME,
|
||||
) or False
|
||||
verbose_proxy_logger.info(
|
||||
|
|
|
|||
|
|
@ -98,7 +98,7 @@ class AzureContentSafetyPromptShieldGuardrail(AzureGuardrailBase, CustomGuardrai
|
|||
"text:shieldPrompt", cast(dict, request_body)
|
||||
)
|
||||
|
||||
last_response = AzurePromptShieldGuardrailResponse(**response_json) # type: ignore[misc]
|
||||
last_response = AzurePromptShieldGuardrailResponse(**response_json) # type: ignore[typeddict-item]
|
||||
|
||||
if last_response["userPromptAnalysis"].get("attackDetected"):
|
||||
verbose_proxy_logger.warning(
|
||||
|
|
|
|||
|
|
@ -125,13 +125,13 @@ class AzureContentSafetyTextModerationGuardrail(AzureGuardrailBase, CustomGuardr
|
|||
for chunk in chunks:
|
||||
request_body = AzureTextModerationGuardrailRequestBody(
|
||||
text=chunk,
|
||||
**self.optional_params_request_body, # type: ignore[misc]
|
||||
**self.optional_params_request_body, # type: ignore[typeddict-item]
|
||||
)
|
||||
response_json = await self._post_to_content_safety(
|
||||
"text:analyze", cast(dict, request_body)
|
||||
)
|
||||
|
||||
chunk_response = AzureTextModerationGuardrailResponse(**response_json) # type: ignore[misc]
|
||||
chunk_response = AzureTextModerationGuardrailResponse(**response_json) # type: ignore[typeddict-item]
|
||||
|
||||
# For multi-chunk texts the callers only see the final response,
|
||||
# so we must check every intermediate chunk here to avoid silently
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ def _resolve_model_for_cost_lookup(model: str) -> Tuple[str, Optional[str]]:
|
|||
model_info = first_deployment.get("model_info", {})
|
||||
|
||||
# Check base_model first (needed for Azure custom deployment names)
|
||||
base_model: Optional[str] = model_info.get("base_model") or litellm_params.get(
|
||||
base_model = model_info.get("base_model") or litellm_params.get( # type: ignore[assignment]
|
||||
"base_model"
|
||||
)
|
||||
if base_model:
|
||||
|
|
|
|||
|
|
@ -1465,6 +1465,8 @@ async def test_add_update_server_with_alias():
|
|||
mock_mcp_server.args = []
|
||||
mock_mcp_server.env = None
|
||||
mock_mcp_server.spec_path = None
|
||||
mock_mcp_server.tool_name_to_display_name = {}
|
||||
mock_mcp_server.tool_name_to_description = {}
|
||||
# OAuth fields - set explicitly to None to avoid MagicMock objects
|
||||
mock_mcp_server.client_id = None
|
||||
mock_mcp_server.client_secret = None
|
||||
|
|
@ -1547,6 +1549,8 @@ async def test_add_update_server_fallback_to_server_id():
|
|||
mock_mcp_server.args = []
|
||||
mock_mcp_server.env = None
|
||||
mock_mcp_server.spec_path = None
|
||||
mock_mcp_server.tool_name_to_display_name = {}
|
||||
mock_mcp_server.tool_name_to_description = {}
|
||||
# OAuth fields - set explicitly to None to avoid MagicMock objects
|
||||
mock_mcp_server.client_id = None
|
||||
mock_mcp_server.client_secret = None
|
||||
|
|
|
|||
|
|
@ -676,6 +676,7 @@ def test_aaamodel_prices_and_context_window_json_is_valid():
|
|||
"image_generation",
|
||||
"video_generation",
|
||||
"moderation",
|
||||
"realtime",
|
||||
"rerank",
|
||||
"responses",
|
||||
"ocr",
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue