Engel Nyst 1 rok temu
rodzic
commit
bde978cf0f
1 zmienionych plików z 7 dodań i 3 usunięć
  1. 7 3
      openhands/llm/llm.py

+ 7 - 3
openhands/llm/llm.py

@@ -91,9 +91,13 @@ class LLM(RetryMixin, DebugMixin):
         # litellm actually uses base Exception here for unknown model
         self.model_info: ModelInfo | None = None
 
-        if self.config.model.startswith('openrouter'):
-            self.model_info = litellm.get_model_info(self.config.model)
-        elif self.config.model.startswith('litellm_proxy/'):
+        try:
+            if self.config.model.startswith('openrouter'):
+                self.model_info = litellm.get_model_info(self.config.model)
+        except Exception as e:
+            logger.debug(f'Error getting model info: {e}')
+
+        if self.config.model.startswith('litellm_proxy/'):
             # IF we are using LiteLLM proxy, get model info from LiteLLM proxy
             # GET {base_url}/v1/model/info with litellm_model_id as path param
             response = requests.get(