Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
4509c87
feat(guardrails): add llm shield pii redaction and rehydration guardrail
ninadphalak Sep 3, 2026
8ab969d
feat(ui): list llm shield in the guardrail garden
ninadphalak Sep 3, 2026
2da630d
docs(guardrails): add llm shield example config
ninadphalak Sep 3, 2026
5fccbfe
feat(ui): use the llm shield brand mark for the guardrail logo
ninadphalak Sep 3, 2026
ee0bac5
fix(guardrails): restore llm shield values in anthropic replies
ninadphalak Sep 3, 2026
0de4b8b
docs(guardrails): correct the llm shield start command
ninadphalak Sep 3, 2026
b6e3e6d
fix(guardrails): redact every request shape and restore every reply s…
ninadphalak Sep 3, 2026
295ad52
fix(guardrails): narrow the stream delta before writing to it
ninadphalak Sep 4, 2026
47421b7
fix(guardrails): mint the vault id instead of trusting the caller's
ninadphalak Sep 4, 2026
f3eb108
fix(guardrails): drop Final from a loop-assigned local
ninadphalak Sep 4, 2026
8d0b188
fix(guardrails): redact completion prompts and responses tool items
ninadphalak Sep 4, 2026
46f1380
fix(guardrails): redact the anthropic system prompt and string-array …
ninadphalak Sep 4, 2026
a35c502
fix(guardrails): narrow prompt and input to a list before iterating
ninadphalak Sep 4, 2026
46438d7
fix(guardrails): restore every streaming choice, not just the first
ninadphalak Sep 4, 2026
a0abb9a
refactor(guardrails): name the guardrail llm_shield_proxy throughout
ninadphalak Sep 4, 2026
6536d61
feat(guardrails): redact the participant name on a message
ninadphalak Sep 4, 2026
403b06e
fix(guardrails): flush every held choice, and cover tool results and …
ninadphalak Sep 4, 2026
ce921f4
fix(guardrails): walk nested tool results iteratively, with a depth b…
ninadphalak Sep 4, 2026
119ec62
fix(guardrails): redact Responses PromptObject variables
ninadphalak Sep 4, 2026
76ac63a
test(guardrails): assert the depth bound instead of only reaching the…
ninadphalak Sep 4, 2026
6a4fc88
fix(guardrails): keep system-prompt values out of the restored reply
ninadphalak Sep 5, 2026
8b2ee5a
style(guardrails): satisfy ruff format and annotate the new tests
ninadphalak Sep 5, 2026
579b4c3
Merge branch 'litellm_internal_staging' into feature/llm-shield-guard…
ninadphalak Sep 13, 2026
d598d1b
fix(guardrails): restore tool calls in the LLM Shield guardrail
ninadphalak Sep 13, 2026
097cafb
Merge upstream/main into the LLM Shield guardrail branch
ninadphalak Sep 23, 2026
2869737
fix(guardrails): import copy, keep the vault id off the provider, dro…
ninadphalak Sep 23, 2026
b965673
fix(guardrails): build llm_shield_proxy stream deltas without new mut…
ninadphalak Sep 26, 2026
12e3b14
fix(guardrails): drop Final from loop-body locals in llm_shield_proxy
ninadphalak Sep 26, 2026
f1a6890
feat(guardrails): restore llm_shield_proxy placeholders on native str…
ninadphalak Sep 26, 2026
40c2617
fix(guardrails): redact llm_shield_proxy predicted outputs and output…
ninadphalak Sep 26, 2026
d7d608f
fix(guardrails): fail closed on deep llm_shield_proxy requests, widen…
ninadphalak Sep 26, 2026
1b81bb4
fix(guardrails): scan llm_shield_proxy schemas by default
ninadphalak Sep 26, 2026
0f9ca3f
fix(guardrails): redact llm_shield_proxy schema enum and const values
ninadphalak Sep 26, 2026
f1578d6
fix(guardrails): redact llm_shield_proxy web search user locations
ninadphalak Sep 26, 2026
bcce015
Merge upstream/main into the LLM Shield guardrail branch
ninadphalak Oct 2, 2026
6db0260
fix(guardrails): drop unused llm_shield_proxy suppressions
ninadphalak Oct 3, 2026
1b45935
fix(guardrails): type the llm_shield_proxy request and reply walks
ninadphalak Oct 3, 2026
71e68fd
fix(guardrails): keep restored llm_shield_proxy replies out of the ca…
ninadphalak Oct 4, 2026
974b326
fix(guardrails): redact llm_shield_proxy plain-text document blocks
ninadphalak Oct 4, 2026
be16f7b
fix(guardrails): redact llm_shield_proxy extra_body overrides
ninadphalak Oct 4, 2026
ac6af96
test(guardrails): import InMemoryCache directly in the llm_shield_pro…
ninadphalak Oct 4, 2026
ae3cebd
fix(guardrails): restore llm_shield_proxy replies for model-level use…
ninadphalak Oct 5, 2026
27b6f4f
fix(guardrails): don't repeat usage in llm_shield_proxy end-of-stream…
ninadphalak Oct 5, 2026
b55622e
fix(guardrails): keep restored llm_shield_proxy values out of telemet…
ninadphalak Oct 5, 2026
464516a
refactor(guardrails): split llm_shield_proxy into payload, request wa…
ninadphalak Oct 5, 2026
db41912
style(guardrails): drop routine comments from llm_shield_proxy
ninadphalak Oct 5, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
from typing import TYPE_CHECKING, Final

from litellm.types.guardrails import SupportedGuardrailIntegrations

from .llm_shield_proxy import LLMShieldProxyGuardrail

if TYPE_CHECKING:
from litellm.types.guardrails import Guardrail, LitellmParams


def initialize_guardrail(litellm_params: "LitellmParams", guardrail: "Guardrail") -> LLMShieldProxyGuardrail:
import litellm

_llm_shield_guardrail_callback: Final = LLMShieldProxyGuardrail(
api_key=litellm_params.api_key,
api_base=litellm_params.api_base,
guardrail_name=guardrail.get("guardrail_name", ""),
event_hook=litellm_params.mode,
default_on=litellm_params.default_on,
)

litellm.logging_callback_manager.add_litellm_callback(_llm_shield_guardrail_callback)
return _llm_shield_guardrail_callback


guardrail_initializer_registry: Final = {
SupportedGuardrailIntegrations.LLM_SHIELD_PROXY.value: initialize_guardrail,
}


guardrail_class_registry: Final = {
SupportedGuardrailIntegrations.LLM_SHIELD_PROXY.value: LLMShieldProxyGuardrail,
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
model_list:
- model_name: gpt-4o
litellm_params:
model: openai/gpt-4o
api_key: os.environ/OPENAI_API_KEY

guardrails:
- guardrail_name: "llm_shield_proxy"
litellm_params:
guardrail: llm_shield_proxy
mode: ["pre_call", "post_call"]
default_on: true
api_base: "http://localhost:8000"
api_key: os.environ/LLM_SHIELD_PROXY_API_KEY
Loading
Loading