mirror of
https://github.com/tiennm99/litellm.git
synced 2026-08-06 12:22:33 +00:00
Merge pull request #21535 from BerriAI/fix/mypy-mcp-user-permissions-type-errors
fix(mypy): resolve type errors from MCP user permissions commit
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
from typing import TYPE_CHECKING
|
||||
from typing import TYPE_CHECKING, Any, Dict, cast
|
||||
|
||||
from litellm.types.guardrails import SupportedGuardrailIntegrations
|
||||
|
||||
@@ -14,7 +14,7 @@ def initialize_guardrail(litellm_params: "LitellmParams", guardrail: "Guardrail"
|
||||
# Default to always-on. Only disable if the user explicitly sets default_on: false.
|
||||
# We check the raw guardrail dict because LitellmParams normalizes None → False,
|
||||
# making it impossible to distinguish "not set" from "explicitly false" via litellm_params.
|
||||
_raw_default_on = guardrail.get("litellm_params", {}).get("default_on")
|
||||
_raw_default_on = cast(Dict[str, Any], guardrail).get("litellm_params", {}).get("default_on")
|
||||
_default_on = False if _raw_default_on is False else True
|
||||
|
||||
_callback = MCPEndUserPermissionGuardrail(
|
||||
|
||||
@@ -1349,7 +1349,7 @@ class LiteLLMCompletionResponsesConfig:
|
||||
result.append(tool) # type: ignore
|
||||
continue
|
||||
if tool.get("type") == "function":
|
||||
fn = tool.get("function") or {}
|
||||
fn: Dict[str, Any] = cast(Dict[str, Any], tool.get("function") or {})
|
||||
parameters = dict(fn.get("parameters", {}) or {})
|
||||
if not parameters or "type" not in parameters:
|
||||
parameters["type"] = "object"
|
||||
|
||||
Reference in New Issue
Block a user