litellm/tests/unit/llms/vertex_ai/context_caching
Ondra Zahradnik 06e3e32c88
fix(vertex_ai): reuse known context caches instead of listing on every request (#46857)
Vertex AI and Gemini context caching now remember each cache they create or find until 10s before its expireTime, so a repeat cache-marked request goes straight to generateContent instead of listing every cachedContents first. Concurrent async requests for one prefix share one lookup or create

When generation rejects a remembered cache with a 400, 403 or 404 that names the cached content, the request rebuilds the cache and sends once more. Any other 400, 403 or 404 drops the record without a retry

Fixes #36395
2026-10-20 11:37:46 +00:00
..
__init__.py test: migrate legacy provider tests to tests/unit (wave 2, phase 13) 2026-09-20 14:18:49 +00:00
conftest.py fix(vertex_ai): reuse known context caches instead of listing on every request (#46857) 2026-10-20 11:37:46 +00:00
test_context_caching_ttl.py test: migrate legacy provider tests to tests/unit (wave 2, phase 13) 2026-09-20 14:18:49 +00:00
test_known_cached_contents.py fix(vertex_ai): reuse known context caches instead of listing on every request (#46857) 2026-10-20 11:37:46 +00:00
test_vertex_ai_context_caching.py fix(vertex_ai): keep Gemini cache creation token count out of request kwargs (#46152) 2026-10-12 21:19:12 -07:00