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

This commit is contained in:
Xingyao Wang 2024-10-25 07:36:35 -05:00 committed by GitHub
parent 78eacc4489
commit dcd4b04f57
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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: