mirror of
https://github.com/BerriAI/litellm.git
synced 2026-12-03 01:38:46 +00:00
* fix(caching): keep prompt cache usage on streamed cache hits A stream=true request served from the response cache rebuilt its usage from the prompt, completion and total counts only, so prompt_tokens_details and the cache read and creation counts were dropped on the replayed stream. /v1/messages clients routed to Bedrock Converse saw input_tokens equal to the whole prompt and no cache tokens on a hit. Both replays now build the usage through one helper that also restores prompt_tokens_details and the integer cache read and creation counts, skipping cached values that do not validate. * fix(caching): coerce replayed token counts the way the live usage does The replay accepted only exact ints for the token counts, so an integral float or numeric string in a cached entry became 0 where the previous replay kept it. Counts now go through pydantic int coercion and fall back only when they do not validate. |
||
|---|---|---|
| .. | ||
| adapters | ||
| context_management | ||
| messages | ||
| responses_adapters | ||
| __init__.py | ||
| conftest.py | ||
| test_anthropic_native_passthrough_spend_logging.py | ||
| test_caller_model_checks.py | ||
| test_convertible_blocks.py | ||
| test_reasoning_effort_fields.py | ||
| test_safeguards.py | ||
| test_stream_assembly.py | ||