소스 검색

Fix issue #4809: [Bug]: Model does not support image upload when usin… (#4810)

Co-authored-by: openhands <openhands@all-hands.dev>
Xingyao Wang 1 년 전
부모
커밋
4405b109e3
4개의 변경된 파일12개의 추가작업 그리고 4개의 파일을 삭제
  1. 0 1
      docs/modules/usage/how-to/gui-mode.md
  2. 2 0
      openhands/__init__.py
  3. 8 3
      openhands/llm/llm.py
  4. 2 0
      pyproject.toml

+ 0 - 1
docs/modules/usage/how-to/gui-mode.md

@@ -58,4 +58,3 @@ The main interface consists of several key components:
 3. Use one of the recommended models, as described in the [LLMs section](usage/llms/llms.md).
 
 Remember, the GUI mode of OpenHands is designed to make your interaction with the AI assistant as smooth and intuitive as possible. Don't hesitate to explore its features to maximize your productivity.
-

+ 2 - 0
openhands/__init__.py

@@ -6,12 +6,14 @@ __package_name__ = 'openhands_ai'
 def get_version():
     try:
         from importlib.metadata import PackageNotFoundError, version
+
         return version(__package_name__)
     except (ImportError, PackageNotFoundError):
         pass
 
     try:
         from pkg_resources import DistributionNotFound, get_distribution
+
         return get_distribution(__package_name__).version
     except (ImportError, DistributionNotFound):
         pass

+ 8 - 3
openhands/llm/llm.py

@@ -342,9 +342,14 @@ class LLM(RetryMixin, DebugMixin):
         # but model_info will have the correct value for some reason.
         # we can go with it, but we will need to keep an eye if model_info is correct for Vertex or other providers
         # remove when litellm is updated to fix https://github.com/BerriAI/litellm/issues/5608
-        return litellm.supports_vision(self.config.model) or (
-            self.model_info is not None
-            and self.model_info.get('supports_vision', False)
+        # Check both the full model name and the name after proxy prefix for vision support
+        return (
+            litellm.supports_vision(self.config.model)
+            or litellm.supports_vision(self.config.model.split('/')[-1])
+            or (
+                self.model_info is not None
+                and self.model_info.get('supports_vision', False)
+            )
         )
 
     def is_caching_prompt_active(self) -> bool:

+ 2 - 0
pyproject.toml

@@ -92,6 +92,7 @@ reportlab = "*"
 [tool.coverage.run]
 concurrency = ["gevent"]
 
+
 [tool.poetry.group.runtime.dependencies]
 jupyterlab = "*"
 notebook = "*"
@@ -122,6 +123,7 @@ ignore = ["D1"]
 [tool.ruff.lint.pydocstyle]
 convention = "google"
 
+
 [tool.poetry.group.evaluation.dependencies]
 streamlit = "*"
 whatthepatch = "*"