mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-10 03:28:53 +00:00
fix(guardrails): Azure prompt_shield and text_moderation now check input for Responses API
Both Azure guardrails (prompt_shield, text_moderation) only checked data["messages"] for user content. The Responses API (/v1/responses) uses data["input"] instead, causing both guardrails to silently skip with "No messages in data" warning. Fall back to data["input"] when data["messages"] is absent so guardrails run correctly for both /v1/chat/completions and /v1/responses endpoints. Fixes BerriAI/litellm#25215 Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
39c1042258
commit
487117042c
2 changed files with 2 additions and 2 deletions
|
|
@ -134,7 +134,7 @@ class AzureContentSafetyPromptShieldGuardrail(AzureGuardrailBase, CustomGuardrai
|
|||
"Azure Prompt Shield: Running pre-call prompt scan, on call_type: %s",
|
||||
call_type,
|
||||
)
|
||||
new_messages: Optional[List[AllMessageValues]] = data.get("messages")
|
||||
new_messages: Optional[List[AllMessageValues]] = data.get("messages") or data.get("input")
|
||||
if new_messages is None:
|
||||
verbose_proxy_logger.warning(
|
||||
"Azure Prompt Shield: not running guardrail. No messages in data"
|
||||
|
|
|
|||
|
|
@ -227,7 +227,7 @@ class AzureContentSafetyTextModerationGuardrail(AzureGuardrailBase, CustomGuardr
|
|||
"Azure Text Moderation: Running pre-call prompt scan, on call_type: %s",
|
||||
call_type,
|
||||
)
|
||||
new_messages: Optional[List[AllMessageValues]] = data.get("messages")
|
||||
new_messages: Optional[List[AllMessageValues]] = data.get("messages") or data.get("input")
|
||||
if new_messages is None:
|
||||
verbose_proxy_logger.warning(
|
||||
"Azure Text Moderation: not running guardrail. No messages in data"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue