Create an extension of a completed video. Args: prompt: Updated text prompt that directs the extension generation. seconds: Length of the newly generated extension segment in seconds (allowed values: 4, 8, 12, 16, 20). video: Reference
(
self,
*,
prompt: str,
seconds: VideoSeconds,
video: video_extend_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,
)
| 488 | ) |
| 489 | |
| 490 | def extend( |
| 491 | self, |
| 492 | *, |
| 493 | prompt: str, |
| 494 | seconds: VideoSeconds, |
| 495 | video: video_extend_params.Video, |
| 496 | # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. |
| 497 | # The extra values given here take precedence over values defined on the client or passed to this method. |
| 498 | extra_headers: Headers | None = None, |
| 499 | extra_query: Query | None = None, |
| 500 | extra_body: Body | None = None, |
| 501 | timeout: float | httpx.Timeout | None | NotGiven = not_given, |
| 502 | ) -> Video: |
| 503 | """ |
| 504 | Create an extension of a completed video. |
| 505 | |
| 506 | Args: |
| 507 | prompt: Updated text prompt that directs the extension generation. |
| 508 | |
| 509 | seconds: Length of the newly generated extension segment in seconds (allowed values: 4, |
| 510 | 8, 12, 16, 20). |
| 511 | |
| 512 | video: Reference to the completed video to extend. |
| 513 | |
| 514 | extra_headers: Send extra headers |
| 515 | |
| 516 | extra_query: Add additional query parameters to the request |
| 517 | |
| 518 | extra_body: Add additional JSON properties to the request |
| 519 | |
| 520 | timeout: Override the client-level default timeout for this request, in seconds |
| 521 | """ |
| 522 | body = deepcopy_with_paths( |
| 523 | { |
| 524 | "prompt": prompt, |
| 525 | "seconds": seconds, |
| 526 | "video": video, |
| 527 | }, |
| 528 | [["video"]], |
| 529 | ) |
| 530 | files = extract_files(cast(Mapping[str, object], body), paths=[["video"]]) |
| 531 | # It should be noted that the actual Content-Type header that will be |
| 532 | # sent to the server will contain a `boundary` parameter, e.g. |
| 533 | # multipart/form-data; boundary=---abc-- |
| 534 | extra_headers = {"Content-Type": "multipart/form-data", **(extra_headers or {})} |
| 535 | return self._post( |
| 536 | "/videos/extensions", |
| 537 | body=maybe_transform(body, video_extend_params.VideoExtendParams), |
| 538 | files=files, |
| 539 | options=make_request_options( |
| 540 | extra_headers=extra_headers, |
| 541 | extra_query=extra_query, |
| 542 | extra_body=extra_body, |
| 543 | timeout=timeout, |
| 544 | security={"bearer_auth": True}, |
| 545 | ), |
| 546 | cast_to=Video, |
| 547 | ) |