mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-20 00:11:50 +00:00
Two independent bugs prevented post-call OpenAI Moderation guardrail results from reaching downstream logging callbacks (Langfuse, Datadog). Bug 1: process_output_response() created a throwaway request_data dict, so guardrail info written by @log_guardrail_information was discarded. Fixed by threading the real request_data from the unified guardrail dispatcher through all 13 BaseTranslation handlers, with litellm_metadata injection preserved for third-party guardrails (Zscaler, Prompt Security). Also extended to process_output_streaming_response for consistency. Bug 2: The @log_guardrail_information decorator collapsed the full moderation API response (categories, scores, flagged status) to "allow". Fixed by overriding _process_response/_process_error on OpenAIModerationGuardrail to stash and log the full response, following the established Model Armor pattern. |
||
|---|---|---|
| .. | ||
| mcp_server | ||
| out | ||
| post_call_rules.py | ||