litellm/tests/test_litellm/responses
Sameer Kankute 7e61dbb1df
fix(responses): preserve cache_control in Responses API -> Chat Completion transformation (#27727)
* fix(responses): preserve cache_control in Responses API -> Chat Completion transformation

cache_control injected by AnthropicCacheControlHook was silently dropped when
_transform_responses_api_content_to_chat_completion_content rebuilt content blocks
with only {type, text}. Now copies cache_control through so Anthropic prompt caching
works correctly when using client.responses.create with cache_control_injection_points.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(responses): preserve cache_control for input_image and input_file blocks

Extends the cache_control fix to image and file content blocks, which were
also silently dropping cache_control during the Responses API -> Chat Completion
transformation. Adds tests for all three content block types.

Co-authored-by: Cursor <cursoragent@cursor.com>

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Claude Babysitter <claude@anthropic.com>
2026-05-13 12:17:06 -07:00
..
litellm_completion_transformation fix(responses): preserve cache_control in Responses API -> Chat Completion transformation (#27727) 2026-05-13 12:17:06 -07:00
mcp style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
test_metadata_codex_callback.py style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
test_no_duplicate_spend_logs.py style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
test_null_test_fix.py style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
test_responses_api_bridge_flag.py refactor(responses): drop use_responses_api_bridge; fix PLR0915 2026-04-13 18:22:17 +05:30
test_responses_api_request_body.py style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
test_responses_prompt_management.py style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
test_responses_router_cooldown.py fix(responses): register cooldowns on failure + fail fast on stale encrypted_content (#27820) 2026-05-13 09:03:13 -07:00
test_responses_utils.py style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
test_responses_websocket_all_providers.py style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
test_text_format_conversion.py style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00