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
Guardrails API - new `structured_messages` param (#17518)
Krish Dholakiab3a3081e8eec
diff --git a/cookbook/mock_guardrail_server/mock_bedrock_guardrail_server.py b/cookbook/mock_guardrail_server/mock_bedrock_guardrail_server.pyindex b5c1b3fa0c8..7bf9cc32484 100644--- a/cookbook/mock_guardrail_server/mock_bedrock_guardrail_server.py+++ b/cookbook/mock_guardrail_server/mock_bedrock_guardrail_server.py@@ -398,6 +398,7 @@ class LitellmBasicGuardrailRequest(BaseModel):input_type: Literal["request", "response"]litellm_call_id: Optional[str] = Nonelitellm_trace_id: Optional[str] = None+ structured_messages: Optional[List[Dict[str, Any]]] = Noneclass LitellmBasicGuardrailResponse(BaseModel):diff --git a/docs/my-website/docs/adding_provider/generic_guardrail_api.md b/docs/my-website/docs/adding_provider/generic_guardrail_api.mdindex f8c07b25f9d..f599d424dd2 100644--- a/docs/my-website/docs/adding_provider/generic_guardrail_api.md+++ b/docs/my-website/docs/adding_provider/generic_guardrail_api.md@@ -69,6 +69,10 @@ Implement `POST /beta/litellm_basic_guardrail_api`}}],+ "structured_messages": [ // optional, full messages in OpenAI format (for chat endpoints)+ {"role": "system", "content": "You are a helpful assistant"},+ {"role": "user", "content": "Hello"}+ ],"request_data": {"user_api_key_hash": "hash of the litellm virtual key used","user_api_key_alias": "alias of the litellm virtual key used",@@ -147,6 +151,29 @@ The `tools` parameter provides information about available function/tool definit- Log tool usage for audit purposes- Block sensitive tools based on user context+### `structured_messages` Parameter++The `structured_messages` parameter provides the full input in OpenAI chat completion spec format, useful for distinguishing between system and user messages.++**Format:** Array of OpenAI chat completion messages (see [OpenAI API reference](https://platform.openai.com/docs/api-reference/chat/create#chat-create-messages))++**Example:**+```json+[+ {"role": "system", "content": "You are a helpful assistant"},+ {"role": "user", "content": "Hello"}+]+```++**Availability:**+- **Supported endpoints:** `/v1/chat/completions`, `/v1/messages`, `/v1/responses`+- **Input only:** Only passed for `input_type="request"` (pre-call guardrails)++**Use cases:**+- Apply different policies for system vs user messages+- Enforce role-based content restrictions+- Log structured conversation context+## LiteLLM ConfigurationAdd to `config.yaml`:@@ -211,6 +238,7 @@ class GuardrailRequest(BaseModel):texts: List[str]images: Optional[List[str]] = Nonetools: Optional[List[Dict[str, Any]]] = None # OpenAI ChatCompletionToolParam format+ structured_messages: Optional[List[Dict[str, Any]]] = None # OpenAI messages format (for chat endpoints)request_data: Dict[str, Any]input_type: str # "request" or "response"litellm_call_id: Optional[str] = None@@ -247,6 +275,17 @@ async def apply_guardrail(request: GuardrailRequest):blocked_reason=f"Tool '{function_name}' is not allowed")+ # Example: Check structured messages (if present in request)+ if request.structured_messages:+ for message in request.structured_messages:+ if message.get("role") == "system":+ # Apply stricter policies to system messages+ if "admin" in message.get("content", "").lower():+ return GuardrailResponse(+ action="BLOCKED",+ blocked_reason="System message contains restricted terms"+ )+return GuardrailResponse(action="NONE")```diff --git a/litellm/llms/anthropic/chat/guardrail_translation/handler.py b/litellm/llms/anthropic/chat/guardrail_translation/handler.pyindex d8bede65f09..e1af433f23f 100644--- a/litellm/llms/anthropic/chat/guardrail_translation/handler.py+++ b/litellm/llms/anthropic/chat/guardrail_translation/handler.py@@ -22,6 +22,11 @@ from litellm.llms.anthropic.experimental_pass_through.adapters.transformation im)from litellm.llms.base_llm.guardrail_translation.base_translation import BaseTranslationfrom litellm.types.guardrails import GenericGuardrailAPIInputs+from litellm.types.llms.anthropic import (+ AllAnthropicToolsValues,+ AnthropicMessagesRequest,+)+from litellm.types.llms.openai import ChatCompletionToolParamfrom litellm.types.llms.anthropic import AllAnthropicToolsValuesfrom litellm.types.llms.openai import (ChatCompletionToolCallChunk,@@ -65,9 +70,19 @@ class AnthropicMessagesHandler(BaseTranslation):if messages is None:return data+ chat_completion_compatible_request = (+ LiteLLMAnthropicMessagesAdapter().translate_anthropic_to_openai(+ anthropic_message_request=cast(AnthropicMessagesRequest, data)+ )+ )++ structured_messages = chat_completion_compatible_request.get("messages", [])+texts_to_check: List[str] = []images_to_check: List[str] = []- tools_to_check: List[ChatCompletionToolParam] = []+ tools_to_check: List[ChatCompletionToolParam] = (+ chat_completion_compatible_request.get("tools", [])+ )task_mappings: List[Tuple[int, Optional[int]]] = []# Track (message_index, content_index) for each text# content_index is None for string content, int for list content@@ -82,12 +97,6 @@ class AnthropicMessagesHandler(BaseTranslation):task_mappings=task_mappings,)- if tools is not None:- self._extract_input_tools(- tools=tools,- tools_to_check=tools_to_check,- )-# Step 2: Apply guardrail to all texts in batchif texts_to_check:inputs = GenericGuardrailAPIInputs(texts=texts_to_check)@@ -95,6 +104,8 @@ class AnthropicMessagesHandler(BaseTranslation):inputs["images"] = images_to_checkif tools_to_check:inputs["tools"] = tools_to_check+ if structured_messages:+ inputs["structured_messages"] = structured_messagesguardrailed_inputs = await guardrail_to_apply.apply_guardrail(inputs=inputs,request_data=data,diff --git a/litellm/llms/openai/chat/guardrail_translation/handler.py b/litellm/llms/openai/chat/guardrail_translation/handler.pyindex 463b50beb5c..aa2580453a8 100644--- a/litellm/llms/openai/chat/guardrail_translation/handler.py+++ b/litellm/llms/openai/chat/guardrail_translation/handler.py@@ -80,6 +80,10 @@ class OpenAIChatCompletionsHandler(BaseTranslation):inputs["images"] = images_to_checkif tool_calls_to_check:inputs["tool_calls"] = tool_calls_to_check # type: ignore+ if messages:+ inputs["structured_messages"] = (+ messages # pass the openai /chat/completions messages to the guardrail, as-is+ )guardrailed_inputs = await guardrail_to_apply.apply_guardrail(inputs=inputs,diff --git a/litellm/llms/openai/responses/guardrail_translation/handler.py b/litellm/llms/openai/responses/guardrail_translation/handler.pyindex 2ab37f061fd..0fdea47415f 100644--- a/litellm/llms/openai/responses/guardrail_translation/handler.py+++ b/litellm/llms/openai/responses/guardrail_translation/handler.py@@ -81,6 +81,13 @@ class OpenAIResponsesHandler(BaseTranslation):if input_data is None:return data+ structured_messages = (+ LiteLLMCompletionResponsesConfig.transform_responses_api_input_to_messages(+ input=input_data,+ responses_api_request=data,+ )+ )+# Handle simple string inputif isinstance(input_data, str):inputs = GenericGuardrailAPIInputs(texts=[input_data])@@ -91,6 +98,8 @@ class OpenAIResponsesHandler(BaseTranslation):self._extract_and_transform_tools(data["tools"], tools_to_check)if tools_to_check:inputs["tools"] = tools_to_check+ if structured_messages:+ inputs["structured_messages"] = structured_messages # type: ignoreguardrailed_inputs = await guardrail_to_apply.apply_guardrail(inputs=inputs,@@ -134,6 +143,8 @@ class OpenAIResponsesHandler(BaseTranslation):inputs["images"] = images_to_checkif tools_to_check:inputs["tools"] = tools_to_check+ if structured_messages:+ inputs["structured_messages"] = structured_messages # type: ignoreguardrailed_inputs = await guardrail_to_apply.apply_guardrail(inputs=inputs,request_data=data,diff --git a/litellm/proxy/_experimental/out/api-reference.html b/litellm/proxy/_experimental/out/api-reference/index.htmlsimilarity index 100%rename from litellm/proxy/_experimental/out/api-reference.htmlrename to litellm/proxy/_experimental/out/api-reference/index.htmldiff --git a/litellm/proxy/_experimental/out/guardrails.html b/litellm/proxy/_experimental/out/guardrails.htmldeleted file mode 100644index d10f6fdaf8d..00000000000--- a/litellm/proxy/_experimental/out/guardrails.html+++ /dev/null@@ -1 +0,0 @@-<!DOCTYPE html><html id="__next_error__"><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="preload" as="script" fetchPriority="low" href="/litellm-asset-prefix/_next/static/chunks/webpack-134f5d194761e240.js"/><script src="/litellm-asset-prefix/_next/static/chunks/fd9d1056-a07bacd8fcc2728b.js" async=""></script><script src="/litellm-asset-prefix/_next/static/chunks/2117-bb4323b3c0b11a1f.js" async=""></script><script src="/litellm-asset-prefix/_next/static/chunks/main-app-77a6ca3c04ee9adf.js" async=""></script><title>LiteLLM Dashboard</title><meta name="description" content="LiteLLM Proxy Admin UI"/><link rel="icon" href="/favicon.ico" type="image/x-icon" sizes="16x16"/><link rel="icon" href="./favicon.ico"/><meta name="next-size-adjust"/><script src="/litellm-asset-prefix/_next/static/chunks/polyfills-42372ed130431b0a.js" noModule=""></script></head><body><script src="/litellm-asset-prefix/_next/static/chunks/webpack-134f5d194761e240.js" async=""></script><script>(self.__next_f=self.__next_f||[]).push([0]);self.__next_f.push([2,null])</script><script>self.__next_f.push([1,"1:HL[\"/litellm-asset-prefix/_next/static/media/e4af272ccee01ff0-s.p.woff2\",\"font\",{\"crossOrigin\":\"\",\"type\":\"font/woff2\"}]\n2:HL[\"/litellm-asset-prefix/_next/static/css/349654da14372cd9.css\",\"style\"]\n3:HL[\"/litellm-asset-prefix/_next/static/css/83d5023e5c1838fe.css\",\"style\"]\n"])</script><script>self.__next_f.push([1,"4:I[12846,[],\"\"]\n6:I[19107,[],\"ClientPageRoot\"]\n7:I[49514,[\"9028\",\"static/chunks/9028-2bfc9f09930a0d61.js\",\"9409\",\"static/chunks/9409-1929f646c1a44e2b.js\",\"4865\",\"static/chunks/4865-c1c0885a93c327fa.js\",\"337\",\"static/chunks/337-bb33d149e9f461b3.js\",\"8135\",\"static/chunks/8135-269532e44b9e1cc0.js\",\"1442\",\"static/chunks/1442-024f7e51804e0d7e.js\",\"2926\",\"static/chunks/2926-a9cb83e61fc8ad20.js\",\"2409\",\"static/chunks/2409-79fdc0573d81b0e4.js\",\"3367\",\"static/chunks/3367-33bb84b3d3d247b2.js\",\"353\",\"static/chunks/353-e55516ea4730f9d4.js\",\"1994\",\"static/chunks/1994-a4d0b99849c16b62.js\",\"7318\",\"static/chunks/7318-c50027425e9c9b90.js\",\"3705\",\"static/chunks/3705-1dcdbda1985a6786.js\",\"8565\",\"static/chunks/8565-5c05f6bbb9d0662f.js\",\"3709\",\"static/chunks/3709-34dbb332d3a3ac26.js\",\"5319\",\"static/chunks/5319-5b2d4bf2dc450f99.js\",\"525\",\"static/chunks/525-b324fffe907a950d.js\",\"6609\",\"static/chunks/6609-2ab6b0b5a3184f98.js\",\"5869\",\"static/chunks/5869-1bf16ccc36c11fdf.js\",\"4546\",\"static/chunks/4546-af35d1c0ff12244b.js\",\"8468\",\"static/chunks/8468-27ea05e25918ba32.js\",\"5945\",\"static/chunks/5945-8b3b7713d7f416a2.js\",\"5458\",\"static/chunks/5458-16bb926d82ad4bf2.js\",\"8049\",\"static/chunks/8049-7e649ed7fd33f9a4.js\",\"630\",\"static/chunks/630-84f939b9d5c498f8.js\",\"6607\",\"static/chunks/app/(dashboard)/guardrails/page-b19ec0d898a6b0ce.js\"],\"default\",1]\n8:I[4707,[],\"\"]\n9:I[36423,[],\"\"]\na:I[53104,[\"9028\",\"static/chunks/9028-2bfc9f09930a0d61.js\",\"9409\",\"static/chunks/9409-1929f646c1a44e2b.js\",\"4865\",\"static/chunks/4865-c1c0885a93c327fa.js\",\"3367\",\"static/chunks/3367-33bb84b3d3d247b2.js\",\"3705\",\"static/chunks/3705-1dcdbda1985a6786.js\",\"7140\",\"static/chunks/7140-937050711ba264d3.js\",\"7941\",\"static/chunks/7941-c02dc43abfb07ee7.js\",\"8049\",\"static/chunks/8049-7e649ed7fd33f9a4.js\",\"5642\",\"static/chunks/app/(dashboard)/layout-2ae9b739c939bec1.js\"],\"default\",1]\n11:I[61060,[],\"\"]\nb:{}\nc:{\"fontFamily\":\"system-ui,\\\"Segoe UI\\\",Roboto,Helvetica,Arial,sans-serif,\\\"Apple Color Emoji\\\",\\\"Segoe UI Emoji\\\"\",\"height\":\"100vh\",\"textAlign\":\"center\",\"display\":\"flex\",\"flexD"])</script><script>self.__next_f.push([1,"irection\":\"column\",\"alignItems\":\"center\",\"justifyContent\":\"center\"}\nd:{\"display\":\"inline-block\",\"margin\":\"0 20px 0 0\",\"padding\":\"0 23px 0 0\",\"fontSize\":24,\"fontWeight\":500,\"verticalAlign\":\"top\",\"lineHeight\":\"49px\"}\ne:{\"display\":\"inline-block\"}\nf:{\"fontSize\":14,\"fontWeight\":400,\"lineHeight\":\"49px\",\"margin\":0}\n12:[]\n"])</script><script>self.__next_f.push([1,"0:[\"$\",\"$L4\",null,{\"buildId\":\"62Q_aEBtV1y_OBZw06lMc\",\"assetPrefix\":\"/litellm-asset-prefix\",\"urlParts\":[\"\",\"guardrails\"],\"initialTree\":[\"\",{\"children\":[\"(dashboard)\",{\"children\":[\"guardrails\",{\"children\":[\"__PAGE__\",{}]}]}]},\"$undefined\",\"$undefined\",true],\"initialSeedData\":[\"\",{\"children\":[\"(dashboard)\",{\"children\":[\"guardrails\",{\"children\":[\"__PAGE__\",{},[[\"$L5\",[\"$\",\"$L6\",null,{\"props\":{\"params\":{},\"searchParams\":{}},\"Component\":\"$7\"}],null],null],null]},[null,[\"$\",\"$L8\",null,{\"parallelRouterKey\":\"children\",\"segmentPath\":[\"children\",\"(dashboard)\",\"children\",\"guardrails\",\"children\"],\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L9\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":\"$undefined\",\"notFoundStyles\":\"$undefined\"}]],null]},[[null,[\"$\",\"$La\",null,{\"children\":[\"$\",\"$L8\",null,{\"parallelRouterKey\":\"children\",\"segmentPath\":[\"children\",\"(dashboard)\",\"children\"],\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L9\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":[[\"$\",\"title\",null,{\"children\":\"404: This page could not be found.\"}],[\"$\",\"div\",null,{\"style\":{\"fontFamily\":\"system-ui,\\\"Segoe UI\\\",Roboto,Helvetica,Arial,sans-serif,\\\"Apple Color Emoji\\\",\\\"Segoe UI Emoji\\\"\",\"height\":\"100vh\",\"textAlign\":\"center\",\"display\":\"flex\",\"flexDirection\":\"column\",\"alignItems\":\"center\",\"justifyContent\":\"center\"},\"children\":[\"$\",\"div\",null,{\"children\":[[\"$\",\"style\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}\"}}],[\"$\",\"h1\",null,{\"className\":\"next-error-h1\",\"style\":{\"display\":\"inline-block\",\"margin\":\"0 20px 0 0\",\"padding\":\"0 23px 0 0\",\"fontSize\":24,\"fontWeight\":500,\"verticalAlign\":\"top\",\"lineHeight\":\"49px\"},\"children\":\"404\"}],[\"$\",\"div\",null,{\"style\":{\"display\":\"inline-block\"},\"children\":[\"$\",\"h2\",null,{\"style\":{\"fontSize\":14,\"fontWeight\":400,\"lineHeight\":\"49px\",\"margin\":0},\"children\":\"This page could not be found.\"}]}]]}]}]],\"notFoundStyles\":[]}],\"params\":\"$b\"}]],null],null]},[[[[\"$\",\"link\",\"0\",{\"rel\":\"stylesheet\",\"href\":\"/litellm-asset-prefix/_next/static/css/349654da14372cd9.css\",\"precedence\":\"next\",\"crossOrigin\":\"$undefined\"}],[\"$\",\"link\",\"1\",{\"rel\":\"stylesheet\",\"href\":\"/litellm-asset-prefix/_next/static/css/83d5023e5c1838fe.css\",\"precedence\":\"next\",\"crossOrigin\":\"$undefined\"}]],[\"$\",\"html\",null,{\"lang\":\"en\",\"children\":[\"$\",\"body\",null,{\"className\":\"__className_1c856b\",\"children\":[\"$\",\"$L8\",null,{\"parallelRouterKey\":\"children\",\"segmentPath\":[\"children\"],\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L9\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":[[\"$\",\"title\",null,{\"children\":\"404: This page could not be found.\"}],[\"$\",\"div\",null,{\"style\":\"$c\",\"children\":[\"$\",\"div\",null,{\"children\":[[\"$\",\"style\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}\"}}],[\"$\",\"h1\",null,{\"className\":\"next-error-h1\",\"style\":\"$d\",\"children\":\"404\"}],[\"$\",\"div\",null,{\"style\":\"$e\",\"children\":[\"$\",\"h2\",null,{\"style\":\"$f\",\"children\":\"This page could not be found.\"}]}]]}]}]],\"notFoundStyles\":[]}]}]}]],null],null],\"couldBeIntercepted\":false,\"initialHead\":[null,\"$L10\"],\"globalErrorComponent\":\"$11\",\"missingSlots\":\"$W12\"}]\n"])</script><script>self.__next_f.push([1,"10:[[\"$\",\"meta\",\"0\",{\"name\":\"viewport\",\"content\":\"width=device-width, initial-scale=1\"}],[\"$\",\"meta\",\"1\",{\"charSet\":\"utf-8\"}],[\"$\",\"title\",\"2\",{\"children\":\"LiteLLM Dashboard\"}],[\"$\",\"meta\",\"3\",{\"name\":\"description\",\"content\":\"LiteLLM Proxy Admin UI\"}],[\"$\",\"link\",\"4\",{\"rel\":\"icon\",\"href\":\"/favicon.ico\",\"type\":\"image/x-icon\",\"sizes\":\"16x16\"}],[\"$\",\"link\",\"5\",{\"rel\":\"icon\",\"href\":\"./favicon.ico\"}],[\"$\",\"meta\",\"6\",{\"name\":\"next-size-adjust\"}]]\n5:null\n"])</script></body></html>\ No newline at end of filediff --git a/litellm/proxy/_experimental/out/login.html b/litellm/proxy/_experimental/out/login/index.htmlsimilarity index 100%rename from litellm/proxy/_experimental/out/login.htmlrename to litellm/proxy/_experimental/out/login/index.htmldiff --git a/litellm/proxy/_experimental/out/logs.html b/litellm/proxy/_experimental/out/logs/index.htmlsimilarity index 100%rename from litellm/proxy/_experimental/out/logs.htmlrename to litellm/proxy/_experimental/out/logs/index.htmldiff --git a/litellm/proxy/_experimental/out/model-hub.html b/litellm/proxy/_experimental/out/model-hub/index.htmlsimilarity index 100%rename from litellm/proxy/_experimental/out/model-hub.htmlrename to litellm/proxy/_experimental/out/model-hub/index.htmldiff --git a/litellm/proxy/_experimental/out/model_hub_table.html b/litellm/proxy/_experimental/out/model_hub_table/index.htmlsimilarity index 100%rename from litellm/proxy/_experimental/out/model_hub_table.htmlrename to litellm/proxy/_experimental/out/model_hub_table/index.htmldiff --git a/litellm/proxy/_experimental/out/models-and-endpoints.html b/litellm/proxy/_experimental/out/models-and-endpoints/index.htmlsimilarity index 100%rename from litellm/proxy/_experimental/out/models-and-endpoints.htmlrename to litellm/proxy/_experimental/out/models-and-endpoints/index.htmldiff --git a/litellm/proxy/_experimental/out/onboarding.html b/litellm/proxy/_experimental/out/onboarding.htmldeleted file mode 100644index 7da5d460163..00000000000--- a/litellm/proxy/_experimental/out/onboarding.html+++ /dev/null@@ -1 +0,0 @@-<!DOCTYPE html><html id="__next_error__"><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="preload" as="script" fetchPriority="low" href="/litellm-asset-prefix/_next/static/chunks/webpack-134f5d194761e240.js"/><script src="/litellm-asset-prefix/_next/static/chunks/fd9d1056-a07bacd8fcc2728b.js" async=""></script><script src="/litellm-asset-prefix/_next/static/chunks/2117-bb4323b3c0b11a1f.js" async=""></script><script src="/litellm-asset-prefix/_next/static/chunks/main-app-77a6ca3c04ee9adf.js" async=""></script><title>LiteLLM Dashboard</title><meta name="description" content="LiteLLM Proxy Admin UI"/><link rel="icon" href="/favicon.ico" type="image/x-icon" sizes="16x16"/><link rel="icon" href="./favicon.ico"/><meta name="next-size-adjust"/><script src="/litellm-asset-prefix/_next/static/chunks/polyfills-42372ed130431b0a.js" noModule=""></script></head><body><script src="/litellm-asset-prefix/_next/static/chunks/webpack-134f5d194761e240.js" async=""></script><script>(self.__next_f=self.__next_f||[]).push([0]);self.__next_f.push([2,null])</script><script>self.__next_f.push([1,"1:HL[\"/litellm-asset-prefix/_next/static/media/e4af272ccee01ff0-s.p.woff2\",\"font\",{\"crossOrigin\":\"\",\"type\":\"font/woff2\"}]\n2:HL[\"/litellm-asset-prefix/_next/static/css/349654da14372cd9.css\",\"style\"]\n3:HL[\"/litellm-asset-prefix/_next/static/css/83d5023e5c1838fe.css\",\"style\"]\n"])</script><script>self.__next_f.push([1,"4:I[12846,[],\"\"]\n6:I[19107,[],\"ClientPageRoot\"]\n7:I[12011,[\"3665\",\"static/chunks/3014691f-ba91873bc8fe3fad.js\",\"9028\",\"static/chunks/9028-2bfc9f09930a0d61.js\",\"9409\",\"static/chunks/9409-1929f646c1a44e2b.js\",\"4865\",\"static/chunks/4865-c1c0885a93c327fa.js\",\"2901\",\"static/chunks/2901-0cdd0656eb7463d6.js\",\"8049\",\"static/chunks/8049-7e649ed7fd33f9a4.js\",\"8461\",\"static/chunks/app/onboarding/page-b8a970754f478199.js\"],\"default\",1]\n8:I[4707,[],\"\"]\n9:I[36423,[],\"\"]\nb:I[61060,[],\"\"]\nc:[]\n"])</script><script>self.__next_f.push([1,"0:[\"$\",\"$L4\",null,{\"buildId\":\"62Q_aEBtV1y_OBZw06lMc\",\"assetPrefix\":\"/litellm-asset-prefix\",\"urlParts\":[\"\",\"onboarding\"],\"initialTree\":[\"\",{\"children\":[\"onboarding\",{\"children\":[\"__PAGE__\",{}]}]},\"$undefined\",\"$undefined\",true],\"initialSeedData\":[\"\",{\"children\":[\"onboarding\",{\"children\":[\"__PAGE__\",{},[[\"$L5\",[\"$\",\"$L6\",null,{\"props\":{\"params\":{},\"searchParams\":{}},\"Component\":\"$7\"}],null],null],null]},[null,[\"$\",\"$L8\",null,{\"parallelRouterKey\":\"children\",\"segmentPath\":[\"children\",\"onboarding\",\"children\"],\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L9\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":\"$undefined\",\"notFoundStyles\":\"$undefined\"}]],null]},[[[[\"$\",\"link\",\"0\",{\"rel\":\"stylesheet\",\"href\":\"/litellm-asset-prefix/_next/static/css/349654da14372cd9.css\",\"precedence\":\"next\",\"crossOrigin\":\"$undefined\"}],[\"$\",\"link\",\"1\",{\"rel\":\"stylesheet\",\"href\":\"/litellm-asset-prefix/_next/static/css/83d5023e5c1838fe.css\",\"precedence\":\"next\",\"crossOrigin\":\"$undefined\"}]],[\"$\",\"html\",null,{\"lang\":\"en\",\"children\":[\"$\",\"body\",null,{\"className\":\"__className_1c856b\",\"children\":[\"$\",\"$L8\",null,{\"parallelRouterKey\":\"children\",\"segmentPath\":[\"children\"],\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L9\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":[[\"$\",\"title\",null,{\"children\":\"404: This page could not be found.\"}],[\"$\",\"div\",null,{\"style\":{\"fontFamily\":\"system-ui,\\\"Segoe UI\\\",Roboto,Helvetica,Arial,sans-serif,\\\"Apple Color Emoji\\\",\\\"Segoe UI Emoji\\\"\",\"height\":\"100vh\",\"textAlign\":\"center\",\"display\":\"flex\",\"flexDirection\":\"column\",\"alignItems\":\"center\",\"justifyContent\":\"center\"},\"children\":[\"$\",\"div\",null,{\"children\":[[\"$\",\"style\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}\"}}],[\"$\",\"h1\",null,{\"className\":\"next-error-h1\",\"style\":{\"display\":\"inline-block\",\"margin\":\"0 20px 0 0\",\"padding\":\"0 23px 0 0\",\"fontSize\":24,\"fontWeight\":500,\"verticalAlign\":\"top\",\"lineHeight\":\"49px\"},\"children\":\"404\"}],[\"$\",\"div\",null,{\"style\":{\"display\":\"inline-block\"},\"children\":[\"$\",\"h2\",null,{\"style\":{\"fontSize\":14,\"fontWeight\":400,\"lineHeight\":\"49px\",\"margin\":0},\"children\":\"This page could not be found.\"}]}]]}]}]],\"notFoundStyles\":[]}]}]}]],null],null],\"couldBeIntercepted\":false,\"initialHead\":[null,\"$La\"],\"globalErrorComponent\":\"$b\",\"missingSlots\":\"$Wc\"}]\n"])</script><script>self.__next_f.push([1,"a:[[\"$\",\"meta\",\"0\",{\"name\":\"viewport\",\"content\":\"width=device-width, initial-scale=1\"}],[\"$\",\"meta\",\"1\",{\"charSet\":\"utf-8\"}],[\"$\",\"title\",\"2\",{\"children\":\"LiteLLM Dashboard\"}],[\"$\",\"meta\",\"3\",{\"name\":\"description\",\"content\":\"LiteLLM Proxy Admin UI\"}],[\"$\",\"link\",\"4\",{\"rel\":\"icon\",\"href\":\"/favicon.ico\",\"type\":\"image/x-icon\",\"sizes\":\"16x16\"}],[\"$\",\"link\",\"5\",{\"rel\":\"icon\",\"href\":\"./favicon.ico\"}],[\"$\",\"meta\",\"6\",{\"name\":\"next-size-adjust\"}]]\n5:null\n"])</script></body></html>\ No newline at end of filediff --git a/litellm/proxy/_experimental/out/organizations.html b/litellm/proxy/_experimental/out/organizations/index.htmlsimilarity index 100%rename from litellm/proxy/_experimental/out/organizations.htmlrename to litellm/proxy/_experimental/out/organizations/index.htmldiff --git a/litellm/proxy/_experimental/out/playground.html b/litellm/proxy/_experimental/out/playground/index.htmlsimilarity index 100%rename from litellm/proxy/_experimental/out/playground.htmlrename to litellm/proxy/_experimental/out/playground/index.htmldiff --git a/litellm/proxy/_experimental/out/teams.html b/litellm/proxy/_experimental/out/teams/index.htmlsimilarity index 100%rename from litellm/proxy/_experimental/out/teams.htmlrename to litellm/proxy/_experimental/out/teams/index.htmldiff --git a/litellm/proxy/_experimental/out/test-key.html b/litellm/proxy/_experimental/out/test-key/index.htmlsimilarity index 100%rename from litellm/proxy/_experimental/out/test-key.htmlrename to litellm/proxy/_experimental/out/test-key/index.htmldiff --git a/litellm/proxy/_experimental/out/usage.html b/litellm/proxy/_experimental/out/usage/index.htmlsimilarity index 100%rename from litellm/proxy/_experimental/out/usage.htmlrename to litellm/proxy/_experimental/out/usage/index.htmldiff --git a/litellm/proxy/_experimental/out/users.html b/litellm/proxy/_experimental/out/users/index.htmlsimilarity index 100%rename from litellm/proxy/_experimental/out/users.htmlrename to litellm/proxy/_experimental/out/users/index.htmldiff --git a/litellm/proxy/_experimental/out/virtual-keys.html b/litellm/proxy/_experimental/out/virtual-keys/index.htmlsimilarity index 100%rename from litellm/proxy/_experimental/out/virtual-keys.htmlrename to litellm/proxy/_experimental/out/virtual-keys/index.htmldiff --git a/litellm/proxy/_new_secret_config.yaml b/litellm/proxy/_new_secret_config.yamlindex f763615c67b..6c21b29fc53 100644--- a/litellm/proxy/_new_secret_config.yaml+++ b/litellm/proxy/_new_secret_config.yaml@@ -15,7 +15,7 @@ guardrails:- guardrail_name: generic-guardraillitellm_params:guardrail: generic_guardrail_api- mode: ["post_call"]+ mode: ["pre_call"]headers:Authorization: Bearer mock-bedrock-token-12345api_base: http://localhost:8080diff --git a/litellm/proxy/guardrails/guardrail_hooks/generic_guardrail_api/generic_guardrail_api.py b/litellm/proxy/guardrails/guardrail_hooks/generic_guardrail_api/generic_guardrail_api.pyindex 93cbe1c0bba..c7b4f19a089 100644--- a/litellm/proxy/guardrails/guardrail_hooks/generic_guardrail_api/generic_guardrail_api.py+++ b/litellm/proxy/guardrails/guardrail_hooks/generic_guardrail_api/generic_guardrail_api.py@@ -175,6 +175,7 @@ class GenericGuardrailAPI(CustomGuardrail):texts = inputs.get("texts", [])images = inputs.get("images")tools = inputs.get("tools")+ structured_messages = inputs.get("structured_messages")tool_calls = inputs.get("tool_calls")# Use provided request_data or create an empty dict@@ -202,6 +203,7 @@ class GenericGuardrailAPI(CustomGuardrail):request_data=user_metadata,images=images,tools=tools,+ structured_messages=structured_messages,tool_calls=tool_calls,additional_provider_specific_params=additional_params,input_type=input_type,diff --git a/litellm/types/guardrails.py b/litellm/types/guardrails.pyindex da9b591de28..9abb7b3443e 100644--- a/litellm/types/guardrails.py+++ b/litellm/types/guardrails.py@@ -5,6 +5,7 @@ from typing import Any, Dict, List, Literal, Optional, Unionfrom pydantic import BaseModel, ConfigDict, Fieldfrom typing_extensions import Required, TypedDict+from litellm.types.llms.openai import AllMessageValues, ChatCompletionToolParamfrom litellm.types.llms.openai import (AllMessageValues,ChatCompletionToolCallChunk,diff --git a/litellm/types/proxy/guardrails/guardrail_hooks/generic_guardrail_api.py b/litellm/types/proxy/guardrails/guardrail_hooks/generic_guardrail_api.pyindex 31b61101973..a99ed9fa414 100644--- a/litellm/types/proxy/guardrails/guardrail_hooks/generic_guardrail_api.py+++ b/litellm/types/proxy/guardrails/guardrail_hooks/generic_guardrail_api.py@@ -3,6 +3,7 @@ from typing import Any, Dict, List, Literal, Optionalfrom pydantic import BaseModel, Fieldfrom typing_extensions import TypedDict+from litellm.types.llms.openai import AllMessageValues, ChatCompletionToolParamfrom litellm.types.llms.openai import (ChatCompletionToolCallChunk,ChatCompletionToolParam,@@ -53,11 +54,12 @@ class GenericGuardrailAPIRequest(BaseModel):litellm_trace_id: Optional[str] # the trace id of the LLM call - useful if there are multiple LLM calls for the same conversation- texts: List[str]- request_data: GenericGuardrailAPIMetadata- additional_provider_specific_params: Optional[Dict[str, Any]]+ structured_messages: Optional[List[AllMessageValues]]images: Optional[List[str]]tools: Optional[List[ChatCompletionToolParam]]+ texts: Optional[List[str]]+ request_data: GenericGuardrailAPIMetadata+ additional_provider_specific_params: Optional[Dict[str, Any]]tool_calls: Optional[List[ChatCompletionToolCallChunk]]