Skip to content

[Feat] Add Tracing for guardrails in StandardLoggingPayload, Langfuse#10890

Merged
ishaan-jaff merged 15 commits intomainfrom
litellm_tracing_guardrails
May 16, 2025
Merged

[Feat] Add Tracing for guardrails in StandardLoggingPayload, Langfuse#10890
ishaan-jaff merged 15 commits intomainfrom
litellm_tracing_guardrails

Conversation

@ishaan-jaff
Copy link
Member

@ishaan-jaff ishaan-jaff commented May 16, 2025

[Feat] Add Tracing for guardrails in StandardLoggingPayload, Langfuse

  • This PR adds tracing for guardrails in the StandardLoggingPayload by updating the logging payload structure and the related guardrail processing logic as well as adding test coverage.
  • Adds guardrail tracing in Langfuse
Xnapper-2025-05-16-09 46 51

Relevant issues

Pre-Submission checklist

Please complete all items before asking a LiteLLM maintainer to review your PR

  • I have Added testing in the tests/litellm/ directory, Adding at least 1 test is a hard requirement - see details
  • I have added a screenshot of my new test passing locally
  • My PR passes all unit tests on make test-unit
  • My PR's scope is as isolated as possible, it only solves 1 specific problem

Type

🆕 New Feature
✅ Test

Changes

@ishaan-jaff ishaan-jaff requested a review from Copilot May 16, 2025 15:54
@vercel
Copy link

vercel bot commented May 16, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
litellm ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 16, 2025 5:45pm

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds tracing for guardrails in the StandardLoggingPayload by updating the logging payload structure and the related guardrail processing logic as well as adding test coverage.

  • Introduces a new test file to verify the logging payload.
  • Updates StandardLoggingGuardrailInformation to include additional fields (duration and masked_entity_count) in utils.
  • Refactors guardrail hooks in both the presidio integration and custom guardrail for improved logging.

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
tests/guardrails_tests/test_tracing_guardrails.py New test to ensure guardrail information is properly logged in the standard payload.
litellm/types/utils.py Updates to StandardLoggingGuardrailInformation with additional fields and docstrings.
litellm/proxy/guardrails/guardrail_hooks/presidio.py Refactors function parameters and logging trace flow for guardrail calls.
litellm/integrations/custom_guardrail.py Refactors the guardrail logging decorator to include timing and masked entity count details.

@ishaan-jaff ishaan-jaff changed the title [Feat] Add Tracing for guardrails in StandardLoggingPayload [Feat] Add Tracing for guardrails in StandardLoggingPayload, Langfuse May 16, 2025
@ishaan-jaff ishaan-jaff merged commit b9460df into main May 16, 2025
17 of 46 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants