Repository navigation
feat(media): add per-target Dynamo processing and judge image limits #790
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
ayushag-nv
wants to merge
26
commits into
main
Choose a base branch
from
ayushag/judge-vision-routing-support
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+2,541
−106
Draft
Changes from all commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
0619e1d
test(translation): cover normalized Responses image encoding
ayushag-nv 8e92e94
feat(classifier): control images shown to the judge
ayushag-nv ff33386
docs(vision): demonstrate Cosmos judge routing to vision models
ayushag-nv 56cd9c8
fix(examples): add license header to vision judge demo
ayushag-nv bf5c5c1
perf(classifier): skip copying omitted judge images
ayushag-nv bff3610
chore(vision): remove judge demo artifacts
ayushag-nv 1a5e740
test(classifier): simplify judge image limit coverage
ayushag-nv 335fb86
fix(classifier): enforce judge image caps without sampling
ayushag-nv 6902672
test(translation): cover normalized Responses image encoding
ayushag-nv 1f08fab
feat(classifier): control images shown to the judge
ayushag-nv 4d53754
docs(vision): demonstrate Cosmos judge routing to vision models
ayushag-nv 91d620b
fix(examples): add license header to vision judge demo
ayushag-nv deec427
perf(classifier): skip copying omitted judge images
ayushag-nv 9137f29
feat(translation): preserve video inputs across provider formats
ayushag-nv efefe07
feat(media): prepare endpoint media in the LLM client
ayushag-nv 91b9e3c
feat(runner): configure media policies per target
ayushag-nv f66ebf2
build(media): include FFmpeg runtime and release dependencies
ayushag-nv e9c2ae8
docs(media): add a reproducible image and video routing example
ayushag-nv e562287
chore(media): merge updated judge image controls
ayushag-nv 272c931
refactor(media): simplify video dispatch and routing example
ayushag-nv 702997b
refactor(media): flatten video modes and trim example configuration
ayushag-nv 0e7f139
fix(media): enforce image caps without selecting frames
ayushag-nv ca9657a
refactor(client): replace switchyard-media with Dynamo multimodal pro…
ayushag-nv c782948
fix(media): reconcile tests and removed demos after rebase
ayushag-nv 82929f9
refactor(media): simplify preparation tests and documentation
ayushag-nv 6d51328
chore(media): use published dynamo-multimodal 0.2.0
ayushag-nv File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,100 @@ | ||
| # Media settings | ||
|
|
||
| Configure `[targets.<name>.media]` to prepare images and videos for an endpoint. | ||
| The LLM client prepares a separate outgoing body for each judge, answer, or | ||
| fallback call. The original request stays available to the other targets. | ||
| Omit the media table to keep existing behavior. | ||
|
|
||
| ## Configure judge and answer inputs | ||
|
|
||
| This example gives the judge one small video frame and the answer up to eight. | ||
| Still images sent to the judge are resized to fit 384 pixels. The judge rejects | ||
| requests with more than one image or video; choose the input before routing. | ||
|
|
||
| ```toml | ||
| [targets.judge.media] | ||
| image_max_edge = 384 | ||
| max_images = 1 | ||
| video = "frames" | ||
| video_max_frames = 1 | ||
| frame_max_edge = 384 | ||
|
|
||
| [targets.answer.media] | ||
| video = "frames" | ||
| video_max_frames = 8 | ||
| frame_max_edge = 768 | ||
| ``` | ||
|
|
||
| For a text-only target, set `max_images = 0` and `video = "omit"`. | ||
| The route's `judge_max_images` setting affects existing image blocks only; | ||
| video processing belongs in the target's media settings. | ||
|
|
||
| | Setting | Default | Behavior | | ||
| |---|---|---| | ||
| | `image_max_edge` | unset | Resize still images to fit this edge (1–4096 pixels); preserve aspect ratio and never upscale. | | ||
| | `max_images` | unset | Maximum images and requested video frames per call (0–128). Unset allows all; zero omits them; a positive limit rejects excess input. | | ||
| | `video` | `passthrough` | Video handling mode; see below. | | ||
| | `video_max_frames` | 4 | Maximum samples per video (1–64). | | ||
| | `frame_max_edge` | 640 | Maximum frame edge (1–4096 pixels); preserve aspect ratio and never upscale. | | ||
| | `max_input_bytes` | 33554432 | Maximum downloaded or decoded inline bytes per locally processed source (1 byte–256 MiB). | | ||
| | `max_output_bytes` | 33554432 | Maximum combined prepared image bytes before base64 encoding (1 byte–256 MiB). | | ||
| | `timeout_ms` | 30000 | Preparation deadline, including downloads, queueing, and decoding (1–300000 ms). | | ||
|
|
||
| Image limits cover all selected messages and nested tool results. A positive | ||
| `max_images` reserves `video_max_frames` images per video before downloading it, | ||
| even if the clip later yields fewer frames. Excess input returns HTTP 400, | ||
| including on a fail-open judge. The limit never selects or reorders images. | ||
|
|
||
| ## Video modes | ||
|
|
||
| | Mode | Outgoing content | | ||
| |---|---| | ||
| | `passthrough` | Keep the video block produced by translation. | | ||
| | `frames` | Replace each video with timestamped JPEG images. | | ||
| | `video_url` | Chat Completions `video_url` block. Requires an `openai_chat` target. | | ||
| | `file` | Gemini-on-Inference-Hub video `file` block. Requires an `openai_chat` target. | | ||
| | `omit` | Replace videos with text markers without fetching them. | | ||
|
|
||
| Native modes forward the existing URL or inline data without fetching or | ||
| transcoding it. They do not count toward `max_images`. The endpoint must support | ||
| the selected format. Responses `input_video` and Anthropic video source blocks | ||
| are intermediate formats; use `frames` for endpoints that accept images only. | ||
|
|
||
| Frame sampling uses uniformly spaced indices on the video track, including its | ||
| endpoints. One sample uses the first frame; a short clip returns at most its | ||
| available frames. Timestamps are presentation times, and longer audio does not | ||
| extend sampling. Uniform sampling can miss brief events. | ||
|
|
||
| ## Sources and limits | ||
|
|
||
| Local processing accepts public HTTP(S) URLs and base64 data URIs. Use inline | ||
| data for local files. Local paths, private network URLs, and provider-managed | ||
| file IDs cannot be fetched. Downloads validate DNS and redirects and receive no | ||
| inference credentials or environment proxy settings. | ||
|
|
||
| Still images support PNG, JPEG, and WebP. Resizing applies EXIF orientation and | ||
| outputs JPEG, or PNG for transparency. Images already within the requested size | ||
| stay encoded as supplied when no orientation change is needed. Other provider | ||
| fields, including image detail and cache hints, are retained. | ||
|
|
||
| Each target reuses its own fetcher. At most 64 sources are processed per call, | ||
| and two decoding jobs run at once per client. Decoded image allocations and each | ||
| video frame's RGB buffer are limited to 128 MiB; selected video frames together | ||
| are also limited to 128 MiB after resizing. A timeout stops the caller's wait. | ||
| An active native decoder keeps its worker slot until it finishes. | ||
|
|
||
| `max_input_bytes` and `max_output_bytes` apply to locally processed media. | ||
| The server separately limits the entire incoming JSON body to 32 MiB, including | ||
| base64 overhead. Raise it with `--max-request-body-bytes`; see the | ||
| [CLI reference](../../docs/cli_reference.md). | ||
|
|
||
| ## Runtime requirements | ||
|
|
||
| Media processing uses the published `dynamo-multimodal` 0.2 release with the | ||
| `fetch` and `video-decode` features. | ||
|
|
||
| Building from source requires CMake and a C/C++ toolchain. | ||
| Video decoding requires 64-bit Linux. H.264, HEVC, VP9, and AV1 use NVDEC when | ||
| supported by the GPU and matching NVIDIA driver libraries. VP8 and VP9 also have | ||
| a CPU path through system libvpx, which is included in the server image. | ||
| Unsupported formats or missing decoders return an error. FFmpeg is not required. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is architecture decision. Should not be mentioned here. also all these source and limit points should be at max 3-4 small bullet points. No need to consume so much words for this.