* feat(guardrails): Add deduplication and session tracking
- Implement deduplication logic to prevent duplicate scans (via call_id; add _check_and_mark_scanned) caused by LiteLLM callback system
- Add session tracking using litellm_trace_id as AI Session ID for Prisma AIRS SCM logging
- Extract helper methods _extract_prompt_from_request maintainability
- Use httpxSpecialProvider import (LoggingCallback -> GuardrailCallback)
- Add comprehensive tests for deduplication and session tracking (7 new tests)
- Update documentation with multi-turn conversation tracking examples
* docs: update PANW Prisma AIRS multi-turn conversation example to use industry-standard terminology
- Clearer example for conversation tracking
- Updated terminology from 'AI Session ID' to 'Prisma AIRS AI Session ID' for clarity
* fix: remove unused asyncio import
* fix: correct mypy type ignore comment
* Fix embeddings endpoint call_type to use valid CallTypes enum value
Fixed bug where the `/embeddings` endpoint was passing `call_type="embeddings"`
to guardrail hooks, but "embeddings" is not a valid value in the CallTypes enum.
Changed to use `call_type="aembedding"` (async embedding) which is the correct
CallTypes enum value and matches the route_type used in the same function.
Added unit tests to verify:
- "embeddings" is not a valid CallTypes enum value
- "aembedding" is the correct valid value
- The fix prevents ValueError when guardrails are enabled
Fixes#16240
* Inline embeddings call type regression check
* Ensure embedding test preserves proxy metadata
## Problem
The `extra_body` parameter in `litellm.responses()` and `litellm.aresponses()`
was being accepted but never passed to the HTTP request sent to the LLM provider.
This prevented users from sending custom/experimental parameters to provider APIs.
## Changes
- Added `data.update(extra_body)` in `async_response_api_handler` (line 2138)
- Added `data.update(extra_body)` in `response_api_handler` (line 2012)
- Added tests to `test_openai_responses_api.py` for extra_body functionality
## Testing
- Tests verify extra_body params are passed in both sync and async modes
- Existing Responses API tests continue to pass
- Manually verified with OpenAI API that custom params are sent correctly
## Impact
Users can now pass custom/experimental parameters via extra_body:
```python
litellm.aresponses(
model="gpt-4o",
input="hello",
extra_body={"custom_param": "value"} # Now works!
)
```
This aligns with the OpenAI SDK pattern and matches behavior in other
LiteLLM endpoints (completion, embedding, etc.) that already support extra_body.
* fix: Remove unused asyncio import from litellm_logging.py
- Fixes F401 linting error blocking CI
* fix: Add type ignore comments for MyPy false positives
- redis_cache.py: Add type ignore for aclose() - method exists but redis-py type stubs are incomplete
- redis_cluster_cache.py: Add type ignore for ping() and aclose() - redis-py typing issue
- responses/utils.py: Add type ignore for variable shadowing false positive
- transformation.py: Add type ignore for TypedDict expansion - runtime works correctly
- aws_secret_manager_v2.py: Add type ignore for dict[str, Any] assignment
All changes are safe - code works correctly in runtime, these are MyPy inference limitations.
Fixes 7 MyPy errors blocking CI without changing any logic.
* fix: Add type ignore for Redis async methods in cache files
- Add type: ignore[attr-defined] for aclose() in redis_cache.py
- Add type: ignore[attr-defined] for ping() and aclose() in redis_cluster_cache.py
- Methods exist but redis-py type stubs are incomplete
* refactor: Remove variable shadowing in _transform_response_api_usage_to_chat_usage
- Rename parameter 'usage' to 'usage_input' for clarity
- Rename local variable 'usage' to 'chat_usage' to avoid shadowing
- Eliminates MyPy false positive without needing type: ignore
- No functional changes - all tests pass
- Improves code readability and type safety