mirror of
https://github.com/BerriAI/litellm.git
synced 2026-12-02 01:28:38 +00:00
* feat(guardrails): add native Reco guardrail provider (pre_call) Registers guardrail: reco as a first-class vendor integration, built on the existing generic guardrail API wire contract rather than reimplementing the HTTP client and payload mapping. Maps reco_tenant_id to the X-Reco-Tenant-Id header and hardcodes fail_open/fail_on_error since those should not be customer-configurable. v1 only supports mode: pre_call; post_call and streaming redaction already work against the existing generic pilot and are deferred. Also overrides apply_guardrail to re-raise blocked-request errors with the guardrail's own configured name: the base class hardcodes a module-level name in that exception, which would otherwise mislabel every blocked Reco request in logs. * feat(guardrails): configurable Reco fail modes Expose unreachable_fallback and fail_on_error on the Reco guardrail and keep fail-open as the default. Values under optional_params win. Top-level litellm_params values apply only when set explicitly, since their defaults are fail-closed and would otherwise flip the default Also type RecoGuardrail's forwarded kwargs with an Unpack'd TypedDict instead of silencing ANN003 Signed-off-by: MickeyShnaiderman-RecoLabs <mickeys@reco.ai> Co-authored-by: Cursor <cursoragent@cursor.com> * chore(guardrails): align Reco with main's CI gates Upstream moved unit tests from tests/test_litellm to tests/unit, so test_reco.py was invoked by no CI job. Move it next to the other guardrail tests Replace RecoGuardrail's forwarded kwargs with explicit keyword params, read optional_params through a pydantic adapter instead of untyped dict/getattr access, freeze RecoOptionalParams, and drop mutable-ok markers that suppress nothing, to stay within main's type-discipline and basedpyright budgets Signed-off-by: MickeyShnaiderman-RecoLabs <mickeys@reco.ai> Co-authored-by: Cursor <cursoragent@cursor.com> * feat(guardrails): fail closed by default in the Reco guardrail Matches GenericGuardrailAPI and every other guardrail here: a Reco error or outage now blocks the request unless the admin sets fail_on_error: false. Tests cover the default, explicit fail-open, and top-level vs optional_params precedence Co-authored-by: RecoLabs-YaronBratspiess <208601538+RecoLabs-YaronBratspiess@users.noreply.github.com> Co-authored-by: MickeyShnaiderman-RecoLabs <77006830+MickeyShnaiderman-RecoLabs@users.noreply.github.com> Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> * fix(guardrails): honor explicit fail-open on Reco when optional_params is a model model_dump(exclude_unset=True) so pydantic defaults in optional_params no longer override an explicit top-level fail_on_error. Also drop the duplicate log_guardrail_information decorator, call the parent by keyword, freeze RecoConfigModel, and type the tests Co-authored-by: RecoLabs-YaronBratspiess <208601538+RecoLabs-YaronBratspiess@users.noreply.github.com> Co-authored-by: MickeyShnaiderman-RecoLabs <77006830+MickeyShnaiderman-RecoLabs@users.noreply.github.com> Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> * fix(guardrails): keep Reco config model assignable and the hook decorator the gate requires frozen=True on RecoConfigModel froze the shared LitellmParams mixin, which the guardrail registry assigns resolved secrets on, so every guardrail failed to load. Dropped it and added a test that LitellmParams stays assignable. Restored log_guardrail_information on the Reco override since tests/code_coverage_tests/check_guardrail_apply_decorator.py requires it on every hook. Test params typed as Mapping for LIT001 Co-authored-by: RecoLabs-YaronBratspiess <208601538+RecoLabs-YaronBratspiess@users.noreply.github.com> Co-authored-by: MickeyShnaiderman-RecoLabs <77006830+MickeyShnaiderman-RecoLabs@users.noreply.github.com> Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> * style(guardrails): format the Reco test file Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> --------- Signed-off-by: MickeyShnaiderman-RecoLabs <mickeys@reco.ai> Co-authored-by: Yaron Bratspiess <yaronb@reco.ai> Co-authored-by: MickeyShnaiderman-RecoLabs <mickeys@reco.ai> Co-authored-by: Cursor <cursoragent@cursor.com> Co-authored-by: joshua <joshua@berri.ai> Co-authored-by: MickeyShnaiderman-RecoLabs <77006830+MickeyShnaiderman-RecoLabs@users.noreply.github.com> Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> |
||
|---|---|---|
| .. | ||
| akto | ||
| aporia_ai | ||
| azure | ||
| content_filter | ||
| dynamoai | ||
| guardrails_ai | ||
| ibm_guardrails | ||
| javelin | ||
| litellm_content_filter | ||
| noma | ||
| openai | ||
| semantic_guard | ||
| unified_guardrails | ||
| zscaler_ai_guard | ||
| __init__.py | ||
| _cisco_ai_defense_test_utils.py | ||
| code_execution_compliance_dataset.json | ||
| test_agent_365.py | ||
| test_aim.py | ||
| test_airia.py | ||
| test_alice.py | ||
| test_bedrock_guardrails.py | ||
| test_bedrock_invoke_guardrail_checks.py | ||
| test_block_code_execution.py | ||
| test_block_code_execution_compliance.py | ||
| test_cato_networks.py | ||
| test_cisco_ai_defense_chat.py | ||
| test_cisco_ai_defense_mcp.py | ||
| test_compresr.py | ||
| test_conduct.py | ||
| test_crowdstrike_aidr.py | ||
| test_custom_code_bounded_execution.py | ||
| test_decision_model.py | ||
| test_deepkeep.py | ||
| test_dynamoai.py | ||
| test_enkryptai.py | ||
| test_generic_guardrail_api.py | ||
| test_grayswan.py | ||
| test_headroom.py | ||
| test_hiddenlayer.py | ||
| test_javelin.py | ||
| test_lakera_ai_v2.py | ||
| test_lasso.py | ||
| test_llm_shield_proxy.py | ||
| test_mcp_end_user_permission.py | ||
| test_mcp_security.py | ||
| test_microsoft_purview.py | ||
| test_model_armor.py | ||
| test_noma.py | ||
| test_noma_v2.py | ||
| test_onyx.py | ||
| test_ovalix.py | ||
| test_pangea.py | ||
| test_panw_prisma_airs.py | ||
| test_presidio.py | ||
| test_presidio_union_fix.py | ||
| test_promptguard.py | ||
| test_qualifire.py | ||
| test_reco.py | ||
| test_repelloai.py | ||
| test_response_rejection_guardrail_code.py | ||
| test_singulr.py | ||
| test_straiker.py | ||
| test_structured_messages_writeback.py | ||
| test_tool_permission.py | ||
| test_tool_policy_guardrail.py | ||
| test_typesafe.py | ||
| test_vigil_guard.py | ||
| test_wingback.py | ||
| test_xecguard.py | ||