Skip to content

feat(classifier): add judge image input controls - #790

Open
ayushag-nv wants to merge 7 commits into
mainfrom
ayushag/judge-vision-routing-support
Open

ayushag-nv wants to merge 7 commits into
mainfrom
ayushag/judge-vision-routing-support

Conversation

@ayushag-nv

@ayushag-nv ayushag-nv commented Sep 19, 2026 •

Copy link
Copy Markdown
Contributor

Why

Capability and custom classifiers already forward images to the judge. They need a separate image limit so a text-only judge, or a judge using fewer images, can select an answer model that still receives the original request.

Tracks SWITCH-1542.

What

  • Add judge_max_images to classifier configuration, TOML routes, and Python bindings. Unset keeps all selected images; 0 omits them; N keeps the newest N in their original order.
  • Preserve the answer request and share the judge's image limit across selected messages and nested tool results.
  • Add configuration docs and regression tests for image limits, answer preservation, fallback behavior, and Responses image encoding.

How

Apply the limit after message selection and before copying image payloads. Replace omitted images with text markers so image-only messages remain valid. Escalation mode rejects this setting. This change does not fetch, resize, or decode media.

Where to Start Review

Start with TaskInput::messages and copy_judge_block in crates/libsy/src/algorithms/llm_class.rs, then the runner and Python configuration wiring. The server test classifier_image_limits_preserve_answer_images covers the judge and answer requests together.

Test Plan

  • Server integration suite: 58 passed.
  • Python minimal bindings suite: 26 passed.
  • Workspace Clippy, Rust formatting, Ruff, and diff checks passed.
  • Strict documentation build passed after removing the demo files.

These checks cover request handling and routing behavior; they do not measure judge accuracy.

Summary by CodeRabbit

  • New Features

    • Classifier configurations now support an optional image limit for judge requests. When set, the judge receives the newest images up to that limit; unset preserves all images, and 0 excludes images.
    • Image limits are available in Python configuration interfaces and documented alongside their behavior. They are not supported in escalation mode.
  • Bug Fixes

    • Limited images in judge requests without changing the images included in answer requests. Tool-result images are included when selecting images for windowed conversations.

@github-actions

github-actions Bot commented Sep 19, 2026 •

Copy link
Copy Markdown
PR Preview Action v1.8.1

🚀 View preview at
https://NVIDIA-NeMo.github.io/Switchyard/pr-preview/pr-790/

Built to branch gh-pages at 2026-10-09 22:24 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

@ayushag-nv ayushag-nv changed the title feat(classifier): support text-only and vision judge routing feat(classifier): add judge image input controls Sep 19, 2026
Signed-off-by: ayushag <ayushag@nvidia.com>
Signed-off-by: ayushag <ayushag@nvidia.com>
Signed-off-by: ayushag <ayushag@nvidia.com>
Signed-off-by: ayushag <ayushag@nvidia.com>
Signed-off-by: ayushag <ayushag@nvidia.com>
@ayushag-nv
ayushag-nv force-pushed the ayushag/judge-vision-routing-support branch from 06c0325 to b3ba06b Compare October 9, 2026 18:18
Signed-off-by: ayushag <ayushag@nvidia.com>
Signed-off-by: ayushag <ayushag@nvidia.com>
@ayushag-nv
ayushag-nv marked this pull request as ready for review October 9, 2026 22:32
@ayushag-nv
ayushag-nv requested a review from a team as a code owner October 9, 2026 22:32
@coderabbitai

coderabbitai Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: NVIDIA-NeMo/Switchyard/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Enterprise
  • Run ID: 11298997-1d57-4e6b-b0cb-8da9e1c559f0

📥 Commits

Reviewing files that changed from the base of the PR and between fc64565 and 91d5f78.


📒 Files selected for processing (10)
  • crates/libsy/src/algorithms/llm_class.rs
  • crates/switchyard-py/src/libsy_bindings.rs
  • crates/switchyard-runner/src/algorithm.rs
  • crates/switchyard-runner/src/config.rs
  • crates/switchyard-server/tests/server.rs
  • crates/switchyard-translation/tests/request_translation.rs
  • docs/reference/toml_schema.md
  • docs/routing_algorithms/llm_classifier_routing.md
  • switchyard_rust/libsy.py
  • tests/test_libsy_minimal_bindings.py

Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 11 remain after this review.



Walkthrough

Classifier configurations now accept an optional judge_max_images limit. The limit applies to judge messages, including nested tool results, while answer requests retain the original messages. Runner configuration and Python bindings expose the setting, and tests and documentation cover its behavior.

Changes

Judge Image Budget

Layer / File(s) Summary
Build budgeted judge input
crates/libsy/src/algorithms/llm_class.rs
TaskInput builds judge messages using the optional image limit. It retains the newest images, replaces images beyond the limit with omission text, and applies the budget to nested tool results. Classifier configs add the optional setting.
Carry the setting through configuration
crates/switchyard-runner/src/algorithm.rs, crates/switchyard-py/src/libsy_bindings.rs, switchyard_rust/libsy.py
Runner route and stage configurations pass judge_max_images to classifier configs. Escalation mode rejects the setting. Python constructors accept the optional parameter.
Verify and document image limits
crates/switchyard-runner/src/config.rs, crates/switchyard-server/tests/server.rs, crates/switchyard-translation/tests/request_translation.rs, tests/test_libsy_minimal_bindings.py, docs/reference/toml_schema.md, docs/routing_algorithms/llm_classifier_routing.md
Tests cover invalid configuration, image limits, unchanged answer requests, and image request translation. Documentation describes limit behavior and the escalation-mode restriction.

Priority: ⬇️ Low

Estimated code review effort: 3 (Moderate) | ~25 minutes

Merge Risk: ⚪ Minimal · up to 91d5f

No identified issue currently blocks merging the judge image-limit change after normal checks.

Pre-merge checks | Passed 4 | Failed 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 56.82% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 44 functions across 8 files. (2 skipped: … Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: adding controls for classifier judge image inputs.

Full details: Docstring Coverage

Explanation

Docstring coverage is 56.82% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 44 functions across 8 files. (2 skipped: 2 unsupported.)



  • Fix all pre-merge checks with AI
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

I’m a rabbit with a bright-eyed plan,
I count the pictures as fast as I can.
The judge gets the newest ones in view,
The answer keeps its full image queue.
I nibble a carrot and hop away.

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

This branch has not been deployed

No deployments
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.

1 participant