Skip to content

πŸ™Œ OpenHands: AI-Driven Development

feat(llm): update prompt caching list to include new sonnet (#4552)

Xingyao Wangdcd4b04f5771
diff --git a/openhands/llm/llm.py b/openhands/llm/llm.py
index 698f4c4a86..ea62871850 100644
--- a/openhands/llm/llm.py
+++ b/openhands/llm/llm.py
@@ -45,11 +45,9 @@ LLM_RETRY_EXCEPTIONS: tuple[type[Exception], ...] = (
# remove this when we gemini and deepseek are supported
CACHE_PROMPT_SUPPORTED_MODELS = [
'claude-3-5-sonnet-20240620',
+ 'claude-3-5-sonnet-20241022',
'claude-3-haiku-20240307',
'claude-3-opus-20240229',
- 'anthropic/claude-3-opus-20240229',
- 'anthropic/claude-3-haiku-20240307',
- 'anthropic/claude-3-5-sonnet-20240620',
]
@@ -259,7 +257,10 @@ class LLM(RetryMixin, DebugMixin):
self.config.caching_prompt is True
and self.model_info is not None
and self.model_info.get('supports_prompt_caching', False)
- and self.config.model in CACHE_PROMPT_SUPPORTED_MODELS
+ and (
+ self.config.model in CACHE_PROMPT_SUPPORTED_MODELS
+ or self.config.model.split('/')[-1] in CACHE_PROMPT_SUPPORTED_MODELS
+ )
)
def _post_completion(self, response: ModelResponse) -> None: