mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-09 03:18:44 +00:00
fix(guardrails): validate masked parameter mappings
This commit is contained in:
parent
2250e1d7f2
commit
66a7811b89
1 changed files with 7 additions and 3 deletions
|
|
@ -266,7 +266,7 @@ async def list_guardrails_v2(
|
|||
number_of_asterisks=4,
|
||||
)
|
||||
masked_litellm_params = (
|
||||
BaseLitellmParams(**masked_litellm_params_dict) if masked_litellm_params_dict else None
|
||||
BaseLitellmParams.model_validate(masked_litellm_params_dict) if masked_litellm_params_dict else None
|
||||
)
|
||||
guardrail_configs.append(
|
||||
GuardrailInfoResponse(
|
||||
|
|
@ -307,7 +307,9 @@ async def list_guardrails_v2(
|
|||
number_of_asterisks=4,
|
||||
)
|
||||
masked_in_memory_litellm_params_typed = (
|
||||
BaseLitellmParams(**masked_in_memory_litellm_params) if masked_in_memory_litellm_params else None
|
||||
BaseLitellmParams.model_validate(masked_in_memory_litellm_params)
|
||||
if masked_in_memory_litellm_params
|
||||
else None
|
||||
)
|
||||
guardrail_configs.append(
|
||||
GuardrailInfoResponse(
|
||||
|
|
@ -1369,7 +1371,9 @@ async def get_guardrail_info(guardrail_id: str):
|
|||
unmasked_length=4,
|
||||
number_of_asterisks=4,
|
||||
)
|
||||
masked_litellm_params = BaseLitellmParams(**masked_litellm_params_dict) if masked_litellm_params_dict else None
|
||||
masked_litellm_params = (
|
||||
BaseLitellmParams.model_validate(masked_litellm_params_dict) if masked_litellm_params_dict else None
|
||||
)
|
||||
|
||||
return GuardrailInfoResponse(
|
||||
guardrail_id=result.get("guardrail_id"),
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue