Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add custom configuration to pass it as constructor param for a CustomGuardrail #8307

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

IleAuxVaches
Copy link

Add dedicated configuration for custom GuardRail.

A proposition to add custom configuration to pass it as constructor param in dynamic instanciation of a CustomGuardrail, as has been done for others 'ENTERPRISE' guardrails implementations.
Permit to define a default global configuration in yaml to set default parameters for a custom guardrail.
Example :

guardrails:
  - guardrail_name: "my_custom_guardrail"
    litellm_params:
      default_on: true
      guardrail: my_guardrails.MyCustomGuardRail
      mode: pre_call  
      custom_config: 
        # add my custom global params for my MyCustomGuardRail
        param1: "blabla"
        param2: "blabla"
        param3: true

This PR follows a discussion with @superpoussin22,

Type

🆕 New Feature

Changes

  • add option dict CustomConfigin litellm/litellm/types/guardrails.py L109.
  • add input parameter custom_config=litellm_params["custom_config"]in dynamic construction of instance CustomGuardrailin litellm/litellm/proxy/guardrails/init_guardrails.py L155.

…amic instanciation of a custom guardrail, as for others 'ENTERPRISE' guardrails
Copy link

vercel bot commented Feb 6, 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 Feb 6, 2025 8:27am

Copy link
Contributor

@ishaan-jaff ishaan-jaff left a comment

Choose a reason for hiding this comment

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

please add a unit test for this

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