1919)
2020from ..._base_client import make_request_options
2121from ...types .generation import Generation
22- from ...types .generations import video_create_params , video_reframe_params
22+ from ...types .generations import video_create_params , video_modify_params , video_reframe_params
2323
2424__all__ = ["VideoResource" , "AsyncVideoResource" ]
2525
@@ -119,6 +119,79 @@ def create(
119119 cast_to = Generation ,
120120 )
121121
122+ def modify (
123+ self ,
124+ * ,
125+ generation_type : Literal ["modify_video" ],
126+ media : video_modify_params .Media ,
127+ mode : Literal [
128+ "adhere_1" ,
129+ "adhere_2" ,
130+ "adhere_3" ,
131+ "flex_1" ,
132+ "flex_2" ,
133+ "flex_3" ,
134+ "reimagine_1" ,
135+ "reimagine_2" ,
136+ "reimagine_3" ,
137+ ],
138+ model : Literal ["ray-2" ],
139+ callback_url : str | NotGiven = NOT_GIVEN ,
140+ first_frame : video_modify_params .FirstFrame | NotGiven = NOT_GIVEN ,
141+ prompt : str | NotGiven = NOT_GIVEN ,
142+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
143+ # The extra values given here take precedence over values defined on the client or passed to this method.
144+ extra_headers : Headers | None = None ,
145+ extra_query : Query | None = None ,
146+ extra_body : Body | None = None ,
147+ timeout : float | httpx .Timeout | None | NotGiven = NOT_GIVEN ,
148+ ) -> Generation :
149+ """
150+ Modify a video with style transfer and prompt-based editing
151+
152+ Args:
153+ media: The image entity object
154+
155+ mode: The mode of the modify video
156+
157+ model: The model used for the modify video
158+
159+ callback_url: The callback URL of the generation, a POST request with Generation object will
160+ be sent to the callback URL when the generation is dreaming, completed, or
161+ failed
162+
163+ first_frame: The image entity object
164+
165+ prompt: The prompt of the generation
166+
167+ extra_headers: Send extra headers
168+
169+ extra_query: Add additional query parameters to the request
170+
171+ extra_body: Add additional JSON properties to the request
172+
173+ timeout: Override the client-level default timeout for this request, in seconds
174+ """
175+ return self ._post (
176+ "/generations/video/modify" ,
177+ body = maybe_transform (
178+ {
179+ "generation_type" : generation_type ,
180+ "media" : media ,
181+ "mode" : mode ,
182+ "model" : model ,
183+ "callback_url" : callback_url ,
184+ "first_frame" : first_frame ,
185+ "prompt" : prompt ,
186+ },
187+ video_modify_params .VideoModifyParams ,
188+ ),
189+ options = make_request_options (
190+ extra_headers = extra_headers , extra_query = extra_query , extra_body = extra_body , timeout = timeout
191+ ),
192+ cast_to = Generation ,
193+ )
194+
122195 def reframe (
123196 self ,
124197 * ,
@@ -310,6 +383,79 @@ async def create(
310383 cast_to = Generation ,
311384 )
312385
386+ async def modify (
387+ self ,
388+ * ,
389+ generation_type : Literal ["modify_video" ],
390+ media : video_modify_params .Media ,
391+ mode : Literal [
392+ "adhere_1" ,
393+ "adhere_2" ,
394+ "adhere_3" ,
395+ "flex_1" ,
396+ "flex_2" ,
397+ "flex_3" ,
398+ "reimagine_1" ,
399+ "reimagine_2" ,
400+ "reimagine_3" ,
401+ ],
402+ model : Literal ["ray-2" ],
403+ callback_url : str | NotGiven = NOT_GIVEN ,
404+ first_frame : video_modify_params .FirstFrame | NotGiven = NOT_GIVEN ,
405+ prompt : str | NotGiven = NOT_GIVEN ,
406+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
407+ # The extra values given here take precedence over values defined on the client or passed to this method.
408+ extra_headers : Headers | None = None ,
409+ extra_query : Query | None = None ,
410+ extra_body : Body | None = None ,
411+ timeout : float | httpx .Timeout | None | NotGiven = NOT_GIVEN ,
412+ ) -> Generation :
413+ """
414+ Modify a video with style transfer and prompt-based editing
415+
416+ Args:
417+ media: The image entity object
418+
419+ mode: The mode of the modify video
420+
421+ model: The model used for the modify video
422+
423+ callback_url: The callback URL of the generation, a POST request with Generation object will
424+ be sent to the callback URL when the generation is dreaming, completed, or
425+ failed
426+
427+ first_frame: The image entity object
428+
429+ prompt: The prompt of the generation
430+
431+ extra_headers: Send extra headers
432+
433+ extra_query: Add additional query parameters to the request
434+
435+ extra_body: Add additional JSON properties to the request
436+
437+ timeout: Override the client-level default timeout for this request, in seconds
438+ """
439+ return await self ._post (
440+ "/generations/video/modify" ,
441+ body = await async_maybe_transform (
442+ {
443+ "generation_type" : generation_type ,
444+ "media" : media ,
445+ "mode" : mode ,
446+ "model" : model ,
447+ "callback_url" : callback_url ,
448+ "first_frame" : first_frame ,
449+ "prompt" : prompt ,
450+ },
451+ video_modify_params .VideoModifyParams ,
452+ ),
453+ options = make_request_options (
454+ extra_headers = extra_headers , extra_query = extra_query , extra_body = extra_body , timeout = timeout
455+ ),
456+ cast_to = Generation ,
457+ )
458+
313459 async def reframe (
314460 self ,
315461 * ,
@@ -413,6 +559,9 @@ def __init__(self, video: VideoResource) -> None:
413559 self .create = to_raw_response_wrapper (
414560 video .create ,
415561 )
562+ self .modify = to_raw_response_wrapper (
563+ video .modify ,
564+ )
416565 self .reframe = to_raw_response_wrapper (
417566 video .reframe ,
418567 )
@@ -425,6 +574,9 @@ def __init__(self, video: AsyncVideoResource) -> None:
425574 self .create = async_to_raw_response_wrapper (
426575 video .create ,
427576 )
577+ self .modify = async_to_raw_response_wrapper (
578+ video .modify ,
579+ )
428580 self .reframe = async_to_raw_response_wrapper (
429581 video .reframe ,
430582 )
@@ -437,6 +589,9 @@ def __init__(self, video: VideoResource) -> None:
437589 self .create = to_streamed_response_wrapper (
438590 video .create ,
439591 )
592+ self .modify = to_streamed_response_wrapper (
593+ video .modify ,
594+ )
440595 self .reframe = to_streamed_response_wrapper (
441596 video .reframe ,
442597 )
@@ -449,6 +604,9 @@ def __init__(self, video: AsyncVideoResource) -> None:
449604 self .create = async_to_streamed_response_wrapper (
450605 video .create ,
451606 )
607+ self .modify = async_to_streamed_response_wrapper (
608+ video .modify ,
609+ )
452610 self .reframe = async_to_streamed_response_wrapper (
453611 video .reframe ,
454612 )
0 commit comments