mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-07 02:59:05 +00:00
enhance AktoGuardrail error handling and update test initialization comments
This commit is contained in:
parent
61fa049f7b
commit
d9c761d31b
3 changed files with 4 additions and 1 deletions
|
|
@ -12,6 +12,7 @@ if TYPE_CHECKING:
|
|||
def initialize_guardrail(litellm_params: "LitellmParams", guardrail: "Guardrail"):
|
||||
import litellm
|
||||
|
||||
# Note: AktoGuardrail only supports pre_call.
|
||||
_akto_callback = AktoGuardrail(
|
||||
akto_base_url=getattr(litellm_params, "akto_base_url", None),
|
||||
akto_api_key=getattr(litellm_params, "akto_api_key", None),
|
||||
|
|
|
|||
|
|
@ -114,7 +114,8 @@ class AktoGuardrail(CustomGuardrail):
|
|||
},
|
||||
timeout=self.guardrail_timeout,
|
||||
)
|
||||
except Exception as e:
|
||||
except (httpx.RequestError, httpx.HTTPStatusError) as e:
|
||||
# Fire-and-forget: log but never crash the request path
|
||||
verbose_proxy_logger.error("Akto blocked-request ingest error: %s", e)
|
||||
|
||||
# ── Payload builders ──
|
||||
|
|
|
|||
|
|
@ -135,6 +135,7 @@ def test_init_from_env():
|
|||
|
||||
|
||||
def test_init_defaults():
|
||||
# patch.dict restores popped keys on exit
|
||||
with patch.dict(os.environ, {}, clear=False):
|
||||
os.environ.pop("AKTO_ACCOUNT_ID", None)
|
||||
os.environ.pop("AKTO_VXLAN_ID", None)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue