Skip to content

fix: properly handle custom guardrails parameters - #18978

Merged
1 commit merged into
BerriAI:litellm_staging_01_13_2026from
Harshit28j:fix/custom_guardrails_params_handle
Jan 13, 2026
Merged

1 commit merged into
BerriAI:litellm_staging_01_13_2026from
Harshit28j:fix/custom_guardrails_params_handle

Conversation

@Harshit28j

@Harshit28j Harshit28j commented Jan 12, 2026 •

Copy link
Copy Markdown
Contributor

Relevant issues

Fixes #18718

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
  • 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

CI (LiteLLM team)

CI status guideline:

  • 50-55 passing tests: main is stable with minor issues.
  • 45-49 passing tests: acceptable but needs attention
  • <= 40 passing tests: unstable; be careful with your merges and assess the risk.
  • Branch creation CI run
    Link:

  • CI run for the last commit
    Link:

  • Merge / cherry-pick CI run
    Links:

Type

🐛 Bug Fix

Changes

Solution

Modified initialize_custom_guardrail to extract all parameters from litellm_params using model_dump() and pass them via **extra_params to the custom guardrail constructor. Parameters that are already handled explicitly (guardrail, mode, default_on) are excluded.

image

Files Changed

  • litellm/proxy/guardrails/guardrail_registry.py - Added logic to pass all litellm_params to custom guardrail init

@vercel

vercel Bot commented Jan 12, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
litellm Ready Ready Preview, Comment Jan 12, 2026 7:35pm

@ghost
ghost changed the base branch from main to litellm_staging_01_13_2026 January 13, 2026 21:53
@ghost
ghost merged commit 181c626 into BerriAI:litellm_staging_01_13_2026 Jan 13, 2026
6 of 7 checks passed
fzowl pushed a commit to fzowl/litellm that referenced this pull request Jun 24, 2026
This pull request was closed.

This branch was successfully deployed

1 active deployment
Preview — 15f4d149 Deployed Jan 12, 2026 by vercel[bot]
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.

[Bug]: Custom guardrail cannot receive parameters

1 participant