Repository navigation
Studio: accept OpenAI video_url content parts on /v1/chat/completions - #10439
Conversation
|
@codex review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b41dba1179
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
b41dba1 to
cfa1037
Compare
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: cfa1037472
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
cfa1037 to
e89700b
Compare
|
Codex Review: Didn't find any major issues. 🚀 Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
main already carries the input_audio part and its lift in studio/backend/models/inference.py and routes/inference.py, so this now overlaps there and no longer merges cleanly; could you rebase and narrow it to the video_url part plus its admission pricing, leaving the speech-model refusal and monitor-row changes for a separate branch? |
e89700b to
4b51c40
Compare
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4b51c405b1
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
4b51c40 to
c8c4bd2
Compare
|
Done — rebased onto latest The What remains is the One addition outside that list, which I would rather flag than slip past you. Registering The same reasoning applies to |
|
Codex Review: Didn't find any major issues. Already looking forward to the next diff. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
Codex Review: Didn't find any major issues. Delightful! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
…block the loggers stub for PR unslothai#10439
…-illegal path test for PR unslothai#10439
|
@codex review |
1 similar comment
|
@codex review |
|
Codex Review: Didn't find any major issues. Another round soon, please! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
/v1/chat/completionsrejected an OpenAI-shapedvideo_urlcontent part. The part is not in_KNOWN_CONTENT_PART_TAGS, so it parsed asUnknownContentPartand_reject_unsupported_content_partsrefused it:The only way to send a clip was Unsloth's own top-level
video_base64field, which is an[x-unsloth]extension that no OpenAI-compatible client emits. Studio's frontend was its only caller. Fixes the GGUF part of #10389.video_urlis not in the official OpenAI spec. It is the de-facto convention that vLLM and the llama.cpp-compatible ecosystem settled on,{"type": "video_url", "video_url": {"url": ...}}, and it is what OpenAI-compatible clients send when they send video at all.What changed
video_urlparts.VideoContentPartjoins theContentPartunion, and_translate_video_partsrewrites each part in place as llama.cpp's owninput_videojust before dispatch. This translation is required rather than cosmetic: llama-server acceptsimage_url,input_audioandinput_videoand throwsunsupported content[].typefor anything else, and the upstream PR adding the alias (ggml-org/llama.cpp#27921) is still open. Frame sampling stays with llama-server. A clip on any non-user message is refused, since llama-server renders the media marker into whichever turn carried it.Data URIs only.
input_videoalways carriesdata. A remotehttp(s)URL is refused with a 400, at the pre-switch validation and again at the dispatch boundary. llama-server, not Studio, would perform the download, and its client setsset_follow_location(true)(common/http.h) and re-resolves the hostname itself, so a public URL that redirects to a private address defeats any check made on this side. Guarding the shape is not soundly possible; refusing it is. #11010 tracks the pinned fetch that would let images and video both accept a remote URL safely, and remote video can return on top of it.Both spellings behave identically.
_request_has_videoreads the legacy field and the parts together, so external-provider routing, the non-GGUF path, the pre-switch capability gate, tool passthrough, the size caps and token counting all behave the same whichever spelling the client used.Non-GGUF.
_local_video_clipreads both spellings, so a transformers or MLX model that servesvideo_base64serves avideo_urlpart identically.Routes that cannot serve a clip. Registering
video_urlmakes the tag known, which removes the unknown-part refusal that some routes were relying on. The preview route refuses a clip in its preflight, before the checkpoint load that the refusal would otherwise follow, and/audio/generaterefuses one instead of dropping it and speaking the text alone.URL schemes.
handle_mediatreats the one string it finds the same way whichever key carried it, and honoursfile://when llama-server runs with--media-path, so forwarding a clip as opaque payload does not neutralise its scheme. Anything that is not a data URI or bare base64 is refused by name.Admission accounting. The llama admission estimator prices a
video_urlclip like the legacy field, matching both the pre- and post-translation spellings so the server-side tool loop's recost does not price the payload as prompt text. Every clip is base64, so the 64 MB cap applies uniformly. Rolling-context trimming treatsvideo_urlas unpriced media.Validation
studio/backend/tests/test_video_chat_completions_behaviour.pydrives the real router throughTestClientand asserts status codes and the body dispatched to llama-server, rather than asserting that a line is present inroutes/inference.py. Every route case is parametrised over both spellings, so the invariant above is tested rather than described. Each fix is mutation-checked: reverting the production line it covers fails that test and only that test.It covers the URL forms (lower and upper case data URI, no comma, bare base64,
http,https, uppercase scheme,file://,ftp://, bare path, malformed authority), several clips in a turn and clips on older turns, each backend cell, each refusing route, message roles, the cap boundary and one over, admission charged once, and the still-unknown part type so the catch-all did not widen.Cross-platform, Python 3.12 with CPU torch:
ubuntu-latest(x64 Linux)macos-15(Apple Silicon)windows-latest(x64 Windows)Full backend suite on Linux, CI shape, this branch against its merge base: the differing files run clean in isolation on both sides, and the same seven flaky tests (
checkpoint_compaction,account_tool_confinement,hf_xet_fallback) fail identically on base and head. Zero new failures.Backend grid, both spellings:
UI
No screenshots: this change has no UI-visible effect, and a before/after pair would be two identical images.
studio/frontendis untouched, and the frontend only ever sends the legacyvideo_base64field as a data URI (chat-adapter.ts), never avideo_urlpart or a remote URL, so none of the new refusals are reachable from the UI. Driving the exact bodies the frontend sends through the real route onmainand on this branch produces byte-identical dispatch and identical status codes, and the admission figure behind the context-usage indicator is unchanged (10005 on both).Risks and tradeoffs
Remote
video_urlURLs are not supported, by choice, as above. This is stricter than the image path, where a remoteimage_urlis currently forwarded to llama-server on the GGUF path; that is pre-existing onmainand tracked in #11010 rather than changed here.The
video_urlpart is GGUF and MLX only, by way ofinput_videoand_local_video_cliprespectively. There is no OS-dependent code in this change, and no GPU-vendor branching.