mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-09 03:18:44 +00:00
feat(presidio): declare the stable-token params instead of reading them via getattr
getattr returns Any, so each call site counted as an unknown argument type and the pair tripped the basedpyright budget. Every sibling parameter on this call is a declared field; these two now are as well.
This commit is contained in:
parent
3535ea348f
commit
5f041d2f19
2 changed files with 16 additions and 2 deletions
|
|
@ -156,8 +156,8 @@ def initialize_presidio(litellm_params: LitellmParams, guardrail: Guardrail) ->
|
|||
presidio_anonymizer_api_base=litellm_params.presidio_anonymizer_api_base,
|
||||
presidio_language=litellm_params.presidio_language,
|
||||
presidio_entities_deny_list=litellm_params.presidio_entities_deny_list,
|
||||
presidio_stable_tokens=getattr(litellm_params, "presidio_stable_tokens", None),
|
||||
presidio_token_salt=getattr(litellm_params, "presidio_token_salt", None),
|
||||
presidio_stable_tokens=litellm_params.presidio_stable_tokens,
|
||||
presidio_token_salt=litellm_params.presidio_token_salt,
|
||||
apply_to_output=False,
|
||||
timeout=litellm_params.timeout,
|
||||
_callback_role="scan",
|
||||
|
|
|
|||
|
|
@ -494,6 +494,20 @@ class PresidioConfigModel(PresidioPresidioConfigModelUserInterface):
|
|||
default=None,
|
||||
description="Path to a JSON file containing ad-hoc recognizers for Presidio",
|
||||
)
|
||||
presidio_stable_tokens: bool | None = Field(
|
||||
default=None,
|
||||
description=(
|
||||
"Derive PII placeholders from the value instead of its order in the request, "
|
||||
"so the same value maps to the same token across turns. Requires presidio_token_salt."
|
||||
),
|
||||
)
|
||||
presidio_token_salt: str | None = Field(
|
||||
default=None,
|
||||
description=(
|
||||
"os.environ/<VAR> reference holding the HMAC key behind stable tokens. "
|
||||
"A literal is refused: guardrail params are logged in full at debug level."
|
||||
),
|
||||
)
|
||||
presidio_analyze_chunk_size_bytes: int | None = Field(
|
||||
default=None,
|
||||
description=(
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue