mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-09 03:18:44 +00:00
fix(guardrails): add 'block' as valid on_violation value in BaseLitellmParams (#23685)
Guardrail configs loaded from the database can have on_violation='block' (a natural choice for "block the request"). The current Pydantic schema only accepts Literal["warn", "end_session"], causing a validation error: Input should be 'warn' or 'end_session' [type=literal_error, input_value='block', ...] Add 'block' to the Literal type so existing configs with on_violation='block' are accepted instead of crashing the proxy on startup. Fixes #23624 Co-authored-by: NIK-TIGER-BILL <nik.zamuldinov@gmail.com>
This commit is contained in:
parent
3dccdde9c8
commit
47d238b228
1 changed files with 2 additions and 2 deletions
|
|
@ -656,9 +656,9 @@ class BaseLitellmParams(
|
|||
default=None,
|
||||
description="For /v1/realtime sessions: automatically close the session after this many guardrail violations.",
|
||||
)
|
||||
on_violation: Optional[Literal["warn", "end_session"]] = Field(
|
||||
on_violation: Optional[Literal["warn", "end_session", "block"]] = Field(
|
||||
default=None,
|
||||
description="For /v1/realtime sessions: 'warn' speaks the violation message and continues; 'end_session' speaks the message and closes the connection.",
|
||||
description="For /v1/realtime sessions: 'warn' speaks the violation message and continues; 'end_session' speaks the message and closes the connection. 'block' rejects the request (same as the default guardrail behaviour).",
|
||||
)
|
||||
realtime_violation_message: Optional[str] = Field(
|
||||
default=None,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue