Ishaan Jaff
bc368707df
[Bug Fix] Fixes for bedrock guardrails post_call - applying to streaming responses ( #12252 )
...
* fixes for using bedrock guard
* fixes for output_content_bedrock guard
* test_convert_to_bedrock_format_input_source
* test_convert_to_bedrock_format_post_call_streaming_hook
* test bedrock guard
2025-07-02 14:46:27 -07:00
Jason Roberts
cc480f94c9
Fix/move panw prisma airs test file location per feedback on PR #12116 ( #12175 )
...
* Move PANW Prisma AIRS test per feedback on PR #12116
- Move test to tests/test_litellm/proxy/guardrails/guardrail_hooks/
* Remove test file from old location
2025-07-01 18:08:04 -07:00
Jason Roberts
b57cfb8bff
Adding Feature: Palo Alto Networks Prisma AIRS Guardrail ( #12116 )
...
* feat: Add PANW Prisma AIRS guardrail integration
- Add PANW_PRISMA_AIRS to SupportedGuardrailIntegrations enum
- Update guardrail registry and initializers
- Add complete documentation with curl examples and response formats
- Support pre_call, post_call, and during_call modes
- Include fail-safe error handling and comprehensive logging
- Integration with official PANW Prisma AIRS API
* feat: Add PANW Prisma AIRS guardrail integration
- Update to test file
- Fail-closed security on API errors
* update fail closed behavior
* fix: Update PANW Prisma AIRS guardrail integration pattern
* fix: Remove unused import
* fix: addressed MyPy error
2025-06-27 15:17:36 -07:00
Ishaan Jaff
c994c22c13
[Bug Fix] Bedrock Guardrails - Ensure PII Masking is applied on response streaming or non streaming content when using post call ( #12086 )
...
* test_bedrock_guardrail_response_pii_masking_streaming
* fix - apply masking for response on bedrock
2025-06-27 07:41:32 -07:00
Ishaan Jaff
d677a6bda2
[Bug Fix] Bedrock Guardrail - Don't raise exception on intervene action ( #11875 )
...
* Refactor Bedrock guardrails to handle BLOCKED vs ANONYMIZED actions
* Enhance Bedrock guardrail masking with improved anonymization logic
* fix _should_raise_guardrail_blocked_exception
* test_bedrock_guardrail_uses_masked_output_without_masking_flags
* fix linting error
---------
Co-authored-by: Cursor Agent <cursoragent@cursor.com >
2025-06-23 19:59:44 -07:00
Ishaan Jaff
c6d0878160
[Feat] Add Lasso Guardrail to LiteLLM ( #11565 )
...
* Feature/lasso guardrail (#9002 )
* first version of lasso guardrail in litellm
* update to the new Lasso API
* change prod api_base and kill the request when lasso detect issue.
* change test for now api, local test pass
* add async tests
* all tests pass
* add docs for the new lasso guardrail
* Remove support for modes other than pre_call in Lasso guardrail
* code structure and naming
* only pre_call docs
* fix lint errors
* move test to the new location follows the same directory structure as litellm/.
* add lasso guard
* docs lasso docs
* add lasso guardrail
* fix lasso guardrail
---------
Co-authored-by: oroxenberg <oro@lasso.security >
2025-06-09 18:47:26 -07:00
Cole McIntosh
702e399d94
Add presidio_language yaml configuration support for guardrails ( #11331 )
...
* feat: Add presidio_language parameter for PII analysis configuration via yaml config files
- Introduced presidio_language parameter in guardrail_initializers and guardrail_hooks to allow language specification for Presidio PII analysis via yaml config files
- Updated PresidioPresidioConfigModelUserInterface to include presidio_language with a default value of "en".
- Added tests to verify language configuration functionality, ensuring correct language usage in analyze requests.
* docs: Enhance PII masking documentation with language support details
- Added information on configuring the default language for PII analysis using the `presidio_language` parameter in both the UI and YAML configuration.
- Included supported language codes (English, Spanish, German) and their precedence in language settings.
- Provided examples for default language configuration and per-request language overrides to clarify usage.
2025-06-02 13:13:17 -07:00
Krish Dholakia
06484f6e5a
Xai, VertexAI, Google AI Studio - live web search support in OpenAI format ( #11251 )
...
* build(model_prices_and_context_window.json): fix 'supports_web_search' flag - openai only supports it on 2 models - gpt-4o-search-preview and gpt-4o-mini-search-preview
* feat(xai/chat): add xai web search options param support
* test: add max tokens to test
xai output very verbose
* build(xai/): add web search support for all xai models
* build(model_prices_and_cost.json): add gemini-2.0 supports web search
* feat(gemini/): map openai 'web_search_options' to google's 'googlesearch' tool
* build(model_prices_and_context_window.json): add supports_web_search for vertex_ai/gemini-2 models
* fix: fix circular reference error
* fix(convert_dict_to_response.py): handle scenario where xai returns finish reason as 'stop' for tool calls
* fix: reduce function size
* fix: import session handling
* Revert "fix: import session handling"
This reverts commit deb257dc10 .
* fix: linting pin mypy
* [Feat]: Guardrails - Add streaming for bedrock post guard (#11247 )
* feat: add streaming for bedrock post guard
* fix: bedrock guardrails
* fix: add clear comments
* Update litellm/proxy/guardrails/guardrail_hooks/bedrock_guardrails.py
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com >
* Update litellm/proxy/guardrails/guardrail_hooks/bedrock_guardrails.py
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com >
* fix: clean up bedrock guardrails
---------
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com >
* [Fix] Responses API - Session management (#11254 )
* fix: import session handling
* fix: imports for session handler
* tests: tests for session handler
* Update enterprise/litellm_enterprise/enterprise_callbacks/session_handler.py
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com >
---------
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com >
* bump: bump litellm enterprise
* fixes: test_create_user_default_budget
* fix(xai/): filter 'strict' on tool call
* test: update test for new error string
* fix(utils.py): default to None if not set in model cost map
ensures consistent usage of 'supports_[x]' flags
* fix(fireworks_ai/): support fireworks ai document inlining on pdf's sent via openai 'file' message type
* test: update test
* test: name filter_value_from_dict
* fix(fireworks_ai/): handle cache control flag in messages
* fix(xai/chat): fix check
---------
Co-authored-by: Ishaan Jaff <ishaanjaffer0324@gmail.com >
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com >
2025-05-31 14:26:16 -07:00
Ishaan Jaff
a9d23f5d4a
[Fix] Bedrock Guard Auth Param Persistence ( #11270 )
...
* fix: using bedrock guard
* fix: bedrock guard param persistence
2025-05-30 17:24:03 -07:00
Ishaan Jaff
f24d8919c4
[Feat]: Guardrails - Add streaming for bedrock post guard ( #11247 )
...
* feat: add streaming for bedrock post guard
* fix: bedrock guardrails
* fix: add clear comments
* Update litellm/proxy/guardrails/guardrail_hooks/bedrock_guardrails.py
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com >
* Update litellm/proxy/guardrails/guardrail_hooks/bedrock_guardrails.py
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com >
* fix: clean up bedrock guardrails
---------
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com >
2025-05-29 20:01:44 -07:00
Ishaan Jaff
7d8ed6f362
[Fix] List Guardrails - Show config.yaml guardrails on litellm ui ( #10959 )
...
* fix: listing guardrails defined on litellm config
* fix: list guardrails on litellm config
* fix: list guardrails on litellm config
* test: list guardrails on litellm config
* fix: linting
* Update litellm/proxy/guardrails/guardrail_endpoints.py
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com >
* fix: GuardrailInfoLiteLLMParamsResponse
---------
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com >
2025-05-19 21:25:23 -07:00
Ishaan Jaff
bd1e0634bf
[Feat] Add Lakera v2 Guardrail Support ( #10880 )
...
* feat: add types for lakera v2
* feat: add call v2 guard for lakera
* feat: add call v2 guard for lakera
* feat: add LAKERA_V2
* feat: add LAKERA_V2 params
* feat: add initialize_lakera_v2
* fix: lakera pii masking
* test: lakera pii masking
* fix: lakera pii masking with tracing
* fix: lakera pii masking with tracing
* fix: fix linting errors
* fix: lakera ai docs
2025-05-16 17:08:21 -07:00
Ishaan Jaff
b9460dfe37
[Feat] Add Tracing for guardrails in StandardLoggingPayload, Langfuse ( #10890 )
...
* test:test_standard_logging_payload_includes_guardrail_information
* feat: add tracing for presidio pii masking
* feat: add tracing for guardrails on langfuse
* test: test_langfuse_trace_includes_guardrail_information
* feat: add tracing for guardrails on langfuse
* fix: working guardrail trace
* test: guardrail trace lands on langfuse
* fix: linting
* fix: code qa check
* test: fixes for presidio test
* test: fixes for presidio test
* test: guardrail trace lands on langfuse
* test: guardrail trace lands on langfuse
* test: guardrail trace lands on langfuse
* test: guardrail trace lands on langfuse
2025-05-16 10:47:12 -07:00
Ishaan Jaff
dc16e47df6
[UI] Allow adding Bedrock, Presidio, Lakera, AIM guardrails on UI ( #10874 )
...
* ui fix bedrock guard
* polish: logo should appear after selecting provider
* fix ui config bedrock
* fix: refactor - use specific configs per provider
* fix: refactor - use specific configs per provider
* feat: ui, show provider specific params for guardrails
* fix: updated type of LiteLLM params for guardrails
* fix: updated type of LiteLLM params for guardrails
* ui, use endpoint for adding presidio, bedrock guardrails
* fix: linting error
* add llama guard and secret detector on UI
* add aim on ui
* allow adding lakera AI on litellm ui
* fix: fixes for params to init guardrails
* test: test_guardrail_info_response
* test: test_initialize_presidio_guardrail
* fix: init guardrails
* fix: init guardrails
* add showSearch
* working bedrock guard
2025-05-15 21:22:56 -07:00
Ishaan Jaff
3d37cc68f6
[Feat - Guardrails] Expose /apply_guardrail endpoint for directly calling guardrail ( #10867 )
...
* refactor: add types for mask pii request/response
* feat: add mask pii hook for guardrails
* feat: rename to apply_guardrail
* test: test_presidio_apply_guardrail
* fix: code QA
* fix: linting error
* feat: allow non-admins to access apply_guardrail routes
2025-05-15 14:52:24 -07:00
Ishaan Jaff
2a994d7016
[Feat] Presidio Improvements - Allow adding presidio api base on UI, Test presidio on Test Key, fixes for running presidio hook ( #10840 )
...
* feat: add GuardrailProviderSpecificParams
* feat: add add apply_guardrail helper for presidio
* ui cleanup
* fixes pii config on ui
* fixes for adding presidio pii
* refactor: InitializeGuardrails
* feat: init guardrails from DB
* allow running guardrails from test key pg
* fix: running a request with guardrails on UI
* fix: types/guardrails.py
* test: test_presidio_pre_call_hook_with_different_call_types
* test: test_initialize_presidio_guardrail
* test: fix custom guardrail tests
2025-05-14 17:41:33 -07:00
Ishaan Jaff
8142c20c98
[Feat] Allow specifying PII Entities Config when using Presidio Guardrails ( #10810 )
...
* refactor: use analyze_text, anonymize_text
* feat: allow defining pii_entities_config for presidio
* feat: use entities config for presidio analyze request
* feat: add test_presidio_pii.py
* testing: add guardrails testing job
* feat: allow blocking specific entities pii
* test: use 1 file for presidio guard tests
* fix: presidio pii tests
* test: presidio blocked entity
* clean up docs
* docs presidio pii parsing
* fix: raise_exception_if_blocked_entities_detected
* fix: linting errors
2025-05-13 19:48:56 -07:00
Ishaan Jaff
6a3ea83b23
[Feat] Bedrock Guardrails - Add support for PII Masking with bedrock guardrails ( #10642 )
...
* allow defining mask_request_content for guardrails
* allow pii masking with bedrock
* implement bedrock pre call hook
* docs bedrock pii masking
* fix linting error
* fix code quality checks
2025-05-07 18:30:57 -07:00