diff --git a/.release-please-manifest.json b/.release-please-manifest.json index a5dd041..9e5024f 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "4.16.0" + ".": "4.17.0" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index b6b14bc..f14d7b2 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 38 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/runwayml/runwayml-cfb6e42f50c5de798cb44d95bb8e1e0b378a1cad932b937b249aca35136c7758.yml -openapi_spec_hash: 2d2bb8ab56561238e5415dbbd3e4d725 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/runwayml/runwayml-a81793e83ebdccfc40ba42e5f36101fd6877703febd5f1476e8e6e9dabd505ab.yml +openapi_spec_hash: ea99f8ca625ee33071b0dc7a812fc222 config_hash: 6d8ca402de13857362ee587c404baca9 diff --git a/CHANGELOG.md b/CHANGELOG.md index 064cb33..5c5e651 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,18 @@ # Changelog +## 4.17.0 (2026-06-03) + +Full Changelog: [v4.16.0...v4.17.0](https://github.com/runwayml/sdk-python/compare/v4.16.0...v4.17.0) + +### Features + +* **api:** SD2, HH1 ([e457b11](https://github.com/runwayml/sdk-python/commit/e457b1111f63d43026298b5f9ef04f4e7f758831)) + + +### Bug Fixes + +* **client:** Make SD2 and HH1 awaitable for task output ([894c22f](https://github.com/runwayml/sdk-python/commit/894c22fb3243f2657341a63186926cd6b75311b2)) + ## 4.16.0 (2026-06-02) Full Changelog: [v4.15.0...v4.16.0](https://github.com/runwayml/sdk-python/compare/v4.15.0...v4.16.0) diff --git a/pyproject.toml b/pyproject.toml index 9fc28f2..8d0e86c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "runwayml" -version = "4.16.0" +version = "4.17.0" description = "The official Python library for the runwayml API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/runwayml/_version.py b/src/runwayml/_version.py index 48c10b2..be5af50 100644 --- a/src/runwayml/_version.py +++ b/src/runwayml/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "runwayml" -__version__ = "4.16.0" # x-release-please-version +__version__ = "4.17.0" # x-release-please-version diff --git a/src/runwayml/resources/image_to_video.py b/src/runwayml/resources/image_to_video.py index bae0563..8e3d57a 100644 --- a/src/runwayml/resources/image_to_video.py +++ b/src/runwayml/resources/image_to_video.py @@ -282,6 +282,112 @@ def create( """ ... + @overload + def create( + self, + *, + model: Literal["happyhorse_1_0"], + prompt_image: Union[str, Iterable[image_to_video_create_params.Happyhorse1_0PromptImagePromptImage]], + duration: int | Omit = omit, + prompt_text: str | Omit = omit, + resolution: Literal["720P", "1080P"] | Omit = omit, + # 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, + ) -> NewTaskCreatedResponse: + """ + This endpoint will start a new task to generate a video from an image. + + Args: + prompt_image: A HTTPS URL. + + duration: The number of seconds of duration for the output video. + + prompt_text: A string up to 2500 characters (measured in UTF-16 code units) describing motion + or changes in the output video. + + resolution: Output quality tier. Output aspect ratio follows the input image. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + ... + + @overload + def create( + self, + *, + model: Literal["seedance2"], + prompt_image: Union[str, Iterable[image_to_video_create_params.Seedance2PromptImagePromptImage]], + audio: bool | Omit = omit, + duration: int | Omit = omit, + prompt_text: str | Omit = omit, + ratio: Literal[ + "992:432", + "864:496", + "752:560", + "640:640", + "560:752", + "496:864", + "1470:630", + "1280:720", + "1112:834", + "960:960", + "834:1112", + "720:1280", + "2206:946", + "1920:1080", + "1664:1248", + "1440:1440", + "1248:1664", + "1080:1920", + ] + | Omit = omit, + reference_audio: Iterable[image_to_video_create_params.Seedance2ReferenceAudio] | Omit = omit, + # 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, + ) -> NewTaskCreatedResponse: + """ + This endpoint will start a new task to generate a video from an image. + + Args: + prompt_image: An image or array of images. Use position `first`/`last` for keyframe mode, or + omit position for reference images. The two modes cannot be mixed. + + audio: Whether to generate audio for the video. Audio inclusion affects pricing. + + duration: The number of seconds of duration for the output video. + + prompt_text: An optional text prompt up to 3500 characters (measured in UTF-16 code units). + This should describe in detail what should appear in the output. + + ratio: The resolution of the output video. + + reference_audio: An optional array of audio references. Audio references require a text prompt, + and the total combined duration must not exceed 15 seconds. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + ... + @overload def create( self, @@ -325,6 +431,7 @@ def create( ["duration", "model", "prompt_image", "prompt_text", "ratio"], ["model", "prompt_image", "ratio"], ["model", "prompt_image", "prompt_text"], + ["model", "prompt_image"], ["duration", "model", "prompt_image", "ratio"], ) def create( @@ -336,10 +443,13 @@ def create( | Literal["veo3.1"] | Literal["gen3a_turbo"] | Literal["veo3.1_fast"] + | Literal["happyhorse_1_0"] + | Literal["seedance2"] | Literal["veo3"], prompt_image: Union[str, Iterable[image_to_video_create_params.Gen4_5PromptImagePromptImage]] | Union[str, Iterable[image_to_video_create_params.Gen4TurboPromptImagePromptImage]] | Union[str, Iterable[image_to_video_create_params.Gen3aTurboPromptImagePromptImage]] + | Union[str, Iterable[image_to_video_create_params.Seedance2PromptImagePromptImage]] | Union[str, Iterable[image_to_video_create_params.Veo3_1PromptImagePromptImage]] | Union[str, Iterable[image_to_video_create_params.Veo3_1FastPromptImagePromptImage]] | Union[str, Iterable[image_to_video_create_params.Veo3PromptImagePromptImage]], @@ -348,6 +458,26 @@ def create( | Literal["1280:720", "720:1280", "1104:832", "832:1104", "960:960", "1584:672"] | Literal["1280:720", "720:1280", "1080:1920", "1920:1080"] | Literal["768:1280", "1280:768"] + | Literal[ + "992:432", + "864:496", + "752:560", + "640:640", + "560:752", + "496:864", + "1470:630", + "1280:720", + "1112:834", + "960:960", + "834:1112", + "720:1280", + "2206:946", + "1920:1080", + "1664:1248", + "1440:1440", + "1248:1664", + "1080:1920", + ] | Omit = omit, content_moderation: image_to_video_create_params.Gen4_5ContentModeration | image_to_video_create_params.Gen4TurboContentModeration @@ -355,6 +485,8 @@ def create( | Omit = omit, seed: int | Omit = omit, audio: bool | Omit = omit, + resolution: Literal["720P", "1080P"] | Omit = omit, + reference_audio: Iterable[image_to_video_create_params.Seedance2ReferenceAudio] | Omit = omit, # 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, @@ -374,6 +506,8 @@ def create( "content_moderation": content_moderation, "seed": seed, "audio": audio, + "resolution": resolution, + "reference_audio": reference_audio, }, image_to_video_create_params.ImageToVideoCreateParams, ), @@ -636,6 +770,112 @@ async def create( """ ... + @overload + async def create( + self, + *, + model: Literal["happyhorse_1_0"], + prompt_image: Union[str, Iterable[image_to_video_create_params.Happyhorse1_0PromptImagePromptImage]], + duration: int | Omit = omit, + prompt_text: str | Omit = omit, + resolution: Literal["720P", "1080P"] | Omit = omit, + # 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, + ) -> AsyncNewTaskCreatedResponse: + """ + This endpoint will start a new task to generate a video from an image. + + Args: + prompt_image: A HTTPS URL. + + duration: The number of seconds of duration for the output video. + + prompt_text: A string up to 2500 characters (measured in UTF-16 code units) describing motion + or changes in the output video. + + resolution: Output quality tier. Output aspect ratio follows the input image. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + ... + + @overload + async def create( + self, + *, + model: Literal["seedance2"], + prompt_image: Union[str, Iterable[image_to_video_create_params.Seedance2PromptImagePromptImage]], + audio: bool | Omit = omit, + duration: int | Omit = omit, + prompt_text: str | Omit = omit, + ratio: Literal[ + "992:432", + "864:496", + "752:560", + "640:640", + "560:752", + "496:864", + "1470:630", + "1280:720", + "1112:834", + "960:960", + "834:1112", + "720:1280", + "2206:946", + "1920:1080", + "1664:1248", + "1440:1440", + "1248:1664", + "1080:1920", + ] + | Omit = omit, + reference_audio: Iterable[image_to_video_create_params.Seedance2ReferenceAudio] | Omit = omit, + # 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, + ) -> AsyncNewTaskCreatedResponse: + """ + This endpoint will start a new task to generate a video from an image. + + Args: + prompt_image: An image or array of images. Use position `first`/`last` for keyframe mode, or + omit position for reference images. The two modes cannot be mixed. + + audio: Whether to generate audio for the video. Audio inclusion affects pricing. + + duration: The number of seconds of duration for the output video. + + prompt_text: An optional text prompt up to 3500 characters (measured in UTF-16 code units). + This should describe in detail what should appear in the output. + + ratio: The resolution of the output video. + + reference_audio: An optional array of audio references. Audio references require a text prompt, + and the total combined duration must not exceed 15 seconds. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + ... + @overload async def create( self, @@ -679,6 +919,7 @@ async def create( ["duration", "model", "prompt_image", "prompt_text", "ratio"], ["model", "prompt_image", "ratio"], ["model", "prompt_image", "prompt_text"], + ["model", "prompt_image"], ["duration", "model", "prompt_image", "ratio"], ) async def create( @@ -690,10 +931,13 @@ async def create( | Literal["veo3.1"] | Literal["gen3a_turbo"] | Literal["veo3.1_fast"] + | Literal["happyhorse_1_0"] + | Literal["seedance2"] | Literal["veo3"], prompt_image: Union[str, Iterable[image_to_video_create_params.Gen4_5PromptImagePromptImage]] | Union[str, Iterable[image_to_video_create_params.Gen4TurboPromptImagePromptImage]] | Union[str, Iterable[image_to_video_create_params.Gen3aTurboPromptImagePromptImage]] + | Union[str, Iterable[image_to_video_create_params.Seedance2PromptImagePromptImage]] | Union[str, Iterable[image_to_video_create_params.Veo3_1PromptImagePromptImage]] | Union[str, Iterable[image_to_video_create_params.Veo3_1FastPromptImagePromptImage]] | Union[str, Iterable[image_to_video_create_params.Veo3PromptImagePromptImage]], @@ -702,6 +946,26 @@ async def create( | Literal["1280:720", "720:1280", "1104:832", "832:1104", "960:960", "1584:672"] | Literal["1280:720", "720:1280", "1080:1920", "1920:1080"] | Literal["768:1280", "1280:768"] + | Literal[ + "992:432", + "864:496", + "752:560", + "640:640", + "560:752", + "496:864", + "1470:630", + "1280:720", + "1112:834", + "960:960", + "834:1112", + "720:1280", + "2206:946", + "1920:1080", + "1664:1248", + "1440:1440", + "1248:1664", + "1080:1920", + ] | Omit = omit, content_moderation: image_to_video_create_params.Gen4_5ContentModeration | image_to_video_create_params.Gen4TurboContentModeration @@ -709,6 +973,8 @@ async def create( | Omit = omit, seed: int | Omit = omit, audio: bool | Omit = omit, + resolution: Literal["720P", "1080P"] | Omit = omit, + reference_audio: Iterable[image_to_video_create_params.Seedance2ReferenceAudio] | Omit = omit, # 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, @@ -728,6 +994,8 @@ async def create( "content_moderation": content_moderation, "seed": seed, "audio": audio, + "resolution": resolution, + "reference_audio": reference_audio, }, image_to_video_create_params.ImageToVideoCreateParams, ), diff --git a/src/runwayml/resources/text_to_video.py b/src/runwayml/resources/text_to_video.py index f4e197f..1d80ddb 100644 --- a/src/runwayml/resources/text_to_video.py +++ b/src/runwayml/resources/text_to_video.py @@ -2,6 +2,7 @@ from __future__ import annotations +from typing import Iterable from typing_extensions import Literal, overload import httpx @@ -174,6 +175,126 @@ def create( """ ... + @overload + def create( + self, + *, + model: Literal["happyhorse_1_0"], + prompt_text: str, + duration: int | Omit = omit, + ratio: Literal[ + "1280:720", + "720:1280", + "960:960", + "1108:832", + "832:1108", + "1920:1080", + "1080:1920", + "1440:1440", + "1662:1248", + "1248:1662", + ] + | Omit = omit, + # 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, + ) -> NewTaskCreatedResponse: + """ + This endpoint will start a new task to generate a video from a text prompt. + + Args: + prompt_text: A non-empty string up to 2500 characters (measured in UTF-16 code units). This + should describe in detail what should appear in the output. + + duration: The number of seconds of duration for the output video. + + ratio: The resolution of the output video. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + ... + + @overload + def create( + self, + *, + model: Literal["seedance2"], + prompt_text: str, + audio: bool | Omit = omit, + duration: int | Omit = omit, + ratio: Literal[ + "992:432", + "864:496", + "752:560", + "640:640", + "560:752", + "496:864", + "1470:630", + "1280:720", + "1112:834", + "960:960", + "834:1112", + "720:1280", + "2206:946", + "1920:1080", + "1664:1248", + "1440:1440", + "1248:1664", + "1080:1920", + ] + | Omit = omit, + reference_audio: Iterable[text_to_video_create_params.Seedance2ReferenceAudio] | Omit = omit, + references: Iterable[text_to_video_create_params.Seedance2Reference] | Omit = omit, + reference_videos: Iterable[text_to_video_create_params.Seedance2ReferenceVideo] | Omit = omit, + # 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, + ) -> NewTaskCreatedResponse: + """ + This endpoint will start a new task to generate a video from a text prompt. + + Args: + prompt_text: A non-empty string up to 3500 characters (measured in UTF-16 code units). This + should describe in detail what should appear in the output. + + audio: Whether to generate audio for the video. Audio inclusion affects pricing. + + duration: The number of seconds of duration for the output video. + + ratio: The resolution of the output video. + + reference_audio: An optional array of audio references. Audio references require a text prompt, + and the total combined duration must not exceed 15 seconds. + + references: An optional array of image references (up to 9). See + [our docs](/assets/inputs#images) on image inputs for more information. + + reference_videos: An optional array of video references. The combined duration across all video + references must not exceed 15 seconds. See [our docs](/assets/inputs#videos) on + video inputs for more information. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + ... + @overload def create( self, @@ -210,17 +331,61 @@ def create( """ ... - @required_args(["duration", "model", "prompt_text", "ratio"], ["model", "prompt_text", "ratio"]) + @required_args( + ["duration", "model", "prompt_text", "ratio"], ["model", "prompt_text", "ratio"], ["model", "prompt_text"] + ) def create( self, *, duration: int | Literal[4, 6, 8] | Literal[8] | Omit = omit, - model: Literal["gen4.5"] | Literal["veo3.1"] | Literal["veo3.1_fast"] | Literal["veo3"], + model: Literal["gen4.5"] + | Literal["veo3.1"] + | Literal["veo3.1_fast"] + | Literal["happyhorse_1_0"] + | Literal["seedance2"] + | Literal["veo3"], prompt_text: str, - ratio: Literal["1280:720", "720:1280"] | Literal["1280:720", "720:1280", "1080:1920", "1920:1080"], + ratio: Literal["1280:720", "720:1280"] + | Literal["1280:720", "720:1280", "1080:1920", "1920:1080"] + | Literal[ + "1280:720", + "720:1280", + "960:960", + "1108:832", + "832:1108", + "1920:1080", + "1080:1920", + "1440:1440", + "1662:1248", + "1248:1662", + ] + | Literal[ + "992:432", + "864:496", + "752:560", + "640:640", + "560:752", + "496:864", + "1470:630", + "1280:720", + "1112:834", + "960:960", + "834:1112", + "720:1280", + "2206:946", + "1920:1080", + "1664:1248", + "1440:1440", + "1248:1664", + "1080:1920", + ] + | Omit = omit, content_moderation: text_to_video_create_params.Gen4_5ContentModeration | Omit = omit, seed: int | Omit = omit, audio: bool | Omit = omit, + reference_audio: Iterable[text_to_video_create_params.Seedance2ReferenceAudio] | Omit = omit, + references: Iterable[text_to_video_create_params.Seedance2Reference] | Omit = omit, + reference_videos: Iterable[text_to_video_create_params.Seedance2ReferenceVideo] | Omit = omit, # 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, @@ -239,6 +404,9 @@ def create( "content_moderation": content_moderation, "seed": seed, "audio": audio, + "reference_audio": reference_audio, + "references": references, + "reference_videos": reference_videos, }, text_to_video_create_params.TextToVideoCreateParams, ), @@ -394,6 +562,126 @@ async def create( """ ... + @overload + async def create( + self, + *, + model: Literal["happyhorse_1_0"], + prompt_text: str, + duration: int | Omit = omit, + ratio: Literal[ + "1280:720", + "720:1280", + "960:960", + "1108:832", + "832:1108", + "1920:1080", + "1080:1920", + "1440:1440", + "1662:1248", + "1248:1662", + ] + | Omit = omit, + # 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, + ) -> AsyncNewTaskCreatedResponse: + """ + This endpoint will start a new task to generate a video from a text prompt. + + Args: + prompt_text: A non-empty string up to 2500 characters (measured in UTF-16 code units). This + should describe in detail what should appear in the output. + + duration: The number of seconds of duration for the output video. + + ratio: The resolution of the output video. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + ... + + @overload + async def create( + self, + *, + model: Literal["seedance2"], + prompt_text: str, + audio: bool | Omit = omit, + duration: int | Omit = omit, + ratio: Literal[ + "992:432", + "864:496", + "752:560", + "640:640", + "560:752", + "496:864", + "1470:630", + "1280:720", + "1112:834", + "960:960", + "834:1112", + "720:1280", + "2206:946", + "1920:1080", + "1664:1248", + "1440:1440", + "1248:1664", + "1080:1920", + ] + | Omit = omit, + reference_audio: Iterable[text_to_video_create_params.Seedance2ReferenceAudio] | Omit = omit, + references: Iterable[text_to_video_create_params.Seedance2Reference] | Omit = omit, + reference_videos: Iterable[text_to_video_create_params.Seedance2ReferenceVideo] | Omit = omit, + # 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, + ) -> AsyncNewTaskCreatedResponse: + """ + This endpoint will start a new task to generate a video from a text prompt. + + Args: + prompt_text: A non-empty string up to 3500 characters (measured in UTF-16 code units). This + should describe in detail what should appear in the output. + + audio: Whether to generate audio for the video. Audio inclusion affects pricing. + + duration: The number of seconds of duration for the output video. + + ratio: The resolution of the output video. + + reference_audio: An optional array of audio references. Audio references require a text prompt, + and the total combined duration must not exceed 15 seconds. + + references: An optional array of image references (up to 9). See + [our docs](/assets/inputs#images) on image inputs for more information. + + reference_videos: An optional array of video references. The combined duration across all video + references must not exceed 15 seconds. See [our docs](/assets/inputs#videos) on + video inputs for more information. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + ... + @overload async def create( self, @@ -430,17 +718,61 @@ async def create( """ ... - @required_args(["duration", "model", "prompt_text", "ratio"], ["model", "prompt_text", "ratio"]) + @required_args( + ["duration", "model", "prompt_text", "ratio"], ["model", "prompt_text", "ratio"], ["model", "prompt_text"] + ) async def create( self, *, duration: int | Literal[4, 6, 8] | Literal[8] | Omit = omit, - model: Literal["gen4.5"] | Literal["veo3.1"] | Literal["veo3.1_fast"] | Literal["veo3"], + model: Literal["gen4.5"] + | Literal["veo3.1"] + | Literal["veo3.1_fast"] + | Literal["happyhorse_1_0"] + | Literal["seedance2"] + | Literal["veo3"], prompt_text: str, - ratio: Literal["1280:720", "720:1280"] | Literal["1280:720", "720:1280", "1080:1920", "1920:1080"], + ratio: Literal["1280:720", "720:1280"] + | Literal["1280:720", "720:1280", "1080:1920", "1920:1080"] + | Literal[ + "1280:720", + "720:1280", + "960:960", + "1108:832", + "832:1108", + "1920:1080", + "1080:1920", + "1440:1440", + "1662:1248", + "1248:1662", + ] + | Literal[ + "992:432", + "864:496", + "752:560", + "640:640", + "560:752", + "496:864", + "1470:630", + "1280:720", + "1112:834", + "960:960", + "834:1112", + "720:1280", + "2206:946", + "1920:1080", + "1664:1248", + "1440:1440", + "1248:1664", + "1080:1920", + ] + | Omit = omit, content_moderation: text_to_video_create_params.Gen4_5ContentModeration | Omit = omit, seed: int | Omit = omit, audio: bool | Omit = omit, + reference_audio: Iterable[text_to_video_create_params.Seedance2ReferenceAudio] | Omit = omit, + references: Iterable[text_to_video_create_params.Seedance2Reference] | Omit = omit, + reference_videos: Iterable[text_to_video_create_params.Seedance2ReferenceVideo] | Omit = omit, # 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, @@ -459,6 +791,9 @@ async def create( "content_moderation": content_moderation, "seed": seed, "audio": audio, + "reference_audio": reference_audio, + "references": references, + "reference_videos": reference_videos, }, text_to_video_create_params.TextToVideoCreateParams, ), diff --git a/src/runwayml/resources/video_to_video.py b/src/runwayml/resources/video_to_video.py index ca6c2bb..eb2d335 100644 --- a/src/runwayml/resources/video_to_video.py +++ b/src/runwayml/resources/video_to_video.py @@ -151,22 +151,124 @@ def create( """ ... - @required_args(["model", "prompt_text", "video_uri"]) + @overload def create( self, *, - model: Literal["gen4_aleph"] | Literal["aleph2"], - prompt_text: str, - video_uri: str, + model: Literal["seedance2"], + prompt_video: str, + audio: bool | Omit = omit, + duration: int | Omit = omit, + prompt_text: str | Omit = omit, + ratio: Literal[ + "992:432", + "864:496", + "752:560", + "640:640", + "560:752", + "496:864", + "1470:630", + "1280:720", + "1112:834", + "960:960", + "834:1112", + "720:1280", + "2206:946", + "1920:1080", + "1664:1248", + "1440:1440", + "1248:1664", + "1080:1920", + ] + | Omit = omit, + reference_audio: Iterable[video_to_video_create_params.Seedance2ReferenceAudio] | Omit = omit, + references: Iterable[video_to_video_create_params.Seedance2Reference] | Omit = omit, + reference_videos: Iterable[video_to_video_create_params.Seedance2ReferenceVideo] | Omit = omit, + # 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, + ) -> NewTaskCreatedResponse: + """ + This endpoint will start a new task to generate a video from a video. + + Args: + prompt_video: A HTTPS URL. + + audio: Whether to generate audio for the video. Audio inclusion affects pricing. + + duration: The number of seconds of duration for the output video. + + prompt_text: An optional text prompt up to 3500 characters describing what should appear in + the output video. + + ratio: The resolution of the output video. + + reference_audio: An optional array of audio references. Audio references require a text prompt, + and the total combined duration must not exceed 15 seconds. + + references: An optional array of image references (up to 9). See + [our docs](/assets/inputs#images) on image inputs for more information. + + reference_videos: An optional array of video references. The combined duration across all video + references must not exceed 15 seconds. See [our docs](/assets/inputs#videos) on + video inputs for more information. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + ... + + @required_args(["model", "prompt_text", "video_uri"], ["model", "prompt_video"]) + def create( + self, + *, + model: Literal["gen4_aleph"] | Literal["aleph2"] | Literal["seedance2"], + prompt_text: str | Omit = omit, + video_uri: str | Omit = omit, content_moderation: video_to_video_create_params.Gen4AlephContentModeration | video_to_video_create_params.Aleph2ContentModeration | Omit = omit, ratio: Literal["1280:720", "720:1280", "1104:832", "960:960", "832:1104", "1584:672", "848:480", "640:480"] + | Literal[ + "992:432", + "864:496", + "752:560", + "640:640", + "560:752", + "496:864", + "1470:630", + "1280:720", + "1112:834", + "960:960", + "834:1112", + "720:1280", + "2206:946", + "1920:1080", + "1664:1248", + "1440:1440", + "1248:1664", + "1080:1920", + ] + | Omit = omit, + references: Iterable[video_to_video_create_params.Gen4AlephReference] + | Iterable[video_to_video_create_params.Seedance2Reference] | Omit = omit, - references: Iterable[video_to_video_create_params.Gen4AlephReference] | Omit = omit, seed: int | Omit = omit, keyframes: Iterable[video_to_video_create_params.Aleph2Keyframe] | Omit = omit, prompt_image: Iterable[video_to_video_create_params.Aleph2PromptImage] | Omit = omit, + prompt_video: str | Omit = omit, + audio: bool | Omit = omit, + duration: int | Omit = omit, + reference_audio: Iterable[video_to_video_create_params.Seedance2ReferenceAudio] | Omit = omit, + reference_videos: Iterable[video_to_video_create_params.Seedance2ReferenceVideo] | Omit = omit, # 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, @@ -187,6 +289,11 @@ def create( "seed": seed, "keyframes": keyframes, "prompt_image": prompt_image, + "prompt_video": prompt_video, + "audio": audio, + "duration": duration, + "reference_audio": reference_audio, + "reference_videos": reference_videos, }, video_to_video_create_params.VideoToVideoCreateParams, ), @@ -318,22 +425,124 @@ async def create( """ ... - @required_args(["model", "prompt_text", "video_uri"]) + @overload async def create( self, *, - model: Literal["gen4_aleph"] | Literal["aleph2"], - prompt_text: str, - video_uri: str, + model: Literal["seedance2"], + prompt_video: str, + audio: bool | Omit = omit, + duration: int | Omit = omit, + prompt_text: str | Omit = omit, + ratio: Literal[ + "992:432", + "864:496", + "752:560", + "640:640", + "560:752", + "496:864", + "1470:630", + "1280:720", + "1112:834", + "960:960", + "834:1112", + "720:1280", + "2206:946", + "1920:1080", + "1664:1248", + "1440:1440", + "1248:1664", + "1080:1920", + ] + | Omit = omit, + reference_audio: Iterable[video_to_video_create_params.Seedance2ReferenceAudio] | Omit = omit, + references: Iterable[video_to_video_create_params.Seedance2Reference] | Omit = omit, + reference_videos: Iterable[video_to_video_create_params.Seedance2ReferenceVideo] | Omit = omit, + # 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, + ) -> AsyncNewTaskCreatedResponse: + """ + This endpoint will start a new task to generate a video from a video. + + Args: + prompt_video: A HTTPS URL. + + audio: Whether to generate audio for the video. Audio inclusion affects pricing. + + duration: The number of seconds of duration for the output video. + + prompt_text: An optional text prompt up to 3500 characters describing what should appear in + the output video. + + ratio: The resolution of the output video. + + reference_audio: An optional array of audio references. Audio references require a text prompt, + and the total combined duration must not exceed 15 seconds. + + references: An optional array of image references (up to 9). See + [our docs](/assets/inputs#images) on image inputs for more information. + + reference_videos: An optional array of video references. The combined duration across all video + references must not exceed 15 seconds. See [our docs](/assets/inputs#videos) on + video inputs for more information. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + ... + + @required_args(["model", "prompt_text", "video_uri"], ["model", "prompt_video"]) + async def create( + self, + *, + model: Literal["gen4_aleph"] | Literal["aleph2"] | Literal["seedance2"], + prompt_text: str | Omit = omit, + video_uri: str | Omit = omit, content_moderation: video_to_video_create_params.Gen4AlephContentModeration | video_to_video_create_params.Aleph2ContentModeration | Omit = omit, ratio: Literal["1280:720", "720:1280", "1104:832", "960:960", "832:1104", "1584:672", "848:480", "640:480"] + | Literal[ + "992:432", + "864:496", + "752:560", + "640:640", + "560:752", + "496:864", + "1470:630", + "1280:720", + "1112:834", + "960:960", + "834:1112", + "720:1280", + "2206:946", + "1920:1080", + "1664:1248", + "1440:1440", + "1248:1664", + "1080:1920", + ] + | Omit = omit, + references: Iterable[video_to_video_create_params.Gen4AlephReference] + | Iterable[video_to_video_create_params.Seedance2Reference] | Omit = omit, - references: Iterable[video_to_video_create_params.Gen4AlephReference] | Omit = omit, seed: int | Omit = omit, keyframes: Iterable[video_to_video_create_params.Aleph2Keyframe] | Omit = omit, prompt_image: Iterable[video_to_video_create_params.Aleph2PromptImage] | Omit = omit, + prompt_video: str | Omit = omit, + audio: bool | Omit = omit, + duration: int | Omit = omit, + reference_audio: Iterable[video_to_video_create_params.Seedance2ReferenceAudio] | Omit = omit, + reference_videos: Iterable[video_to_video_create_params.Seedance2ReferenceVideo] | Omit = omit, # 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, @@ -354,6 +563,11 @@ async def create( "seed": seed, "keyframes": keyframes, "prompt_image": prompt_image, + "prompt_video": prompt_video, + "audio": audio, + "duration": duration, + "reference_audio": reference_audio, + "reference_videos": reference_videos, }, video_to_video_create_params.VideoToVideoCreateParams, ), diff --git a/src/runwayml/types/image_to_video_create_params.py b/src/runwayml/types/image_to_video_create_params.py index d64c411..b011806 100644 --- a/src/runwayml/types/image_to_video_create_params.py +++ b/src/runwayml/types/image_to_video_create_params.py @@ -22,6 +22,11 @@ "Gen3aTurboContentModeration", "Veo3_1Fast", "Veo3_1FastPromptImagePromptImage", + "Happyhorse1_0", + "Happyhorse1_0PromptImagePromptImage", + "Seedance2", + "Seedance2PromptImagePromptImage", + "Seedance2ReferenceAudio", "Veo3", "Veo3PromptImagePromptImage", ] @@ -270,6 +275,115 @@ class Veo3_1FastPromptImagePromptImage(TypedDict, total=False): """A HTTPS URL.""" +class Happyhorse1_0(TypedDict, total=False): + model: Required[Literal["happyhorse_1_0"]] + + prompt_image: Required[ + Annotated[Union[str, Iterable[Happyhorse1_0PromptImagePromptImage]], PropertyInfo(alias="promptImage")] + ] + """A HTTPS URL.""" + + duration: int + """The number of seconds of duration for the output video.""" + + prompt_text: Annotated[str, PropertyInfo(alias="promptText")] + """ + A string up to 2500 characters (measured in UTF-16 code units) describing motion + or changes in the output video. + """ + + resolution: Literal["720P", "1080P"] + """Output quality tier. Output aspect ratio follows the input image.""" + + +class Happyhorse1_0PromptImagePromptImage(TypedDict, total=False): + position: Required[Literal["first"]] + """The position of the image in the output video. + + "first" will use the image as the first frame of the video. + """ + + uri: Required[str] + """A HTTPS URL.""" + + +class Seedance2(TypedDict, total=False): + model: Required[Literal["seedance2"]] + + prompt_image: Required[ + Annotated[Union[str, Iterable[Seedance2PromptImagePromptImage]], PropertyInfo(alias="promptImage")] + ] + """An image or array of images. + + Use position `first`/`last` for keyframe mode, or omit position for reference + images. The two modes cannot be mixed. + """ + + audio: bool + """Whether to generate audio for the video. Audio inclusion affects pricing.""" + + duration: int + """The number of seconds of duration for the output video.""" + + prompt_text: Annotated[str, PropertyInfo(alias="promptText")] + """An optional text prompt up to 3500 characters (measured in UTF-16 code units). + + This should describe in detail what should appear in the output. + """ + + ratio: Literal[ + "992:432", + "864:496", + "752:560", + "640:640", + "560:752", + "496:864", + "1470:630", + "1280:720", + "1112:834", + "960:960", + "834:1112", + "720:1280", + "2206:946", + "1920:1080", + "1664:1248", + "1440:1440", + "1248:1664", + "1080:1920", + ] + """The resolution of the output video.""" + + reference_audio: Annotated[Iterable[Seedance2ReferenceAudio], PropertyInfo(alias="referenceAudio")] + """An optional array of audio references. + + Audio references require a text prompt, and the total combined duration must not + exceed 15 seconds. + """ + + +class Seedance2PromptImagePromptImage(TypedDict, total=False): + uri: Required[str] + """A HTTPS URL.""" + + position: Literal["first", "last"] + """The position of the image in the output video. + + "first" will use the image as the first frame, "last" as the last frame. Omit + for a reference image. + """ + + +class Seedance2ReferenceAudio(TypedDict, total=False): + """ + An audio reference allows the model to use the audio as additional context for the output. + """ + + type: Required[Literal["audio"]] + + uri: Required[str] + """A HTTPS URL.""" + + class Veo3(TypedDict, total=False): duration: Required[Literal[8]] """The number of seconds of duration for the output video.""" @@ -302,4 +416,6 @@ class Veo3PromptImagePromptImage(TypedDict, total=False): """A HTTPS URL.""" -ImageToVideoCreateParams: TypeAlias = Union[Gen4_5, Gen4Turbo, Veo3_1, Gen3aTurbo, Veo3_1Fast, Veo3] +ImageToVideoCreateParams: TypeAlias = Union[ + Gen4_5, Gen4Turbo, Veo3_1, Gen3aTurbo, Veo3_1Fast, Happyhorse1_0, Seedance2, Veo3 +] diff --git a/src/runwayml/types/text_to_video_create_params.py b/src/runwayml/types/text_to_video_create_params.py index 7a964b3..1974f94 100644 --- a/src/runwayml/types/text_to_video_create_params.py +++ b/src/runwayml/types/text_to_video_create_params.py @@ -2,12 +2,24 @@ from __future__ import annotations -from typing import Union +from typing import Union, Iterable from typing_extensions import Literal, Required, Annotated, TypeAlias, TypedDict from .._utils import PropertyInfo -__all__ = ["TextToVideoCreateParams", "Gen4_5", "Gen4_5ContentModeration", "Veo3_1", "Veo3_1Fast", "Veo3"] +__all__ = [ + "TextToVideoCreateParams", + "Gen4_5", + "Gen4_5ContentModeration", + "Veo3_1", + "Veo3_1Fast", + "Happyhorse1_0", + "Seedance2", + "Seedance2ReferenceAudio", + "Seedance2Reference", + "Seedance2ReferenceVideo", + "Veo3", +] class Gen4_5(TypedDict, total=False): @@ -88,6 +100,125 @@ class Veo3_1Fast(TypedDict, total=False): """The number of seconds of duration for the output video.""" +class Happyhorse1_0(TypedDict, total=False): + model: Required[Literal["happyhorse_1_0"]] + + prompt_text: Required[Annotated[str, PropertyInfo(alias="promptText")]] + """A non-empty string up to 2500 characters (measured in UTF-16 code units). + + This should describe in detail what should appear in the output. + """ + + duration: int + """The number of seconds of duration for the output video.""" + + ratio: Literal[ + "1280:720", + "720:1280", + "960:960", + "1108:832", + "832:1108", + "1920:1080", + "1080:1920", + "1440:1440", + "1662:1248", + "1248:1662", + ] + """The resolution of the output video.""" + + +class Seedance2(TypedDict, total=False): + model: Required[Literal["seedance2"]] + + prompt_text: Required[Annotated[str, PropertyInfo(alias="promptText")]] + """A non-empty string up to 3500 characters (measured in UTF-16 code units). + + This should describe in detail what should appear in the output. + """ + + audio: bool + """Whether to generate audio for the video. Audio inclusion affects pricing.""" + + duration: int + """The number of seconds of duration for the output video.""" + + ratio: Literal[ + "992:432", + "864:496", + "752:560", + "640:640", + "560:752", + "496:864", + "1470:630", + "1280:720", + "1112:834", + "960:960", + "834:1112", + "720:1280", + "2206:946", + "1920:1080", + "1664:1248", + "1440:1440", + "1248:1664", + "1080:1920", + ] + """The resolution of the output video.""" + + reference_audio: Annotated[Iterable[Seedance2ReferenceAudio], PropertyInfo(alias="referenceAudio")] + """An optional array of audio references. + + Audio references require a text prompt, and the total combined duration must not + exceed 15 seconds. + """ + + references: Iterable[Seedance2Reference] + """An optional array of image references (up to 9). + + See [our docs](/assets/inputs#images) on image inputs for more information. + """ + + reference_videos: Annotated[Iterable[Seedance2ReferenceVideo], PropertyInfo(alias="referenceVideos")] + """An optional array of video references. + + The combined duration across all video references must not exceed 15 seconds. + See [our docs](/assets/inputs#videos) on video inputs for more information. + """ + + +class Seedance2ReferenceAudio(TypedDict, total=False): + """ + An audio reference allows the model to use the audio as additional context for the output. + """ + + type: Required[Literal["audio"]] + + uri: Required[str] + """A HTTPS URL.""" + + +class Seedance2Reference(TypedDict, total=False): + uri: Required[str] + """A HTTPS URL.""" + + position: Literal["first", "last"] + """The position of the image in the output video. + + "first" will use the image as the first frame, "last" as the last frame. Omit + for a reference image. + """ + + +class Seedance2ReferenceVideo(TypedDict, total=False): + """ + A video reference allows the model to use the video as additional context for the output. + """ + + type: Required[Literal["video"]] + + uri: Required[str] + """A HTTPS URL.""" + + class Veo3(TypedDict, total=False): duration: Required[Literal[8]] """The number of seconds of duration for the output video.""" @@ -104,4 +235,4 @@ class Veo3(TypedDict, total=False): """The resolution of the output video.""" -TextToVideoCreateParams: TypeAlias = Union[Gen4_5, Veo3_1, Veo3_1Fast, Veo3] +TextToVideoCreateParams: TypeAlias = Union[Gen4_5, Veo3_1, Veo3_1Fast, Happyhorse1_0, Seedance2, Veo3] diff --git a/src/runwayml/types/video_to_video_create_params.py b/src/runwayml/types/video_to_video_create_params.py index bc71145..131f3d0 100644 --- a/src/runwayml/types/video_to_video_create_params.py +++ b/src/runwayml/types/video_to_video_create_params.py @@ -21,6 +21,10 @@ "Aleph2PromptImagePosition", "Aleph2PromptImagePositionTimestampPosition", "Aleph2PromptImagePositionRelativePosition", + "Seedance2", + "Seedance2ReferenceAudio", + "Seedance2Reference", + "Seedance2ReferenceVideo", ] @@ -185,4 +189,99 @@ class Aleph2PromptImage(TypedDict, total=False): """A HTTPS URL.""" -VideoToVideoCreateParams: TypeAlias = Union[Gen4Aleph, Aleph2] +class Seedance2(TypedDict, total=False): + model: Required[Literal["seedance2"]] + + prompt_video: Required[Annotated[str, PropertyInfo(alias="promptVideo")]] + """A HTTPS URL.""" + + audio: bool + """Whether to generate audio for the video. Audio inclusion affects pricing.""" + + duration: int + """The number of seconds of duration for the output video.""" + + prompt_text: Annotated[str, PropertyInfo(alias="promptText")] + """ + An optional text prompt up to 3500 characters describing what should appear in + the output video. + """ + + ratio: Literal[ + "992:432", + "864:496", + "752:560", + "640:640", + "560:752", + "496:864", + "1470:630", + "1280:720", + "1112:834", + "960:960", + "834:1112", + "720:1280", + "2206:946", + "1920:1080", + "1664:1248", + "1440:1440", + "1248:1664", + "1080:1920", + ] + """The resolution of the output video.""" + + reference_audio: Annotated[Iterable[Seedance2ReferenceAudio], PropertyInfo(alias="referenceAudio")] + """An optional array of audio references. + + Audio references require a text prompt, and the total combined duration must not + exceed 15 seconds. + """ + + references: Iterable[Seedance2Reference] + """An optional array of image references (up to 9). + + See [our docs](/assets/inputs#images) on image inputs for more information. + """ + + reference_videos: Annotated[Iterable[Seedance2ReferenceVideo], PropertyInfo(alias="referenceVideos")] + """An optional array of video references. + + The combined duration across all video references must not exceed 15 seconds. + See [our docs](/assets/inputs#videos) on video inputs for more information. + """ + + +class Seedance2ReferenceAudio(TypedDict, total=False): + """ + An audio reference allows the model to use the audio as additional context for the output. + """ + + type: Required[Literal["audio"]] + + uri: Required[str] + """A HTTPS URL.""" + + +class Seedance2Reference(TypedDict, total=False): + uri: Required[str] + """A HTTPS URL.""" + + position: Literal["first", "last"] + """The position of the image in the output video. + + "first" will use the image as the first frame, "last" as the last frame. Omit + for a reference image. + """ + + +class Seedance2ReferenceVideo(TypedDict, total=False): + """ + A video reference allows the model to use the video as additional context for the output. + """ + + type: Required[Literal["video"]] + + uri: Required[str] + """A HTTPS URL.""" + + +VideoToVideoCreateParams: TypeAlias = Union[Gen4Aleph, Aleph2, Seedance2] diff --git a/tests/api_resources/test_image_to_video.py b/tests/api_resources/test_image_to_video.py index d40ac94..a632cbd 100644 --- a/tests/api_resources/test_image_to_video.py +++ b/tests/api_resources/test_image_to_video.py @@ -273,6 +273,103 @@ def test_streaming_response_create_overload_5(self, client: RunwayML) -> None: @parametrize def test_method_create_overload_6(self, client: RunwayML) -> None: + image_to_video = client.image_to_video.create( + model="happyhorse_1_0", + prompt_image="https://example.com/file", + ) + assert_matches_type(ImageToVideoCreateResponse, image_to_video, path=["response"]) + + @parametrize + def test_method_create_with_all_params_overload_6(self, client: RunwayML) -> None: + image_to_video = client.image_to_video.create( + model="happyhorse_1_0", + prompt_image="https://example.com/file", + duration=3, + prompt_text="xx", + resolution="720P", + ) + assert_matches_type(ImageToVideoCreateResponse, image_to_video, path=["response"]) + + @parametrize + def test_raw_response_create_overload_6(self, client: RunwayML) -> None: + response = client.image_to_video.with_raw_response.create( + model="happyhorse_1_0", + prompt_image="https://example.com/file", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + image_to_video = response.parse() + assert_matches_type(ImageToVideoCreateResponse, image_to_video, path=["response"]) + + @parametrize + def test_streaming_response_create_overload_6(self, client: RunwayML) -> None: + with client.image_to_video.with_streaming_response.create( + model="happyhorse_1_0", + prompt_image="https://example.com/file", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + image_to_video = response.parse() + assert_matches_type(ImageToVideoCreateResponse, image_to_video, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_create_overload_7(self, client: RunwayML) -> None: + image_to_video = client.image_to_video.create( + model="seedance2", + prompt_image="https://example.com/file", + ) + assert_matches_type(ImageToVideoCreateResponse, image_to_video, path=["response"]) + + @parametrize + def test_method_create_with_all_params_overload_7(self, client: RunwayML) -> None: + image_to_video = client.image_to_video.create( + model="seedance2", + prompt_image="https://example.com/file", + audio=True, + duration=4, + prompt_text="x", + ratio="992:432", + reference_audio=[ + { + "type": "audio", + "uri": "https://example.com/file", + } + ], + ) + assert_matches_type(ImageToVideoCreateResponse, image_to_video, path=["response"]) + + @parametrize + def test_raw_response_create_overload_7(self, client: RunwayML) -> None: + response = client.image_to_video.with_raw_response.create( + model="seedance2", + prompt_image="https://example.com/file", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + image_to_video = response.parse() + assert_matches_type(ImageToVideoCreateResponse, image_to_video, path=["response"]) + + @parametrize + def test_streaming_response_create_overload_7(self, client: RunwayML) -> None: + with client.image_to_video.with_streaming_response.create( + model="seedance2", + prompt_image="https://example.com/file", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + image_to_video = response.parse() + assert_matches_type(ImageToVideoCreateResponse, image_to_video, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_create_overload_8(self, client: RunwayML) -> None: image_to_video = client.image_to_video.create( duration=8, model="veo3", @@ -282,7 +379,7 @@ def test_method_create_overload_6(self, client: RunwayML) -> None: assert_matches_type(ImageToVideoCreateResponse, image_to_video, path=["response"]) @parametrize - def test_method_create_with_all_params_overload_6(self, client: RunwayML) -> None: + def test_method_create_with_all_params_overload_8(self, client: RunwayML) -> None: image_to_video = client.image_to_video.create( duration=8, model="veo3", @@ -293,7 +390,7 @@ def test_method_create_with_all_params_overload_6(self, client: RunwayML) -> Non assert_matches_type(ImageToVideoCreateResponse, image_to_video, path=["response"]) @parametrize - def test_raw_response_create_overload_6(self, client: RunwayML) -> None: + def test_raw_response_create_overload_8(self, client: RunwayML) -> None: response = client.image_to_video.with_raw_response.create( duration=8, model="veo3", @@ -307,7 +404,7 @@ def test_raw_response_create_overload_6(self, client: RunwayML) -> None: assert_matches_type(ImageToVideoCreateResponse, image_to_video, path=["response"]) @parametrize - def test_streaming_response_create_overload_6(self, client: RunwayML) -> None: + def test_streaming_response_create_overload_8(self, client: RunwayML) -> None: with client.image_to_video.with_streaming_response.create( duration=8, model="veo3", @@ -584,6 +681,103 @@ async def test_streaming_response_create_overload_5(self, async_client: AsyncRun @parametrize async def test_method_create_overload_6(self, async_client: AsyncRunwayML) -> None: + image_to_video = await async_client.image_to_video.create( + model="happyhorse_1_0", + prompt_image="https://example.com/file", + ) + assert_matches_type(ImageToVideoCreateResponse, image_to_video, path=["response"]) + + @parametrize + async def test_method_create_with_all_params_overload_6(self, async_client: AsyncRunwayML) -> None: + image_to_video = await async_client.image_to_video.create( + model="happyhorse_1_0", + prompt_image="https://example.com/file", + duration=3, + prompt_text="xx", + resolution="720P", + ) + assert_matches_type(ImageToVideoCreateResponse, image_to_video, path=["response"]) + + @parametrize + async def test_raw_response_create_overload_6(self, async_client: AsyncRunwayML) -> None: + response = await async_client.image_to_video.with_raw_response.create( + model="happyhorse_1_0", + prompt_image="https://example.com/file", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + image_to_video = await response.parse() + assert_matches_type(ImageToVideoCreateResponse, image_to_video, path=["response"]) + + @parametrize + async def test_streaming_response_create_overload_6(self, async_client: AsyncRunwayML) -> None: + async with async_client.image_to_video.with_streaming_response.create( + model="happyhorse_1_0", + prompt_image="https://example.com/file", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + image_to_video = await response.parse() + assert_matches_type(ImageToVideoCreateResponse, image_to_video, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_create_overload_7(self, async_client: AsyncRunwayML) -> None: + image_to_video = await async_client.image_to_video.create( + model="seedance2", + prompt_image="https://example.com/file", + ) + assert_matches_type(ImageToVideoCreateResponse, image_to_video, path=["response"]) + + @parametrize + async def test_method_create_with_all_params_overload_7(self, async_client: AsyncRunwayML) -> None: + image_to_video = await async_client.image_to_video.create( + model="seedance2", + prompt_image="https://example.com/file", + audio=True, + duration=4, + prompt_text="x", + ratio="992:432", + reference_audio=[ + { + "type": "audio", + "uri": "https://example.com/file", + } + ], + ) + assert_matches_type(ImageToVideoCreateResponse, image_to_video, path=["response"]) + + @parametrize + async def test_raw_response_create_overload_7(self, async_client: AsyncRunwayML) -> None: + response = await async_client.image_to_video.with_raw_response.create( + model="seedance2", + prompt_image="https://example.com/file", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + image_to_video = await response.parse() + assert_matches_type(ImageToVideoCreateResponse, image_to_video, path=["response"]) + + @parametrize + async def test_streaming_response_create_overload_7(self, async_client: AsyncRunwayML) -> None: + async with async_client.image_to_video.with_streaming_response.create( + model="seedance2", + prompt_image="https://example.com/file", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + image_to_video = await response.parse() + assert_matches_type(ImageToVideoCreateResponse, image_to_video, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_create_overload_8(self, async_client: AsyncRunwayML) -> None: image_to_video = await async_client.image_to_video.create( duration=8, model="veo3", @@ -593,7 +787,7 @@ async def test_method_create_overload_6(self, async_client: AsyncRunwayML) -> No assert_matches_type(ImageToVideoCreateResponse, image_to_video, path=["response"]) @parametrize - async def test_method_create_with_all_params_overload_6(self, async_client: AsyncRunwayML) -> None: + async def test_method_create_with_all_params_overload_8(self, async_client: AsyncRunwayML) -> None: image_to_video = await async_client.image_to_video.create( duration=8, model="veo3", @@ -604,7 +798,7 @@ async def test_method_create_with_all_params_overload_6(self, async_client: Asyn assert_matches_type(ImageToVideoCreateResponse, image_to_video, path=["response"]) @parametrize - async def test_raw_response_create_overload_6(self, async_client: AsyncRunwayML) -> None: + async def test_raw_response_create_overload_8(self, async_client: AsyncRunwayML) -> None: response = await async_client.image_to_video.with_raw_response.create( duration=8, model="veo3", @@ -618,7 +812,7 @@ async def test_raw_response_create_overload_6(self, async_client: AsyncRunwayML) assert_matches_type(ImageToVideoCreateResponse, image_to_video, path=["response"]) @parametrize - async def test_streaming_response_create_overload_6(self, async_client: AsyncRunwayML) -> None: + async def test_streaming_response_create_overload_8(self, async_client: AsyncRunwayML) -> None: async with async_client.image_to_video.with_streaming_response.create( duration=8, model="veo3", diff --git a/tests/api_resources/test_text_to_video.py b/tests/api_resources/test_text_to_video.py index 8ee3497..2e1f3ab 100644 --- a/tests/api_resources/test_text_to_video.py +++ b/tests/api_resources/test_text_to_video.py @@ -167,6 +167,113 @@ def test_streaming_response_create_overload_3(self, client: RunwayML) -> None: @parametrize def test_method_create_overload_4(self, client: RunwayML) -> None: + text_to_video = client.text_to_video.create( + model="happyhorse_1_0", + prompt_text="xx", + ) + assert_matches_type(TextToVideoCreateResponse, text_to_video, path=["response"]) + + @parametrize + def test_method_create_with_all_params_overload_4(self, client: RunwayML) -> None: + text_to_video = client.text_to_video.create( + model="happyhorse_1_0", + prompt_text="xx", + duration=3, + ratio="1280:720", + ) + assert_matches_type(TextToVideoCreateResponse, text_to_video, path=["response"]) + + @parametrize + def test_raw_response_create_overload_4(self, client: RunwayML) -> None: + response = client.text_to_video.with_raw_response.create( + model="happyhorse_1_0", + prompt_text="xx", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + text_to_video = response.parse() + assert_matches_type(TextToVideoCreateResponse, text_to_video, path=["response"]) + + @parametrize + def test_streaming_response_create_overload_4(self, client: RunwayML) -> None: + with client.text_to_video.with_streaming_response.create( + model="happyhorse_1_0", + prompt_text="xx", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + text_to_video = response.parse() + assert_matches_type(TextToVideoCreateResponse, text_to_video, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_create_overload_5(self, client: RunwayML) -> None: + text_to_video = client.text_to_video.create( + model="seedance2", + prompt_text="x", + ) + assert_matches_type(TextToVideoCreateResponse, text_to_video, path=["response"]) + + @parametrize + def test_method_create_with_all_params_overload_5(self, client: RunwayML) -> None: + text_to_video = client.text_to_video.create( + model="seedance2", + prompt_text="x", + audio=True, + duration=4, + ratio="992:432", + reference_audio=[ + { + "type": "audio", + "uri": "https://example.com/file", + } + ], + references=[ + { + "uri": "https://example.com/file", + "position": "first", + } + ], + reference_videos=[ + { + "type": "video", + "uri": "https://example.com/file", + } + ], + ) + assert_matches_type(TextToVideoCreateResponse, text_to_video, path=["response"]) + + @parametrize + def test_raw_response_create_overload_5(self, client: RunwayML) -> None: + response = client.text_to_video.with_raw_response.create( + model="seedance2", + prompt_text="x", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + text_to_video = response.parse() + assert_matches_type(TextToVideoCreateResponse, text_to_video, path=["response"]) + + @parametrize + def test_streaming_response_create_overload_5(self, client: RunwayML) -> None: + with client.text_to_video.with_streaming_response.create( + model="seedance2", + prompt_text="x", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + text_to_video = response.parse() + assert_matches_type(TextToVideoCreateResponse, text_to_video, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_create_overload_6(self, client: RunwayML) -> None: text_to_video = client.text_to_video.create( duration=8, model="veo3", @@ -176,7 +283,7 @@ def test_method_create_overload_4(self, client: RunwayML) -> None: assert_matches_type(TextToVideoCreateResponse, text_to_video, path=["response"]) @parametrize - def test_raw_response_create_overload_4(self, client: RunwayML) -> None: + def test_raw_response_create_overload_6(self, client: RunwayML) -> None: response = client.text_to_video.with_raw_response.create( duration=8, model="veo3", @@ -190,7 +297,7 @@ def test_raw_response_create_overload_4(self, client: RunwayML) -> None: assert_matches_type(TextToVideoCreateResponse, text_to_video, path=["response"]) @parametrize - def test_streaming_response_create_overload_4(self, client: RunwayML) -> None: + def test_streaming_response_create_overload_6(self, client: RunwayML) -> None: with client.text_to_video.with_streaming_response.create( duration=8, model="veo3", @@ -361,6 +468,113 @@ async def test_streaming_response_create_overload_3(self, async_client: AsyncRun @parametrize async def test_method_create_overload_4(self, async_client: AsyncRunwayML) -> None: + text_to_video = await async_client.text_to_video.create( + model="happyhorse_1_0", + prompt_text="xx", + ) + assert_matches_type(TextToVideoCreateResponse, text_to_video, path=["response"]) + + @parametrize + async def test_method_create_with_all_params_overload_4(self, async_client: AsyncRunwayML) -> None: + text_to_video = await async_client.text_to_video.create( + model="happyhorse_1_0", + prompt_text="xx", + duration=3, + ratio="1280:720", + ) + assert_matches_type(TextToVideoCreateResponse, text_to_video, path=["response"]) + + @parametrize + async def test_raw_response_create_overload_4(self, async_client: AsyncRunwayML) -> None: + response = await async_client.text_to_video.with_raw_response.create( + model="happyhorse_1_0", + prompt_text="xx", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + text_to_video = await response.parse() + assert_matches_type(TextToVideoCreateResponse, text_to_video, path=["response"]) + + @parametrize + async def test_streaming_response_create_overload_4(self, async_client: AsyncRunwayML) -> None: + async with async_client.text_to_video.with_streaming_response.create( + model="happyhorse_1_0", + prompt_text="xx", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + text_to_video = await response.parse() + assert_matches_type(TextToVideoCreateResponse, text_to_video, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_create_overload_5(self, async_client: AsyncRunwayML) -> None: + text_to_video = await async_client.text_to_video.create( + model="seedance2", + prompt_text="x", + ) + assert_matches_type(TextToVideoCreateResponse, text_to_video, path=["response"]) + + @parametrize + async def test_method_create_with_all_params_overload_5(self, async_client: AsyncRunwayML) -> None: + text_to_video = await async_client.text_to_video.create( + model="seedance2", + prompt_text="x", + audio=True, + duration=4, + ratio="992:432", + reference_audio=[ + { + "type": "audio", + "uri": "https://example.com/file", + } + ], + references=[ + { + "uri": "https://example.com/file", + "position": "first", + } + ], + reference_videos=[ + { + "type": "video", + "uri": "https://example.com/file", + } + ], + ) + assert_matches_type(TextToVideoCreateResponse, text_to_video, path=["response"]) + + @parametrize + async def test_raw_response_create_overload_5(self, async_client: AsyncRunwayML) -> None: + response = await async_client.text_to_video.with_raw_response.create( + model="seedance2", + prompt_text="x", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + text_to_video = await response.parse() + assert_matches_type(TextToVideoCreateResponse, text_to_video, path=["response"]) + + @parametrize + async def test_streaming_response_create_overload_5(self, async_client: AsyncRunwayML) -> None: + async with async_client.text_to_video.with_streaming_response.create( + model="seedance2", + prompt_text="x", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + text_to_video = await response.parse() + assert_matches_type(TextToVideoCreateResponse, text_to_video, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_create_overload_6(self, async_client: AsyncRunwayML) -> None: text_to_video = await async_client.text_to_video.create( duration=8, model="veo3", @@ -370,7 +584,7 @@ async def test_method_create_overload_4(self, async_client: AsyncRunwayML) -> No assert_matches_type(TextToVideoCreateResponse, text_to_video, path=["response"]) @parametrize - async def test_raw_response_create_overload_4(self, async_client: AsyncRunwayML) -> None: + async def test_raw_response_create_overload_6(self, async_client: AsyncRunwayML) -> None: response = await async_client.text_to_video.with_raw_response.create( duration=8, model="veo3", @@ -384,7 +598,7 @@ async def test_raw_response_create_overload_4(self, async_client: AsyncRunwayML) assert_matches_type(TextToVideoCreateResponse, text_to_video, path=["response"]) @parametrize - async def test_streaming_response_create_overload_4(self, async_client: AsyncRunwayML) -> None: + async def test_streaming_response_create_overload_6(self, async_client: AsyncRunwayML) -> None: async with async_client.text_to_video.with_streaming_response.create( duration=8, model="veo3", diff --git a/tests/api_resources/test_video_to_video.py b/tests/api_resources/test_video_to_video.py index d39b3d4..4ce980a 100644 --- a/tests/api_resources/test_video_to_video.py +++ b/tests/api_resources/test_video_to_video.py @@ -132,6 +132,70 @@ def test_streaming_response_create_overload_2(self, client: RunwayML) -> None: assert cast(Any, response.is_closed) is True + @parametrize + def test_method_create_overload_3(self, client: RunwayML) -> None: + video_to_video = client.video_to_video.create( + model="seedance2", + prompt_video="https://example.com/video.mp4", + ) + assert_matches_type(VideoToVideoCreateResponse, video_to_video, path=["response"]) + + @parametrize + def test_method_create_with_all_params_overload_3(self, client: RunwayML) -> None: + video_to_video = client.video_to_video.create( + model="seedance2", + prompt_video="https://example.com/video.mp4", + audio=True, + duration=4, + prompt_text="x", + ratio="992:432", + reference_audio=[ + { + "type": "audio", + "uri": "https://example.com/file", + } + ], + references=[ + { + "uri": "https://example.com/file", + "position": "first", + } + ], + reference_videos=[ + { + "type": "video", + "uri": "https://example.com/file", + } + ], + ) + assert_matches_type(VideoToVideoCreateResponse, video_to_video, path=["response"]) + + @parametrize + def test_raw_response_create_overload_3(self, client: RunwayML) -> None: + response = client.video_to_video.with_raw_response.create( + model="seedance2", + prompt_video="https://example.com/video.mp4", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + video_to_video = response.parse() + assert_matches_type(VideoToVideoCreateResponse, video_to_video, path=["response"]) + + @parametrize + def test_streaming_response_create_overload_3(self, client: RunwayML) -> None: + with client.video_to_video.with_streaming_response.create( + model="seedance2", + prompt_video="https://example.com/video.mp4", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + video_to_video = response.parse() + assert_matches_type(VideoToVideoCreateResponse, video_to_video, path=["response"]) + + assert cast(Any, response.is_closed) is True + class TestAsyncVideoToVideo: parametrize = pytest.mark.parametrize( @@ -252,3 +316,67 @@ async def test_streaming_response_create_overload_2(self, async_client: AsyncRun assert_matches_type(VideoToVideoCreateResponse, video_to_video, path=["response"]) assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_create_overload_3(self, async_client: AsyncRunwayML) -> None: + video_to_video = await async_client.video_to_video.create( + model="seedance2", + prompt_video="https://example.com/video.mp4", + ) + assert_matches_type(VideoToVideoCreateResponse, video_to_video, path=["response"]) + + @parametrize + async def test_method_create_with_all_params_overload_3(self, async_client: AsyncRunwayML) -> None: + video_to_video = await async_client.video_to_video.create( + model="seedance2", + prompt_video="https://example.com/video.mp4", + audio=True, + duration=4, + prompt_text="x", + ratio="992:432", + reference_audio=[ + { + "type": "audio", + "uri": "https://example.com/file", + } + ], + references=[ + { + "uri": "https://example.com/file", + "position": "first", + } + ], + reference_videos=[ + { + "type": "video", + "uri": "https://example.com/file", + } + ], + ) + assert_matches_type(VideoToVideoCreateResponse, video_to_video, path=["response"]) + + @parametrize + async def test_raw_response_create_overload_3(self, async_client: AsyncRunwayML) -> None: + response = await async_client.video_to_video.with_raw_response.create( + model="seedance2", + prompt_video="https://example.com/video.mp4", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + video_to_video = await response.parse() + assert_matches_type(VideoToVideoCreateResponse, video_to_video, path=["response"]) + + @parametrize + async def test_streaming_response_create_overload_3(self, async_client: AsyncRunwayML) -> None: + async with async_client.video_to_video.with_streaming_response.create( + model="seedance2", + prompt_video="https://example.com/video.mp4", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + video_to_video = await response.parse() + assert_matches_type(VideoToVideoCreateResponse, video_to_video, path=["response"]) + + assert cast(Any, response.is_closed) is True