Skip to content

πŸ™Œ OpenHands: AI-Driven Development

fix: prompt caching (#4704)

Xingyao Wang1747b3d6b235
diff --git a/openhands/llm/llm.py b/openhands/llm/llm.py
index 5fbd8da9c8..ab56418e8a 100644
--- a/openhands/llm/llm.py
+++ b/openhands/llm/llm.py
@@ -324,14 +324,15 @@ class LLM(RetryMixin, DebugMixin):
Returns:
boolean: True if prompt caching is supported and enabled for the given model.
"""
- return (
- self.config.caching_prompt is True
- and self.model_info is not None
- and self.model_info.get('supports_prompt_caching', False)
- and (
+ return self.config.caching_prompt is True and (
+ (
self.config.model in CACHE_PROMPT_SUPPORTED_MODELS
or self.config.model.split('/')[-1] in CACHE_PROMPT_SUPPORTED_MODELS
)
+ or (
+ self.model_info is not None
+ and self.model_info.get('supports_prompt_caching', False)
+ )
)
def is_function_calling_active(self) -> bool: