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]
Python ai-gatewayanthropicazure-openaibedrockgatewaylangchainlitellmllmllm-gatewayllmopsmcp-gatewayopenaiopenai-proxyrustrust-aivertex-ai
fix: add missing Field import in policy_endpoints.py
Ishaan Jaffer936e04e0e1d5
diff --git a/litellm/proxy/management_endpoints/policy_endpoints.py b/litellm/proxy/management_endpoints/policy_endpoints.pyindex 6eb376e9016..8eec697462c 100644--- a/litellm/proxy/management_endpoints/policy_endpoints.py+++ b/litellm/proxy/management_endpoints/policy_endpoints.py@@ -14,7 +14,7 @@ import osfrom typing import TYPE_CHECKING, List, Literal, Optional, TypedDict, castfrom fastapi import APIRouter, Depends, HTTPException, Request-from pydantic import BaseModel+from pydantic import BaseModel, Fieldfrom litellm._logging import verbose_proxy_loggerfrom litellm.integrations.custom_guardrail import CustomGuardrail@@ -24,20 +24,21 @@ from litellm.proxy.guardrails.guardrail_registry import GuardrailRegistryfrom litellm.proxy.management_helpers.utils import management_endpoint_wrapperfrom litellm.proxy.policy_engine.policy_registry import get_policy_registryfrom litellm.proxy.policy_engine.policy_resolver import PolicyResolver-from litellm.types.proxy.policy_engine import (PolicyGuardrailsResponse,- PolicyInfoResponse,- PolicyListResponse,- PolicyMatchContext,- PolicyScopeResponse,- PolicySummaryItem,- PolicyTestResponse,- PolicyValidateRequest,- PolicyValidationResponse)+from litellm.types.proxy.policy_engine import (+ PolicyGuardrailsResponse,+ PolicyInfoResponse,+ PolicyListResponse,+ PolicyMatchContext,+ PolicyScopeResponse,+ PolicySummaryItem,+ PolicyTestResponse,+ PolicyValidateRequest,+ PolicyValidationResponse,+)from litellm.types.utils import GenericGuardrailAPIInputsif TYPE_CHECKING:- from litellm.litellm_core_utils.litellm_logging import \- Logging as LiteLLMLoggingObj+ from litellm.litellm_core_utils.litellm_logging import Logging as LiteLLMLoggingObjrouter = APIRouter()@@ -194,8 +195,7 @@ async def test_policies_and_guardrails(Returns inputs (possibly modified) and any guardrail errors so the UI can show whichguardrails failed and why."""- from litellm.litellm_core_utils.litellm_logging import \- Logging as LiteLLMLoggingObj+ from litellm.litellm_core_utils.litellm_logging import Logging as LiteLLMLoggingObjfrom litellm.proxy.proxy_server import proxy_logging_objfrom litellm.proxy.utils import handle_exception_on_proxy@@ -490,8 +490,7 @@ async def get_policy_templates(return _load_policy_templates_from_local_backup()try:- from litellm.llms.custom_httpx.http_handler import \- get_async_httpx_client+ from litellm.llms.custom_httpx.http_handler import get_async_httpx_clientfrom litellm.types.llms.custom_http import httpxSpecialProviderasync_client = get_async_httpx_client(