From 8f7932ec5ffb454f7685f5f0526d5b86270ae4df Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Sun, 4 Oct 2026 08:42:17 +0000 Subject: [PATCH] refactor(guardrails): type directional-scope provider list as a tuple --- litellm/proxy/guardrails/guardrail_endpoints.py | 12 +++++------- litellm/types/guardrails.py | 2 +- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/litellm/proxy/guardrails/guardrail_endpoints.py b/litellm/proxy/guardrails/guardrail_endpoints.py index cca6cee8fc1..9bf371253fd 100644 --- a/litellm/proxy/guardrails/guardrail_endpoints.py +++ b/litellm/proxy/guardrails/guardrail_endpoints.py @@ -13,7 +13,7 @@ from typing import TYPE_CHECKING, Any, Final, Literal, Protocol, TypeVar, Union, from urllib.parse import urlparse from fastapi import APIRouter, Depends, HTTPException, Request -from pydantic import BaseModel, TypeAdapter, ValidationError +from pydantic import BaseModel, ValidationError from litellm._logging import verbose_proxy_logger from litellm.constants import DEFAULT_MAX_RECURSE_DEPTH @@ -1494,12 +1494,10 @@ async def get_guardrail_ui_settings() -> GuardrailUIAddGuardrailSettings: # above; it only runs on pre_call. {SupportedGuardrailIntegrations.HIDE_SECRETS.value: [GuardrailEventHooks.pre_call.value]} ) - providers_without_directional_logging_only_scope: Final = TypeAdapter(list[str]).validate_python( - tuple( - provider - for provider, guardrail_class in guardrail_class_registry.items() - if not guardrail_class.supports_logging_only_scope() - ) + providers_without_directional_logging_only_scope: Final = tuple( + provider + for provider, guardrail_class in guardrail_class_registry.items() + if not guardrail_class.supports_logging_only_scope() ) return GuardrailUIAddGuardrailSettings( diff --git a/litellm/types/guardrails.py b/litellm/types/guardrails.py index 000c602b45d..96ca8001510 100644 --- a/litellm/types/guardrails.py +++ b/litellm/types/guardrails.py @@ -1318,7 +1318,7 @@ class GuardrailUIAddGuardrailSettings(BaseModel): supported_actions: list[str] supported_modes: list[str] supported_modes_by_provider: dict[str, list[str]] - providers_without_directional_logging_only_scope: list[str] + providers_without_directional_logging_only_scope: tuple[str, ...] pii_entity_categories: list[PiiEntityCategoryMap] content_filter_settings: dict[str, object] | None = None