Skip to content

feat(virtualmodels): route image requests to vision-capable targets - #1141

Open
SantiagoDePolonia wants to merge 1 commit into
mainfrom
feat/vision-routing
Open

SantiagoDePolonia wants to merge 1 commit into
mainfrom
feat/vision-routing

Conversation

@SantiagoDePolonia

Copy link
Copy Markdown
Contributor

Part of #1104 (item 9).

Adds an opt-in vision_routing option to virtual models (config.yaml, VIRTUAL_MODELS, admin API, dashboard editor). When a request carries images (chat image_url, Responses input_image, Anthropic image blocks), only targets whose effective metadata reports vision are considered, before any strategy picks. Chained virtual models inherit the decision.

  • If no target reports vision, routing is unchanged and the image is never stripped; unknown capability counts as text-only.
  • Catalog entries listing image as an input modality now report the vision capability (an explicit flag still wins).
  • The body is inspected only when an enabled virtual model opts in, so the default hot path is unchanged.
  • Not included: failover legs after the first pick are not filtered.
  • Overlaps fix(virtualmodels): skip disabled targets instead of failing the request #1137 in balancedResolution; whichever merges second needs a small rebase.

@mintlify

mintlify Bot commented Oct 4, 2026 •

Copy link
Copy Markdown

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated
gomodel 🟢 Ready View Preview Oct 4, 2026, 6:39 PM

💡 Tip: Enable Automations to automatically generate PRs for you.

@coderabbitai

coderabbitai Bot commented Oct 4, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 21 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 4 included reviews currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: a8d8765a-23e1-4466-90ab-a8cc1c147e13
📥 Commits

Reviewing files that changed from the base of the PR and between 37e293c and ac73779.

📒 Files selected for processing (31)
  • cmd/gomodel/docs/docs.go
  • config/config.example.yaml
  • config/virtualmodels.go
  • docs/advanced/model-metadata.mdx
  • docs/features/virtual-models.mdx
  • docs/openapi.json
  • internal/admin/handler_virtualmodels.go
  • internal/core/image_input.go
  • internal/core/image_input_test.go
  • internal/modeldata/merger.go
  • internal/modeldata/merger_test.go
  • internal/server/request_model_resolution.go
  • internal/virtualmodels/balancer.go
  • internal/virtualmodels/config.go
  • internal/virtualmodels/resolve.go
  • internal/virtualmodels/service.go
  • internal/virtualmodels/snapshot.go
  • internal/virtualmodels/store_mongodb.go
  • internal/virtualmodels/store_sql.go
  • internal/virtualmodels/types.go
  • internal/virtualmodels/vision_test.go
  • tests/e2e/vision_routing_test.go
  • web/dashboard/messages/de.json
  • web/dashboard/messages/en.json
  • web/dashboard/messages/pl.json
  • web/dashboard/messages/zh-CN.json
  • web/dashboard/src/pages/models/VirtualModelEditor.svelte
  • web/dashboard/src/pages/models/routing.js
  • web/dashboard/src/pages/models/virtualModelEditor.svelte.js
  • web/dashboard/src/pages/models/vmForm.js
  • web/dashboard/tests/models-virtual-models.test.js
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 91.89189% with 6 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
internal/server/request_model_resolution.go 62.50% 3 Missing ⚠️
internal/virtualmodels/balancer.go 91.30% 2 Missing ⚠️
internal/core/image_input.go 95.83% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@greptile-apps

greptile-apps Bot commented Oct 4, 2026 •

Copy link
Copy Markdown

RetriggerConfidence Score: 4/5

[Medium risk] Adds image-aware routing to virtual model load balancing.

This PR is not ready to merge because provider-model metadata can make image routing skip an image-capable model.

Diagram
%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Request] --> B{Virtual model has vision routing?}
  B -- No --> E[Choose from viable targets]
  B -- Yes --> C{Body has an image?}
  C -- No --> E
  C -- Yes --> D[Keep targets reporting vision]
  D --> F{Any remain?}
  F -- No --> E
  F -- Yes --> G[Choose from vision targets]
  G --> H{Chained model?}
  H -- Yes --> D
  H -- No --> I[Send request]
  E --> I
Loading

Reviews (1) · Last reviewed commit: "feat(virtualmodels): route image request..."

meta.ContextWindow = model.ContextWindow
meta.MaxOutputTokens = model.MaxOutputTokens
meta.Capabilities = model.Capabilities
meta.Capabilities = catalogCapabilities(model)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Vision flag gets lost

If a catalog model lists image as an input modality and its provider-model entry has a capabilities map without vision, buildMetadata replaces the map that held the derived vision flag. When another target reports vision, image routing skips this image-capable model. Keep the derived flag unless the provider explicitly sets vision.

Comment on lines +445 to +447
if (form && form.vision_routing) {
payload.vision_routing = true;
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Saved vision setting disappears

Saving or toggling a single-target virtual model drops its existing vision_routing: true setting. Both payload builders send the flag only when there are multiple targets, though the server accepts it for one target. The setting stays off if the user adds another target later. Keep the saved flag in single-target payloads too.

@greptile-apps

greptile-apps Bot commented Oct 4, 2026

Copy link
Copy Markdown

RetriggerTREX TREX

Could not complete testing for 1 flow, faced 1 obstacle.

Obstacles faced

  • No config-managed virtual model exists; add a disposable one to check its read-only setting.

To reduce obstacles, configure your TREX environment.

What we tested

  • Incomplete — Vision routing setting in virtual models ▶

This branch was successfully deployed

1 active deployment
staging - docs — ac73779e Deployed Oct 4, 2026 by mintlify[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants