Преглед на файлове

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 = "*"