mirror of
https://github.com/BerriAI/litellm.git
synced 2026-11-25 22:20:43 +00:00
* test(caching): pin response cache keys and cover large image and clamped max_tokens requests Pins the cache key to the sha256 of the same formatted request text it has always used, caps memory while hashing a request full of large images, and checks that a repeat of a request whose max_tokens LiteLLM lowered is served from the cache on async, sync and no-cache paths and through the proxy. * perf(caching): hash cache keys piece by piece and reuse the lookup key on every write Requests carrying large base64 images no longer build the whole request as one string to hash it. Only the parts holding a large string are walked, so small requests stay at C speed, and the hashed bytes are unchanged so existing cache entries and the Rust cache reader keep hitting. The key is computed once before max_tokens is clamped (async, sync, and when the read is skipped via no-cache), and every cache write reuses it, so a clamped request is stored under the key its identical repeat looks up. * fix(caching): drop a comment that restated the cache check and measure only the key's own memory in the test * test(code-quality): allow the depth-capped cache key walkers in the recursion detector |
||
|---|---|---|
| .. | ||
| response_cache_case.py | ||
| test_cache_max_messages.py | ||
| test_embedding_file_block_cache.py | ||
| test_evicted_client_closer_real_io.py | ||
| test_in_memory_cache_heap_bound.py | ||
| test_prompt_cache_alert_streaks_real_io.py | ||
| test_redis_cache_non_tls_ssl_settings.py | ||
| test_response_cache_chaos.py | ||
| test_response_cache_empty_output.py | ||
| test_response_cache_large_payload_key.py | ||
| test_response_cache_model_group_key.py | ||
| test_response_cache_stream_replay.py | ||
| test_valkey_semantic_cache_real_io.py | ||