Create a new video generation job by editing a source video or existing generated video. Args: prompt: Text prompt that describes how to edit the source video. video: Reference to the completed video to edit. extra_headers: Send extra headers
(
self,
*,
prompt: str,
video: video_edit_params.Video,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = not_given,
)
| 433 | ) |
| 434 | |
| 435 | def edit( |
| 436 | self, |
| 437 | *, |
| 438 | prompt: str, |
| 439 | video: video_edit_params.Video, |
| 440 | class="cm"># Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. |
| 441 | class="cm"># The extra values given here take precedence over values defined on the client or passed to this method. |
| 442 | extra_headers: Headers | None = None, |
| 443 | extra_query: Query | None = None, |
| 444 | extra_body: Body | None = None, |
| 445 | timeout: float | httpx.Timeout | None | NotGiven = not_given, |
| 446 | ) -> Video: |
| 447 | class="st">""" |
| 448 | Create a new video generation job by editing a source video or existing |
| 449 | generated video. |
| 450 | |
| 451 | Args: |
| 452 | prompt: Text prompt that describes how to edit the source video. |
| 453 | |
| 454 | video: Reference to the completed video to edit. |
| 455 | |
| 456 | extra_headers: Send extra headers |
| 457 | |
| 458 | extra_query: Add additional query parameters to the request |
| 459 | |
| 460 | extra_body: Add additional JSON properties to the request |
| 461 | |
| 462 | timeout: Override the client-level default timeout for this request, in seconds |
| 463 | class="st">""" |
| 464 | body = deepcopy_with_paths( |
| 465 | { |
| 466 | class="st">"prompt": prompt, |
| 467 | class="st">"video": video, |
| 468 | }, |
| 469 | [[class="st">"video"]], |
| 470 | ) |
| 471 | files = extract_files(cast(Mapping[str, object], body), paths=[[class="st">"video"]]) |
| 472 | class="cm"># It should be noted that the actual Content-Type header that will be |
| 473 | class="cm"># sent to the server will contain a `boundary` parameter, e.g. |
| 474 | class="cm"># multipart/form-data; boundary=---abc-- |
| 475 | extra_headers = {class="st">"Content-Type": class="st">"multipart/form-data", **(extra_headers or {})} |
| 476 | return self._post( |
| 477 | class="st">"/videos/edits", |
| 478 | body=maybe_transform(body, video_edit_params.VideoEditParams), |
| 479 | files=files, |
| 480 | options=make_request_options( |
| 481 | extra_headers=extra_headers, |
| 482 | extra_query=extra_query, |
| 483 | extra_body=extra_body, |
| 484 | timeout=timeout, |
| 485 | security={class="st">"bearer_auth": True}, |
| 486 | ), |
| 487 | cast_to=Video, |
| 488 | ) |
| 489 | |
| 490 | def extend( |
| 491 | self, |