The video edit endpoint parsed the multipart body but dropped the uploaded
source video, only normalizing it to an id. When a raw file is uploaded it now
flows through videos.main -> the http handler -> the provider transform, which
emits multipart/form-data with the source video as a file part, matching the
official OpenAI SDK's videos.edit wire format. Edit-by-id still egresses JSON.
A test that asserts on the error inside its own except block passes when the
call stops raising, because nothing runs the handler. That is the exact case
the test exists to catch, so the regression lands green.
Rewrites all 111 such blocks into pytest.raises, which fails when the call
succeeds, and selects PT017 in ruff-tests.toml so no new one lands.
* fix(vertex-ai): pass litellm_params to validate_environment in video handlers and implement video edit for Veo
- Pass litellm_params to validate_environment in 11 video handler call sites
(remix, create_character, get_character, edit, extension, delete) so
DB-stored Vertex AI credentials are used instead of falling back to ADC
- Implement transform_video_edit_request/response for VertexAI: fetches
source video via fetchPredictOperation then submits a new
predictLongRunning request with the video bytes/gcsUri + edit prompt
Co-authored-by: Cursor <cursoragent@cursor.com>
* fix(vertex-ai): hoist fetchPredictOperation into handlers to avoid blocking event loop
- Add get_video_edit_prefetch_params() to BaseVideoConfig (returns None)
- VertexAI overrides it to return the fetchPredictOperation URL/body
- Both sync and async video_edit handlers call this and use their shared
httpx client for the fetch, passing the result as prefetched_source_data
- transform_video_edit_request is now a pure transform with no HTTP calls
- Fix extra_body.pop() mutation by working on a shallow copy
Co-authored-by: Cursor <cursoragent@cursor.com>
* fix(vertex-ai): include prefetch call inside _handle_error try/except block
Co-authored-by: Cursor <cursoragent@cursor.com>
* fix(videos): add prefetched_source_data param to all transform_video_edit_request overrides
Co-authored-by: Cursor <cursoragent@cursor.com>
* fix(video_edit): keep transform/pre_call outside try so validation errors propagate
Move transform_video_edit_request and logging_obj.pre_call outside the
try/except that wraps HTTP calls in (async_)video_edit_handler so that
ValueError validation errors (e.g. 'source video not complete yet') are
not silently wrapped as 500s by _handle_error. The prefetch HTTP call
keeps its own try/except so its errors are still mapped through the
provider's error handler. Matches the pattern used by
video_extension_handler and video_remix_handler.
Co-authored-by: Yassin Kortam <yassin@berri.ai>
* refactor(vertex_ai): delegate get_video_edit_prefetch_params to status retrieve
Co-authored-by: Yassin Kortam <yassin@berri.ai>
* Fix varia review
* fix(video_edit): route transform errors through _handle_error
Wrap transform_video_edit_request and pre_call in the same try/except
as the HTTP call in sync and async handlers so validation failures
(e.g. source video not complete) return typed LiteLLM exceptions.
Co-authored-by: Cursor <cursoragent@cursor.com>
---------
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Yassin Kortam <yassin@berri.ai>