Skip to content

docs(guardrails): document metadata field on /guardrails/apply_guardrail - #573

Merged
yassin-berriai merged 2 commits into
mainfrom
litellm_apply_guardrail_metadata_docs
Jul 15, 2026
Merged

yassin-berriai merged 2 commits into
mainfrom
litellm_apply_guardrail_metadata_docs

Conversation

@devin-ai-integration

@devin-ai-integration devin-ai-integration Bot commented Jul 15, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Documents the optional metadata field on POST /guardrails/apply_guardrail, the proxy-side plumbing added in BerriAI/litellm#33067 (issue BerriAI/litellm#33059)

metadata is forwarded to a custom guardrail as request_data["metadata"] only when the client sends it, so parameterized guardrails (e.g. a topic guardrail reading forbidden_topics) can be driven per-request through the standalone endpoint. Omitting it preserves the existing pass-through behavior

Changes are confined to docs/apply_guardrail.md: a new usage tab showing a metadata-driven custom guardrail call, a metadata entry under Optional Fields, and a note that it is forwarded only when present

{
    "guardrail_name": "my-topic-guardrail",
    "text": "What are tax loopholes?",
    "metadata": { "forbidden_topics": ["tax", "finance"] }
}

Also documents the new Admin UI surface: the Guardrail Testing Playground gained an optional Metadata JSON field (same litellm PR), so the page now points UI users at Guardrails -> Test Playground

Validated with npm run build (passes; the only warning is a preexisting broken anchor in an unrelated release note)

Link to Devin session: https://app.devin.ai/sessions/bf1d0933583444378ee93af6c30c76db

@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

@vercel

vercel Bot commented Jul 15, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
litellm Ready Ready Preview, Comment Jul 15, 2026 8:51pm

Request Review

@yassin-berriai
yassin-berriai merged commit a331b1c into main Jul 15, 2026
3 checks passed
@yassin-berriai
yassin-berriai deleted the litellm_apply_guardrail_metadata_docs branch July 15, 2026 22:12

This branch was previously deployed

1 inactive deployment
Preview — c36e1cdd Deployed Jul 15, 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.

1 participant