Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

refactor(types): move PassThroughGuardrailSettings into the pass-through types module (#45763)

nate-berri8f047e0a3334
diff --git a/litellm/llms/pass_through/guardrail_translation/handler.py b/litellm/llms/pass_through/guardrail_translation/handler.py
index fd58ca2ddbb..6e31569d421 100644
--- a/litellm/llms/pass_through/guardrail_translation/handler.py
+++ b/litellm/llms/pass_through/guardrail_translation/handler.py
@@ -12,7 +12,7 @@ from typing import TYPE_CHECKING, Any, Final, Optional
from litellm._logging import verbose_proxy_logger
from litellm.integrations.custom_guardrail import without_server_streaming_classification
from litellm.llms.base_llm.guardrail_translation.base_translation import BaseTranslation
-from litellm.proxy._types import PassThroughGuardrailSettings
+from litellm.types.passthrough_endpoints.pass_through_endpoints import PassThroughGuardrailSettings
from litellm.types.utils import GenericGuardrailAPIInputs
if TYPE_CHECKING:
diff --git a/litellm/proxy/_types.py b/litellm/proxy/_types.py
index bf62ad81f15..228e9abdf68 100644
--- a/litellm/proxy/_types.py
+++ b/litellm/proxy/_types.py
@@ -2395,22 +2395,9 @@ class DynamoDBArgs(LiteLLMPydanticObjectBase):
assume_role_aws_session_name: str | None = None
-class PassThroughGuardrailSettings(LiteLLMPydanticObjectBase):
- """
- Settings for a specific guardrail on a passthrough endpoint.
-
- Allows field-level targeting for guardrail execution.
- """
-
- request_fields: list[str] | None = Field(
- default=None,
- description="JSONPath expressions for input field targeting (pre_call). Examples: 'query', 'documents[*].text', 'messages[*].content'. If not specified, guardrail runs on entire request payload.",
- )
- response_fields: list[str] | None = Field(
- default=None,
- description="JSONPath expressions for output field targeting (post_call). Examples: 'results[*].text', 'output'. If not specified, guardrail runs on entire response payload.",
- )
-
+from litellm.types.passthrough_endpoints.pass_through_endpoints import ( # noqa: E402 # public re-export
+ PassThroughGuardrailSettings as PassThroughGuardrailSettings, # noqa: PLC0414 # public re-export
+)
# Type alias for the guardrails dict: guardrail_name -> settings (or None for defaults)
PassThroughGuardrailsConfig = dict[str, PassThroughGuardrailSettings | None]
diff --git a/litellm/types/passthrough_endpoints/pass_through_endpoints.py b/litellm/types/passthrough_endpoints/pass_through_endpoints.py
index bdfe99403a5..e634354408f 100644
--- a/litellm/types/passthrough_endpoints/pass_through_endpoints.py
+++ b/litellm/types/passthrough_endpoints/pass_through_endpoints.py
@@ -1,8 +1,11 @@
from enum import Enum
from typing import Final
+from pydantic import Field
from typing_extensions import TypedDict
+from litellm.types.llms.base import LiteLLMPydanticObjectBase
+
# Request.state key for programmatic pass-through callers (e.g. Bedrock proxy) that attach
# JSON without a FastAPI `custom_body` parameter (which would consume the HTTP body).
LITELLM_PASS_THROUGH_CUSTOM_BODY_STATE_KEY: Final = "litellm_pass_through_custom_body"
@@ -64,3 +67,20 @@ class PassthroughStandardLoggingPayload(TypedDict, total=False):
Optional field, we use this for cost tracking only if it's set.
"""
+
+
+class PassThroughGuardrailSettings(LiteLLMPydanticObjectBase):
+ """
+ Settings for a specific guardrail on a passthrough endpoint.
+
+ Allows field-level targeting for guardrail execution.
+ """
+
+ request_fields: list[str] | None = Field(
+ default=None,
+ description="JSONPath expressions for input field targeting (pre_call). Examples: 'query', 'documents[*].text', 'messages[*].content'. If not specified, guardrail runs on entire request payload.",
+ )
+ response_fields: list[str] | None = Field(
+ default=None,
+ description="JSONPath expressions for output field targeting (post_call). Examples: 'results[*].text', 'output'. If not specified, guardrail runs on entire response payload.",
+ )