mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-07 02:59:05 +00:00
fix(rubrik): apply event_hook default when caller passes None
initialize_guardrail always passes event_hook=litellm_params.mode, so setdefault never applied its default. When mode is omitted from the guardrail config, event_hook ended up as None instead of post_call. Use 'or' to fall back to the intended default when the value is None. Co-authored-by: Yassin Kortam <yassin@berri.ai>
This commit is contained in:
parent
8f4c4630d3
commit
12ebe8bebc
1 changed files with 4 additions and 1 deletions
|
|
@ -48,7 +48,10 @@ class RubrikLogger(CustomGuardrail, CustomBatchLogger):
|
|||
):
|
||||
self.flush_lock = asyncio.Lock()
|
||||
kwargs.setdefault("guardrail_name", "rubrik")
|
||||
kwargs.setdefault("event_hook", GuardrailEventHooks.post_call)
|
||||
# Use `or` rather than setdefault because callers (e.g.
|
||||
# initialize_guardrail) always pass event_hook explicitly, possibly as
|
||||
# None when the user omits `mode` from the guardrail config.
|
||||
kwargs["event_hook"] = kwargs.get("event_hook") or GuardrailEventHooks.post_call
|
||||
kwargs.setdefault("default_on", True)
|
||||
super().__init__(
|
||||
flush_lock=self.flush_lock,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue