fix claude ttl - #21996
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Greptile SummaryThis PR fixes a bug where the
Confidence Score: 4/5
|
| Filename | Overview |
|---|---|
| litellm/litellm_core_utils/prompt_templates/factory.py | Adds model=model to all 8 _get_cache_point_block() call sites to enable TTL support for Claude 4.5 models. The change is correct and consistent, but lacks test coverage. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A["factory.py: _bedrock_converse_messages_pt()"] -->|"model=model (NEW)"| B["AmazonConverseConfig._get_cache_point_block()"]
C["factory.py: _bedrock_converse_messages_pt_async()"] -->|"model=model (NEW)"| B
B --> D{"model is not None?"}
D -->|Yes| E["is_claude_4_5_on_bedrock(model)"]
D -->|No - was always this path before fix| F["Return cache_point without TTL"]
E -->|True| G["Preserve TTL in cache_point"]
E -->|False| F
Last reviewed commit: fc16140
Review1. Does this PR fix the issue it describes? 2. Has this issue already been solved elsewhere? 3. Are there other PRs addressing the same problem? 4. Are there other issues this potentially closes? ✅ LGTM — small, focused fix completing the TTL feature. Test added. |
|
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
Relevant issues
Fixes follow-up issue for #20338 - Model parameter not passed to
_get_cache_point_blockmethodPre-Submission checklist
Please complete all items before asking a LiteLLM maintainer to review your PR
tests/litellm/directory, Adding at least 1 test is a hard requirement - see detailsmake test-unit@greptileaiand received a Confidence Score of at least 4/5 before requesting a maintainer reviewCI (LiteLLM team)
Branch creation CI run
Link:
CI run for the last commit
Link:
Merge / cherry-pick CI run
Links:
Type
🐛 Bug Fix
Changes
Summary
Fixed TTL parameter not being effective for Claude 4.5 models in Bedrock Converse API by ensuring the
modelparameter is properly passed to_get_cache_point_block()method.Problem
PR #20338 added support for TTL (Time-To-Live) field in prompt caching for Claude 4.5 models. However, the
_get_cache_point_block()method inconverse_transformation.pychecks if the current model is a Claude 4 series model using_is_claude_4_5_on_bedrock(model). When this method is called fromfactory.py(or other locations), themodelparameter was not passed, resulting inmodel=Noneand the TTL parameter not taking effect.Solution
factory.pyto pass themodelparameter when calling_get_cache_point_block()Files Modified
litellm/llms/bedrock/chat/factory.py(or the relevant file where_get_cache_point_blockis called without model parameter)modelparameter from the available contextTesting