Skip to content

fix(vision): honor model.supports_vision in vision_analyze + browser_vision - #34562

Merged
teknium1 merged 6 commits into
mainfrom
hermes/hermes-adf8ff37
May 29, 2026
Merged

fix(vision): honor model.supports_vision in vision_analyze + browser_vision#34562
teknium1 merged 6 commits into
mainfrom
hermes/hermes-adf8ff37

Conversation

@teknium1

Copy link
Copy Markdown
Contributor

Summary

Vision tools now honor the user's model.supports_vision override, so a vision-capable model on a custom/local provider sees images directly instead of being forced through the auxiliary vision LLM. browser_vision gains a native fast path it never had — previously it always called an aux model regardless of provider.

Salvage of #29987 by @tillfalko, cherry-picked onto current main with authorship preserved, plus a consolidation refactor on top.

Root cause

The fast-path gate keyed only on _supports_media_in_tool_results(), a static provider allowlist. Custom/unknown providers return False there, so even when a user explicitly declared their model vision-capable, vision_analyze fell through to the aux LLM. browser_vision had no fast path at all.

Changes

  • tools/vision_tools.py: new _should_use_native_vision_fast_path() — single source of truth for the gate (native routing AND (provider allowlist OR supports_vision override)). vision_analyze calls it in 3 lines.
  • tools/browser_tool.py: browser_vision uses the shared helper; thin multimodal-envelope decoration instead of a duplicated gate block. Return type corrected to Union[str, Dict[str, Any]]; tool description updated for native-vision routing.
  • tests/: focused coverage for the override path and the text-mode-wins invariant.
  • scripts/release.py: AUTHOR_MAP entry for the contributor.

Text-mode routing still wins over the override (explicit image_input_mode: text blocks the fast path).

Validation

Scenario Fast path fires?
custom provider, no override No (aux LLM)
custom provider + supports_vision: true Yes (native)
override true but image_input_mode: text No (aux LLM)
openrouter, native mode Yes (native)

Targeted suite: 49/49 pass. E2E verified the real resolution chain (no helper mocking) for all four scenarios above.

Closes #29987.

Infographic

vision-supports-vision

tillfalko and others added 6 commits May 29, 2026 03:39
…elper

The fast-path decision (native routing + provider allowlist OR
supports_vision override) lived inline in vision_analyze and was copied
into browser_vision. Extract it to _should_use_native_vision_fast_path()
so both tools share one source of truth.

- vision_tools: gate logic now one helper; vision_analyze calls it in 3 lines
- browser_tool: thin envelope decoration over the shared helper, not a copy
- browser_vision typed Union[str, Dict] to match its real return shape
- tests slimmed to target the override path + text-mode-wins invariant
@github-actions

Copy link
Copy Markdown
Contributor

🔎 Lint report: hermes/hermes-adf8ff37 vs origin/main

ruff

Total: 0 on HEAD, 0 on base (➖ 0)

🆕 New issues: none

✅ Fixed issues: none

Unchanged: 0 pre-existing issues carried over.

ty (type checker)

Total: 9444 on HEAD, 9435 on base (🆕 +9)

🆕 New issues (2):

Rule Count
invalid-argument-type 2
First entries
tests/tools/test_browser_lightpanda.py:481: [invalid-argument-type] invalid-argument-type: Argument to function `loads` is incorrect: Expected `str | bytes | bytearray`, found `str | dict[str, Any]`
tests/tools/test_browser_console.py:322: [invalid-argument-type] invalid-argument-type: Argument to function `loads` is incorrect: Expected `str | bytes | bytearray`, found `str | dict[str, Any]`

✅ Fixed issues: none

Unchanged: 4899 pre-existing issues carried over.

Diagnostics are surfaced as warnings — this check never fails the build.

@alt-glitch alt-glitch added type/bug Something isn't working comp/tools Tool registry, model_tools, toolsets tool/vision Vision analysis and image generation tool/browser Browser automation (CDP, Playwright) P2 Medium — degraded but workaround exists labels May 29, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Salvage of #29987 by @tillfalko onto current main. Supersedes #29987. Adds browser_vision native fast path not present in the original.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/tools Tool registry, model_tools, toolsets P2 Medium — degraded but workaround exists tool/browser Browser automation (CDP, Playwright) tool/vision Vision analysis and image generation type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants