diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 3d5f4e3..1269f90 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "4.5.0" + ".": "4.6.0" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index fdf86c9..71483b0 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 14 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/runwayml%2Frunwayml-3b56f3bc1863ba0b8cc8f54cf428848c0135c6f47664f03e32b0d8466340bfd1.yml -openapi_spec_hash: dcb8a40ad5096c1250a9d5dd301302f0 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/runwayml%2Frunwayml-b96a5445f210ea11234f0c3c5064a8cf184389c7f52126dcdc9cb0a5441193fc.yml +openapi_spec_hash: 6ed349171fbd6f146f345d40874fe007 config_hash: c6562115ceb43e1cbae4b54e1618676e diff --git a/CHANGELOG.md b/CHANGELOG.md index 56a97e6..c5a119f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,23 @@ # Changelog +## 4.6.0 (2026-02-11) + +Full Changelog: [v4.5.0...v4.6.0](https://github.com/runwayml/sdk-python/compare/v4.5.0...v4.6.0) + +### Features + +* **api:** Gen-4.5 t2v+i2v ([cd2b196](https://github.com/runwayml/sdk-python/commit/cd2b196bb387e38cb27c06f9c7b15a1ac35c7a3d)) + + +### Bug Fixes + +* **client:** Update generated types for 4.5 t2v ([f024d8e](https://github.com/runwayml/sdk-python/commit/f024d8e35ca7687ac7e5815e2e7bfbf784316e21)) + + +### Chores + +* **internal:** bump dependencies ([c8073c8](https://github.com/runwayml/sdk-python/commit/c8073c8aa4a7f6f985fd2d405909aafcfccc63d0)) + ## 4.5.0 (2026-02-03) Full Changelog: [v4.4.0...v4.5.0](https://github.com/runwayml/sdk-python/compare/v4.4.0...v4.5.0) diff --git a/README.md b/README.md index 50dfb5d..10b9971 100644 --- a/README.md +++ b/README.md @@ -131,6 +131,7 @@ from runwayml import RunwayML client = RunwayML() text_to_image = client.text_to_image.create( + duration=2, model="gen4_image", prompt_text="promptText", ratio="1920:1080", diff --git a/pyproject.toml b/pyproject.toml index 5081355..f356f33 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "runwayml" -version = "4.5.0" +version = "4.6.0" description = "The official Python library for the runwayml API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/requirements-dev.lock b/requirements-dev.lock index cd73af7..d89fff6 100644 --- a/requirements-dev.lock +++ b/requirements-dev.lock @@ -12,14 +12,14 @@ -e file:. aiohappyeyeballs==2.6.1 # via aiohttp -aiohttp==3.13.2 +aiohttp==3.13.3 # via httpx-aiohttp # via runwayml aiosignal==1.4.0 # via aiohttp annotated-types==0.7.0 # via pydantic -anyio==4.12.0 +anyio==4.12.1 # via httpx # via runwayml argcomplete==3.6.3 @@ -31,7 +31,7 @@ attrs==25.4.0 # via nox backports-asyncio-runner==1.2.0 # via pytest-asyncio -certifi==2025.11.12 +certifi==2026.1.4 # via httpcore # via httpx colorlog==6.10.1 @@ -61,7 +61,7 @@ httpx==0.28.1 # via httpx-aiohttp # via respx # via runwayml -httpx-aiohttp==0.1.9 +httpx-aiohttp==0.1.12 # via runwayml humanize==4.13.0 # via nox @@ -69,7 +69,7 @@ idna==3.11 # via anyio # via httpx # via yarl -importlib-metadata==8.7.0 +importlib-metadata==8.7.1 iniconfig==2.1.0 # via pytest markdown-it-py==3.0.0 @@ -82,14 +82,14 @@ multidict==6.7.0 mypy==1.17.0 mypy-extensions==1.1.0 # via mypy -nodeenv==1.9.1 +nodeenv==1.10.0 # via pyright nox==2025.11.12 packaging==25.0 # via dependency-groups # via nox # via pytest -pathspec==0.12.1 +pathspec==1.0.3 # via mypy platformdirs==4.4.0 # via virtualenv @@ -115,13 +115,13 @@ python-dateutil==2.9.0.post0 # via time-machine respx==0.22.0 rich==14.2.0 -ruff==0.14.7 +ruff==0.14.13 six==1.17.0 # via python-dateutil sniffio==1.3.1 # via runwayml time-machine==2.19.0 -tomli==2.3.0 +tomli==2.4.0 # via dependency-groups # via mypy # via nox @@ -141,7 +141,7 @@ typing-extensions==4.15.0 # via virtualenv typing-inspection==0.4.2 # via pydantic -virtualenv==20.35.4 +virtualenv==20.36.1 # via nox yarl==1.22.0 # via aiohttp diff --git a/requirements.lock b/requirements.lock index 3fd0b43..7e3fcc8 100644 --- a/requirements.lock +++ b/requirements.lock @@ -12,21 +12,21 @@ -e file:. aiohappyeyeballs==2.6.1 # via aiohttp -aiohttp==3.13.2 +aiohttp==3.13.3 # via httpx-aiohttp # via runwayml aiosignal==1.4.0 # via aiohttp annotated-types==0.7.0 # via pydantic -anyio==4.12.0 +anyio==4.12.1 # via httpx # via runwayml async-timeout==5.0.1 # via aiohttp attrs==25.4.0 # via aiohttp -certifi==2025.11.12 +certifi==2026.1.4 # via httpcore # via httpx distro==1.9.0 @@ -43,7 +43,7 @@ httpcore==1.0.9 httpx==0.28.1 # via httpx-aiohttp # via runwayml -httpx-aiohttp==0.1.9 +httpx-aiohttp==0.1.12 # via runwayml idna==3.11 # via anyio diff --git a/src/runwayml/_version.py b/src/runwayml/_version.py index ba202b7..bc34164 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.5.0" # x-release-please-version +__version__ = "4.6.0" # x-release-please-version diff --git a/src/runwayml/resources/image_to_video.py b/src/runwayml/resources/image_to_video.py index c91be3d..970085e 100644 --- a/src/runwayml/resources/image_to_video.py +++ b/src/runwayml/resources/image_to_video.py @@ -50,6 +50,54 @@ def with_streaming_response(self) -> ImageToVideoResourceWithStreamingResponse: """ return ImageToVideoResourceWithStreamingResponse(self) + @overload + def create( + self, + *, + duration: int, + model: Literal["gen4.5"], + prompt_image: Union[str, Iterable[image_to_video_create_params.Gen4_5PromptImagePromptImage]], + prompt_text: str, + ratio: Literal["1280:720", "720:1280", "1104:832", "960:960", "832:1104", "1584:672", "672:1584"], + content_moderation: image_to_video_create_params.Gen4_5ContentModeration | Omit = omit, + seed: int | 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: + duration: The number of seconds of duration for the output video. Must be an integer from + 2 to 10. + + prompt_image: A HTTPS URL. + + prompt_text: A non-empty string up to 1000 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. + + content_moderation: Settings that affect the behavior of the content moderation system. + + seed: If unspecified, a random number is chosen. Varying the seed integer is a way to + get different results for the same other request parameters. Using the same seed + integer for an identical request will produce similar results. + + 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, @@ -272,6 +320,7 @@ def create( ... @required_args( + ["duration", "model", "prompt_image", "prompt_text", "ratio"], ["model", "prompt_image", "ratio"], ["model", "prompt_image", "prompt_text"], ["duration", "model", "prompt_image", "ratio"], @@ -279,26 +328,29 @@ def create( def create( self, *, - model: Literal["gen4_turbo"] + duration: int | Literal[4, 6, 8] | Literal[5, 10] | Literal[8] | Omit = omit, + model: Literal["gen4.5"] + | Literal["gen4_turbo"] | Literal["veo3.1"] | Literal["gen3a_turbo"] | Literal["veo3.1_fast"] | Literal["veo3"], - prompt_image: Union[str, Iterable[image_to_video_create_params.Gen4TurboPromptImagePromptImage]] + 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.Veo3_1PromptImagePromptImage]] | Union[str, Iterable[image_to_video_create_params.Veo3_1FastPromptImagePromptImage]] | Union[str, Iterable[image_to_video_create_params.Veo3PromptImagePromptImage]], - ratio: Literal["1280:720", "720:1280", "1104:832", "832:1104", "960:960", "1584:672"] + prompt_text: str | Omit = omit, + ratio: Literal["1280:720", "720:1280", "1104:832", "960:960", "832:1104", "1584:672", "672:1584"] + | 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"] | Omit = omit, - content_moderation: image_to_video_create_params.Gen4TurboContentModeration + content_moderation: image_to_video_create_params.Gen4_5ContentModeration + | image_to_video_create_params.Gen4TurboContentModeration | image_to_video_create_params.Gen3aTurboContentModeration | Omit = omit, - duration: int | Literal[4, 6, 8] | Literal[5, 10] | Literal[8] | Omit = omit, - prompt_text: str | Omit = omit, seed: int | Omit = omit, audio: bool | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -312,12 +364,12 @@ def create( "/v1/image_to_video", body=maybe_transform( { + "duration": duration, "model": model, "prompt_image": prompt_image, + "prompt_text": prompt_text, "ratio": ratio, "content_moderation": content_moderation, - "duration": duration, - "prompt_text": prompt_text, "seed": seed, "audio": audio, }, @@ -350,6 +402,54 @@ def with_streaming_response(self) -> AsyncImageToVideoResourceWithStreamingRespo """ return AsyncImageToVideoResourceWithStreamingResponse(self) + @overload + async def create( + self, + *, + duration: int, + model: Literal["gen4.5"], + prompt_image: Union[str, Iterable[image_to_video_create_params.Gen4_5PromptImagePromptImage]], + prompt_text: str, + ratio: Literal["1280:720", "720:1280", "1104:832", "960:960", "832:1104", "1584:672", "672:1584"], + content_moderation: image_to_video_create_params.Gen4_5ContentModeration | Omit = omit, + seed: int | 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: + duration: The number of seconds of duration for the output video. Must be an integer from + 2 to 10. + + prompt_image: A HTTPS URL. + + prompt_text: A non-empty string up to 1000 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. + + content_moderation: Settings that affect the behavior of the content moderation system. + + seed: If unspecified, a random number is chosen. Varying the seed integer is a way to + get different results for the same other request parameters. Using the same seed + integer for an identical request will produce similar results. + + 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, @@ -572,6 +672,7 @@ async def create( ... @required_args( + ["duration", "model", "prompt_image", "prompt_text", "ratio"], ["model", "prompt_image", "ratio"], ["model", "prompt_image", "prompt_text"], ["duration", "model", "prompt_image", "ratio"], @@ -579,26 +680,29 @@ async def create( async def create( self, *, - model: Literal["gen4_turbo"] + duration: int | Literal[4, 6, 8] | Literal[5, 10] | Literal[8] | Omit = omit, + model: Literal["gen4.5"] + | Literal["gen4_turbo"] | Literal["veo3.1"] | Literal["gen3a_turbo"] | Literal["veo3.1_fast"] | Literal["veo3"], - prompt_image: Union[str, Iterable[image_to_video_create_params.Gen4TurboPromptImagePromptImage]] + 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.Veo3_1PromptImagePromptImage]] | Union[str, Iterable[image_to_video_create_params.Veo3_1FastPromptImagePromptImage]] | Union[str, Iterable[image_to_video_create_params.Veo3PromptImagePromptImage]], - ratio: Literal["1280:720", "720:1280", "1104:832", "832:1104", "960:960", "1584:672"] + prompt_text: str | Omit = omit, + ratio: Literal["1280:720", "720:1280", "1104:832", "960:960", "832:1104", "1584:672", "672:1584"] + | 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"] | Omit = omit, - content_moderation: image_to_video_create_params.Gen4TurboContentModeration + content_moderation: image_to_video_create_params.Gen4_5ContentModeration + | image_to_video_create_params.Gen4TurboContentModeration | image_to_video_create_params.Gen3aTurboContentModeration | Omit = omit, - duration: int | Literal[4, 6, 8] | Literal[5, 10] | Literal[8] | Omit = omit, - prompt_text: str | Omit = omit, seed: int | Omit = omit, audio: bool | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -612,12 +716,12 @@ async def create( "/v1/image_to_video", body=await async_maybe_transform( { + "duration": duration, "model": model, "prompt_image": prompt_image, + "prompt_text": prompt_text, "ratio": ratio, "content_moderation": content_moderation, - "duration": duration, - "prompt_text": prompt_text, "seed": seed, "audio": audio, }, diff --git a/src/runwayml/resources/text_to_video.py b/src/runwayml/resources/text_to_video.py index cbd06bf..c7370eb 100644 --- a/src/runwayml/resources/text_to_video.py +++ b/src/runwayml/resources/text_to_video.py @@ -49,6 +49,51 @@ def with_streaming_response(self) -> TextToVideoResourceWithStreamingResponse: """ return TextToVideoResourceWithStreamingResponse(self) + @overload + def create( + self, + *, + duration: int, + model: Literal["gen4.5"], + prompt_text: str, + ratio: Literal["1280:720", "720:1280"], + content_moderation: text_to_video_create_params.Gen4_5ContentModeration | Omit = omit, + seed: int | 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: + duration: The number of seconds of duration for the output video. Must be an integer from + 2 to 10. + + prompt_text: A non-empty string up to 1000 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. + + content_moderation: Settings that affect the behavior of the content moderation system. + + seed: If unspecified, a random number is chosen. Varying the seed integer is a way to + get different results for the same other request parameters. Using the same seed + integer for an identical request will produce similar results. + + 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, @@ -163,15 +208,17 @@ def create( """ ... - @required_args(["model", "prompt_text", "ratio"], ["duration", "model", "prompt_text", "ratio"]) + @required_args(["duration", "model", "prompt_text", "ratio"], ["model", "prompt_text", "ratio"]) def create( self, *, - model: Literal["veo3.1"] | Literal["veo3.1_fast"] | Literal["veo3"], + duration: int | Literal[4, 6, 8] | Literal[8] | Omit = omit, + model: Literal["gen4.5"] | Literal["veo3.1"] | Literal["veo3.1_fast"] | Literal["veo3"], prompt_text: str, - ratio: Literal["1280:720", "720:1280", "1080:1920", "1920:1080"], + ratio: Literal["1280:720", "720:1280"] | Literal["1280:720", "720:1280", "1080:1920", "1920:1080"], + content_moderation: text_to_video_create_params.Gen4_5ContentModeration | Omit = omit, + seed: int | Omit = omit, audio: bool | Omit = omit, - duration: Literal[4, 6, 8] | Literal[8] | 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, @@ -183,11 +230,13 @@ def create( "/v1/text_to_video", body=maybe_transform( { + "duration": duration, "model": model, "prompt_text": prompt_text, "ratio": ratio, + "content_moderation": content_moderation, + "seed": seed, "audio": audio, - "duration": duration, }, text_to_video_create_params.TextToVideoCreateParams, ), @@ -218,6 +267,51 @@ def with_streaming_response(self) -> AsyncTextToVideoResourceWithStreamingRespon """ return AsyncTextToVideoResourceWithStreamingResponse(self) + @overload + async def create( + self, + *, + duration: int, + model: Literal["gen4.5"], + prompt_text: str, + ratio: Literal["1280:720", "720:1280"], + content_moderation: text_to_video_create_params.Gen4_5ContentModeration | Omit = omit, + seed: int | 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: + duration: The number of seconds of duration for the output video. Must be an integer from + 2 to 10. + + prompt_text: A non-empty string up to 1000 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. + + content_moderation: Settings that affect the behavior of the content moderation system. + + seed: If unspecified, a random number is chosen. Varying the seed integer is a way to + get different results for the same other request parameters. Using the same seed + integer for an identical request will produce similar results. + + 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, @@ -332,15 +426,17 @@ async def create( """ ... - @required_args(["model", "prompt_text", "ratio"], ["duration", "model", "prompt_text", "ratio"]) + @required_args(["duration", "model", "prompt_text", "ratio"], ["model", "prompt_text", "ratio"]) async def create( self, *, - model: Literal["veo3.1"] | Literal["veo3.1_fast"] | Literal["veo3"], + duration: int | Literal[4, 6, 8] | Literal[8] | Omit = omit, + model: Literal["gen4.5"] | Literal["veo3.1"] | Literal["veo3.1_fast"] | Literal["veo3"], prompt_text: str, - ratio: Literal["1280:720", "720:1280", "1080:1920", "1920:1080"], + ratio: Literal["1280:720", "720:1280"] | Literal["1280:720", "720:1280", "1080:1920", "1920:1080"], + content_moderation: text_to_video_create_params.Gen4_5ContentModeration | Omit = omit, + seed: int | Omit = omit, audio: bool | Omit = omit, - duration: Literal[4, 6, 8] | Literal[8] | 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, @@ -352,11 +448,13 @@ async def create( "/v1/text_to_video", body=await async_maybe_transform( { + "duration": duration, "model": model, "prompt_text": prompt_text, "ratio": ratio, + "content_moderation": content_moderation, + "seed": seed, "audio": audio, - "duration": duration, }, text_to_video_create_params.TextToVideoCreateParams, ), diff --git a/src/runwayml/types/image_to_video_create_params.py b/src/runwayml/types/image_to_video_create_params.py index 16ef9a0..b0aae0a 100644 --- a/src/runwayml/types/image_to_video_create_params.py +++ b/src/runwayml/types/image_to_video_create_params.py @@ -9,6 +9,9 @@ __all__ = [ "ImageToVideoCreateParams", + "Gen4_5", + "Gen4_5PromptImagePromptImage", + "Gen4_5ContentModeration", "Gen4Turbo", "Gen4TurboPromptImagePromptImage", "Gen4TurboContentModeration", @@ -24,6 +27,62 @@ ] +class Gen4_5(TypedDict, total=False): + duration: Required[int] + """The number of seconds of duration for the output video. + + Must be an integer from 2 to 10. + """ + + model: Required[Literal["gen4.5"]] + + prompt_image: Required[ + Annotated[Union[str, Iterable[Gen4_5PromptImagePromptImage]], PropertyInfo(alias="promptImage")] + ] + """A HTTPS URL.""" + + prompt_text: Required[Annotated[str, PropertyInfo(alias="promptText")]] + """A non-empty string up to 1000 characters (measured in UTF-16 code units). + + This should describe in detail what should appear in the output. + """ + + ratio: Required[Literal["1280:720", "720:1280", "1104:832", "960:960", "832:1104", "1584:672", "672:1584"]] + """The resolution of the output video.""" + + content_moderation: Annotated[Gen4_5ContentModeration, PropertyInfo(alias="contentModeration")] + """Settings that affect the behavior of the content moderation system.""" + + seed: int + """If unspecified, a random number is chosen. + + Varying the seed integer is a way to get different results for the same other + request parameters. Using the same seed integer for an identical request will + produce similar results. + """ + + +class Gen4_5PromptImagePromptImage(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 Gen4_5ContentModeration(TypedDict, total=False): + """Settings that affect the behavior of the content moderation system.""" + + public_figure_threshold: Annotated[Literal["auto", "low"], PropertyInfo(alias="publicFigureThreshold")] + """ + When set to `low`, the content moderation system will be less strict about + preventing generations that include recognizable public figures. + """ + + class Gen4Turbo(TypedDict, total=False): model: Required[Literal["gen4_turbo"]] @@ -243,4 +302,4 @@ class Veo3PromptImagePromptImage(TypedDict, total=False): """A HTTPS URL.""" -ImageToVideoCreateParams: TypeAlias = Union[Gen4Turbo, Veo3_1, Gen3aTurbo, Veo3_1Fast, Veo3] +ImageToVideoCreateParams: TypeAlias = Union[Gen4_5, Gen4Turbo, Veo3_1, Gen3aTurbo, Veo3_1Fast, Veo3] diff --git a/src/runwayml/types/organization_retrieve_usage_response.py b/src/runwayml/types/organization_retrieve_usage_response.py index 0e83260..faefaf2 100644 --- a/src/runwayml/types/organization_retrieve_usage_response.py +++ b/src/runwayml/types/organization_retrieve_usage_response.py @@ -16,6 +16,7 @@ class ResultUsedCredit(BaseModel): """The number of credits spent on the model.""" model: Literal[ + "gen4.5", "gen3a_turbo", "gen4_turbo", "gen4_image", @@ -49,6 +50,7 @@ class Result(BaseModel): class OrganizationRetrieveUsageResponse(BaseModel): models: List[ Literal[ + "gen4.5", "gen3a_turbo", "gen4_turbo", "gen4_image", diff --git a/src/runwayml/types/text_to_video_create_params.py b/src/runwayml/types/text_to_video_create_params.py index 3f770d4..7a964b3 100644 --- a/src/runwayml/types/text_to_video_create_params.py +++ b/src/runwayml/types/text_to_video_create_params.py @@ -7,7 +7,47 @@ from .._utils import PropertyInfo -__all__ = ["TextToVideoCreateParams", "Veo3_1", "Veo3_1Fast", "Veo3"] +__all__ = ["TextToVideoCreateParams", "Gen4_5", "Gen4_5ContentModeration", "Veo3_1", "Veo3_1Fast", "Veo3"] + + +class Gen4_5(TypedDict, total=False): + duration: Required[int] + """The number of seconds of duration for the output video. + + Must be an integer from 2 to 10. + """ + + model: Required[Literal["gen4.5"]] + + prompt_text: Required[Annotated[str, PropertyInfo(alias="promptText")]] + """A non-empty string up to 1000 characters (measured in UTF-16 code units). + + This should describe in detail what should appear in the output. + """ + + ratio: Required[Literal["1280:720", "720:1280"]] + """The resolution of the output video.""" + + content_moderation: Annotated[Gen4_5ContentModeration, PropertyInfo(alias="contentModeration")] + """Settings that affect the behavior of the content moderation system.""" + + seed: int + """If unspecified, a random number is chosen. + + Varying the seed integer is a way to get different results for the same other + request parameters. Using the same seed integer for an identical request will + produce similar results. + """ + + +class Gen4_5ContentModeration(TypedDict, total=False): + """Settings that affect the behavior of the content moderation system.""" + + public_figure_threshold: Annotated[Literal["auto", "low"], PropertyInfo(alias="publicFigureThreshold")] + """ + When set to `low`, the content moderation system will be less strict about + preventing generations that include recognizable public figures. + """ class Veo3_1(TypedDict, total=False): @@ -64,4 +104,4 @@ class Veo3(TypedDict, total=False): """The resolution of the output video.""" -TextToVideoCreateParams: TypeAlias = Union[Veo3_1, Veo3_1Fast, Veo3] +TextToVideoCreateParams: TypeAlias = Union[Gen4_5, Veo3_1, Veo3_1Fast, Veo3] diff --git a/tests/api_resources/test_image_to_video.py b/tests/api_resources/test_image_to_video.py index d14f454..d40ac94 100644 --- a/tests/api_resources/test_image_to_video.py +++ b/tests/api_resources/test_image_to_video.py @@ -20,14 +20,70 @@ class TestImageToVideo: @parametrize def test_method_create_overload_1(self, client: RunwayML) -> None: image_to_video = client.image_to_video.create( - model="gen4_turbo", + duration=2, + model="gen4.5", prompt_image="https://example.com/file", + prompt_text="x", ratio="1280:720", ) assert_matches_type(ImageToVideoCreateResponse, image_to_video, path=["response"]) @parametrize def test_method_create_with_all_params_overload_1(self, client: RunwayML) -> None: + image_to_video = client.image_to_video.create( + duration=2, + model="gen4.5", + prompt_image="https://example.com/file", + prompt_text="x", + ratio="1280:720", + content_moderation={"public_figure_threshold": "auto"}, + seed=0, + ) + assert_matches_type(ImageToVideoCreateResponse, image_to_video, path=["response"]) + + @parametrize + def test_raw_response_create_overload_1(self, client: RunwayML) -> None: + response = client.image_to_video.with_raw_response.create( + duration=2, + model="gen4.5", + prompt_image="https://example.com/file", + prompt_text="x", + ratio="1280:720", + ) + + 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_1(self, client: RunwayML) -> None: + with client.image_to_video.with_streaming_response.create( + duration=2, + model="gen4.5", + prompt_image="https://example.com/file", + prompt_text="x", + ratio="1280:720", + ) 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_2(self, client: RunwayML) -> None: + image_to_video = client.image_to_video.create( + model="gen4_turbo", + prompt_image="https://example.com/file", + ratio="1280:720", + ) + assert_matches_type(ImageToVideoCreateResponse, image_to_video, path=["response"]) + + @parametrize + def test_method_create_with_all_params_overload_2(self, client: RunwayML) -> None: image_to_video = client.image_to_video.create( model="gen4_turbo", prompt_image="https://example.com/file", @@ -40,7 +96,7 @@ def test_method_create_with_all_params_overload_1(self, client: RunwayML) -> Non assert_matches_type(ImageToVideoCreateResponse, image_to_video, path=["response"]) @parametrize - def test_raw_response_create_overload_1(self, client: RunwayML) -> None: + def test_raw_response_create_overload_2(self, client: RunwayML) -> None: response = client.image_to_video.with_raw_response.create( model="gen4_turbo", prompt_image="https://example.com/file", @@ -53,7 +109,7 @@ def test_raw_response_create_overload_1(self, client: RunwayML) -> None: assert_matches_type(ImageToVideoCreateResponse, image_to_video, path=["response"]) @parametrize - def test_streaming_response_create_overload_1(self, client: RunwayML) -> None: + def test_streaming_response_create_overload_2(self, client: RunwayML) -> None: with client.image_to_video.with_streaming_response.create( model="gen4_turbo", prompt_image="https://example.com/file", @@ -68,7 +124,7 @@ def test_streaming_response_create_overload_1(self, client: RunwayML) -> None: assert cast(Any, response.is_closed) is True @parametrize - def test_method_create_overload_2(self, client: RunwayML) -> None: + def test_method_create_overload_3(self, client: RunwayML) -> None: image_to_video = client.image_to_video.create( model="veo3.1", prompt_image="https://example.com/file", @@ -77,7 +133,7 @@ def test_method_create_overload_2(self, client: RunwayML) -> None: assert_matches_type(ImageToVideoCreateResponse, image_to_video, path=["response"]) @parametrize - def test_method_create_with_all_params_overload_2(self, client: RunwayML) -> None: + def test_method_create_with_all_params_overload_3(self, client: RunwayML) -> None: image_to_video = client.image_to_video.create( model="veo3.1", prompt_image="https://example.com/file", @@ -89,7 +145,7 @@ def test_method_create_with_all_params_overload_2(self, client: RunwayML) -> Non assert_matches_type(ImageToVideoCreateResponse, image_to_video, path=["response"]) @parametrize - def test_raw_response_create_overload_2(self, client: RunwayML) -> None: + def test_raw_response_create_overload_3(self, client: RunwayML) -> None: response = client.image_to_video.with_raw_response.create( model="veo3.1", prompt_image="https://example.com/file", @@ -102,7 +158,7 @@ def test_raw_response_create_overload_2(self, client: RunwayML) -> None: assert_matches_type(ImageToVideoCreateResponse, image_to_video, path=["response"]) @parametrize - def test_streaming_response_create_overload_2(self, client: RunwayML) -> None: + def test_streaming_response_create_overload_3(self, client: RunwayML) -> None: with client.image_to_video.with_streaming_response.create( model="veo3.1", prompt_image="https://example.com/file", @@ -117,7 +173,7 @@ 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: + def test_method_create_overload_4(self, client: RunwayML) -> None: image_to_video = client.image_to_video.create( model="gen3a_turbo", prompt_image="https://example.com/file", @@ -126,7 +182,7 @@ def test_method_create_overload_3(self, client: RunwayML) -> None: assert_matches_type(ImageToVideoCreateResponse, image_to_video, path=["response"]) @parametrize - def test_method_create_with_all_params_overload_3(self, client: RunwayML) -> None: + def test_method_create_with_all_params_overload_4(self, client: RunwayML) -> None: image_to_video = client.image_to_video.create( model="gen3a_turbo", prompt_image="https://example.com/file", @@ -139,7 +195,7 @@ def test_method_create_with_all_params_overload_3(self, client: RunwayML) -> Non assert_matches_type(ImageToVideoCreateResponse, image_to_video, path=["response"]) @parametrize - def test_raw_response_create_overload_3(self, client: RunwayML) -> None: + def test_raw_response_create_overload_4(self, client: RunwayML) -> None: response = client.image_to_video.with_raw_response.create( model="gen3a_turbo", prompt_image="https://example.com/file", @@ -152,7 +208,7 @@ def test_raw_response_create_overload_3(self, client: RunwayML) -> None: assert_matches_type(ImageToVideoCreateResponse, image_to_video, path=["response"]) @parametrize - def test_streaming_response_create_overload_3(self, client: RunwayML) -> None: + def test_streaming_response_create_overload_4(self, client: RunwayML) -> None: with client.image_to_video.with_streaming_response.create( model="gen3a_turbo", prompt_image="https://example.com/file", @@ -167,7 +223,7 @@ def test_streaming_response_create_overload_3(self, client: RunwayML) -> None: assert cast(Any, response.is_closed) is True @parametrize - def test_method_create_overload_4(self, client: RunwayML) -> None: + def test_method_create_overload_5(self, client: RunwayML) -> None: image_to_video = client.image_to_video.create( model="veo3.1_fast", prompt_image="https://example.com/file", @@ -176,7 +232,7 @@ def test_method_create_overload_4(self, client: RunwayML) -> None: assert_matches_type(ImageToVideoCreateResponse, image_to_video, path=["response"]) @parametrize - def test_method_create_with_all_params_overload_4(self, client: RunwayML) -> None: + def test_method_create_with_all_params_overload_5(self, client: RunwayML) -> None: image_to_video = client.image_to_video.create( model="veo3.1_fast", prompt_image="https://example.com/file", @@ -188,7 +244,7 @@ def test_method_create_with_all_params_overload_4(self, client: RunwayML) -> Non assert_matches_type(ImageToVideoCreateResponse, image_to_video, path=["response"]) @parametrize - def test_raw_response_create_overload_4(self, client: RunwayML) -> None: + def test_raw_response_create_overload_5(self, client: RunwayML) -> None: response = client.image_to_video.with_raw_response.create( model="veo3.1_fast", prompt_image="https://example.com/file", @@ -201,7 +257,7 @@ def test_raw_response_create_overload_4(self, client: RunwayML) -> None: assert_matches_type(ImageToVideoCreateResponse, image_to_video, path=["response"]) @parametrize - def test_streaming_response_create_overload_4(self, client: RunwayML) -> None: + def test_streaming_response_create_overload_5(self, client: RunwayML) -> None: with client.image_to_video.with_streaming_response.create( model="veo3.1_fast", prompt_image="https://example.com/file", @@ -216,7 +272,7 @@ def test_streaming_response_create_overload_4(self, client: RunwayML) -> None: assert cast(Any, response.is_closed) is True @parametrize - def test_method_create_overload_5(self, client: RunwayML) -> None: + def test_method_create_overload_6(self, client: RunwayML) -> None: image_to_video = client.image_to_video.create( duration=8, model="veo3", @@ -226,7 +282,7 @@ def test_method_create_overload_5(self, client: RunwayML) -> None: assert_matches_type(ImageToVideoCreateResponse, image_to_video, path=["response"]) @parametrize - def test_method_create_with_all_params_overload_5(self, client: RunwayML) -> None: + def test_method_create_with_all_params_overload_6(self, client: RunwayML) -> None: image_to_video = client.image_to_video.create( duration=8, model="veo3", @@ -237,7 +293,7 @@ def test_method_create_with_all_params_overload_5(self, client: RunwayML) -> Non assert_matches_type(ImageToVideoCreateResponse, image_to_video, path=["response"]) @parametrize - def test_raw_response_create_overload_5(self, client: RunwayML) -> None: + def test_raw_response_create_overload_6(self, client: RunwayML) -> None: response = client.image_to_video.with_raw_response.create( duration=8, model="veo3", @@ -251,7 +307,7 @@ def test_raw_response_create_overload_5(self, client: RunwayML) -> None: assert_matches_type(ImageToVideoCreateResponse, image_to_video, path=["response"]) @parametrize - def test_streaming_response_create_overload_5(self, client: RunwayML) -> None: + def test_streaming_response_create_overload_6(self, client: RunwayML) -> None: with client.image_to_video.with_streaming_response.create( duration=8, model="veo3", @@ -275,14 +331,70 @@ class TestAsyncImageToVideo: @parametrize async def test_method_create_overload_1(self, async_client: AsyncRunwayML) -> None: image_to_video = await async_client.image_to_video.create( - model="gen4_turbo", + duration=2, + model="gen4.5", prompt_image="https://example.com/file", + prompt_text="x", ratio="1280:720", ) assert_matches_type(ImageToVideoCreateResponse, image_to_video, path=["response"]) @parametrize async def test_method_create_with_all_params_overload_1(self, async_client: AsyncRunwayML) -> None: + image_to_video = await async_client.image_to_video.create( + duration=2, + model="gen4.5", + prompt_image="https://example.com/file", + prompt_text="x", + ratio="1280:720", + content_moderation={"public_figure_threshold": "auto"}, + seed=0, + ) + assert_matches_type(ImageToVideoCreateResponse, image_to_video, path=["response"]) + + @parametrize + async def test_raw_response_create_overload_1(self, async_client: AsyncRunwayML) -> None: + response = await async_client.image_to_video.with_raw_response.create( + duration=2, + model="gen4.5", + prompt_image="https://example.com/file", + prompt_text="x", + ratio="1280:720", + ) + + 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_1(self, async_client: AsyncRunwayML) -> None: + async with async_client.image_to_video.with_streaming_response.create( + duration=2, + model="gen4.5", + prompt_image="https://example.com/file", + prompt_text="x", + ratio="1280:720", + ) 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_2(self, async_client: AsyncRunwayML) -> None: + image_to_video = await async_client.image_to_video.create( + model="gen4_turbo", + prompt_image="https://example.com/file", + ratio="1280:720", + ) + assert_matches_type(ImageToVideoCreateResponse, image_to_video, path=["response"]) + + @parametrize + async def test_method_create_with_all_params_overload_2(self, async_client: AsyncRunwayML) -> None: image_to_video = await async_client.image_to_video.create( model="gen4_turbo", prompt_image="https://example.com/file", @@ -295,7 +407,7 @@ async def test_method_create_with_all_params_overload_1(self, async_client: Asyn assert_matches_type(ImageToVideoCreateResponse, image_to_video, path=["response"]) @parametrize - async def test_raw_response_create_overload_1(self, async_client: AsyncRunwayML) -> None: + async def test_raw_response_create_overload_2(self, async_client: AsyncRunwayML) -> None: response = await async_client.image_to_video.with_raw_response.create( model="gen4_turbo", prompt_image="https://example.com/file", @@ -308,7 +420,7 @@ async def test_raw_response_create_overload_1(self, async_client: AsyncRunwayML) assert_matches_type(ImageToVideoCreateResponse, image_to_video, path=["response"]) @parametrize - async def test_streaming_response_create_overload_1(self, async_client: AsyncRunwayML) -> None: + async def test_streaming_response_create_overload_2(self, async_client: AsyncRunwayML) -> None: async with async_client.image_to_video.with_streaming_response.create( model="gen4_turbo", prompt_image="https://example.com/file", @@ -323,7 +435,7 @@ async def test_streaming_response_create_overload_1(self, async_client: AsyncRun assert cast(Any, response.is_closed) is True @parametrize - async def test_method_create_overload_2(self, async_client: AsyncRunwayML) -> None: + async def test_method_create_overload_3(self, async_client: AsyncRunwayML) -> None: image_to_video = await async_client.image_to_video.create( model="veo3.1", prompt_image="https://example.com/file", @@ -332,7 +444,7 @@ async def test_method_create_overload_2(self, async_client: AsyncRunwayML) -> No assert_matches_type(ImageToVideoCreateResponse, image_to_video, path=["response"]) @parametrize - async def test_method_create_with_all_params_overload_2(self, async_client: AsyncRunwayML) -> None: + async def test_method_create_with_all_params_overload_3(self, async_client: AsyncRunwayML) -> None: image_to_video = await async_client.image_to_video.create( model="veo3.1", prompt_image="https://example.com/file", @@ -344,7 +456,7 @@ async def test_method_create_with_all_params_overload_2(self, async_client: Asyn assert_matches_type(ImageToVideoCreateResponse, image_to_video, path=["response"]) @parametrize - async def test_raw_response_create_overload_2(self, async_client: AsyncRunwayML) -> None: + async def test_raw_response_create_overload_3(self, async_client: AsyncRunwayML) -> None: response = await async_client.image_to_video.with_raw_response.create( model="veo3.1", prompt_image="https://example.com/file", @@ -357,7 +469,7 @@ async def test_raw_response_create_overload_2(self, async_client: AsyncRunwayML) assert_matches_type(ImageToVideoCreateResponse, image_to_video, path=["response"]) @parametrize - async def test_streaming_response_create_overload_2(self, async_client: AsyncRunwayML) -> None: + async def test_streaming_response_create_overload_3(self, async_client: AsyncRunwayML) -> None: async with async_client.image_to_video.with_streaming_response.create( model="veo3.1", prompt_image="https://example.com/file", @@ -372,7 +484,7 @@ async def test_streaming_response_create_overload_2(self, async_client: AsyncRun assert cast(Any, response.is_closed) is True @parametrize - async def test_method_create_overload_3(self, async_client: AsyncRunwayML) -> None: + async def test_method_create_overload_4(self, async_client: AsyncRunwayML) -> None: image_to_video = await async_client.image_to_video.create( model="gen3a_turbo", prompt_image="https://example.com/file", @@ -381,7 +493,7 @@ async def test_method_create_overload_3(self, async_client: AsyncRunwayML) -> No assert_matches_type(ImageToVideoCreateResponse, image_to_video, path=["response"]) @parametrize - async def test_method_create_with_all_params_overload_3(self, async_client: AsyncRunwayML) -> None: + async def test_method_create_with_all_params_overload_4(self, async_client: AsyncRunwayML) -> None: image_to_video = await async_client.image_to_video.create( model="gen3a_turbo", prompt_image="https://example.com/file", @@ -394,7 +506,7 @@ async def test_method_create_with_all_params_overload_3(self, async_client: Asyn assert_matches_type(ImageToVideoCreateResponse, image_to_video, path=["response"]) @parametrize - async def test_raw_response_create_overload_3(self, async_client: AsyncRunwayML) -> None: + async def test_raw_response_create_overload_4(self, async_client: AsyncRunwayML) -> None: response = await async_client.image_to_video.with_raw_response.create( model="gen3a_turbo", prompt_image="https://example.com/file", @@ -407,7 +519,7 @@ async def test_raw_response_create_overload_3(self, async_client: AsyncRunwayML) assert_matches_type(ImageToVideoCreateResponse, image_to_video, path=["response"]) @parametrize - async def test_streaming_response_create_overload_3(self, async_client: AsyncRunwayML) -> None: + async def test_streaming_response_create_overload_4(self, async_client: AsyncRunwayML) -> None: async with async_client.image_to_video.with_streaming_response.create( model="gen3a_turbo", prompt_image="https://example.com/file", @@ -422,7 +534,7 @@ async def test_streaming_response_create_overload_3(self, async_client: AsyncRun assert cast(Any, response.is_closed) is True @parametrize - async def test_method_create_overload_4(self, async_client: AsyncRunwayML) -> None: + async def test_method_create_overload_5(self, async_client: AsyncRunwayML) -> None: image_to_video = await async_client.image_to_video.create( model="veo3.1_fast", prompt_image="https://example.com/file", @@ -431,7 +543,7 @@ async def test_method_create_overload_4(self, async_client: AsyncRunwayML) -> No assert_matches_type(ImageToVideoCreateResponse, image_to_video, path=["response"]) @parametrize - async def test_method_create_with_all_params_overload_4(self, async_client: AsyncRunwayML) -> None: + async def test_method_create_with_all_params_overload_5(self, async_client: AsyncRunwayML) -> None: image_to_video = await async_client.image_to_video.create( model="veo3.1_fast", prompt_image="https://example.com/file", @@ -443,7 +555,7 @@ async def test_method_create_with_all_params_overload_4(self, async_client: Asyn assert_matches_type(ImageToVideoCreateResponse, image_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_5(self, async_client: AsyncRunwayML) -> None: response = await async_client.image_to_video.with_raw_response.create( model="veo3.1_fast", prompt_image="https://example.com/file", @@ -456,7 +568,7 @@ async def test_raw_response_create_overload_4(self, async_client: AsyncRunwayML) assert_matches_type(ImageToVideoCreateResponse, image_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_5(self, async_client: AsyncRunwayML) -> None: async with async_client.image_to_video.with_streaming_response.create( model="veo3.1_fast", prompt_image="https://example.com/file", @@ -471,7 +583,7 @@ async def test_streaming_response_create_overload_4(self, async_client: AsyncRun assert cast(Any, response.is_closed) is True @parametrize - async def test_method_create_overload_5(self, async_client: AsyncRunwayML) -> None: + async def test_method_create_overload_6(self, async_client: AsyncRunwayML) -> None: image_to_video = await async_client.image_to_video.create( duration=8, model="veo3", @@ -481,7 +593,7 @@ async def test_method_create_overload_5(self, async_client: AsyncRunwayML) -> No assert_matches_type(ImageToVideoCreateResponse, image_to_video, path=["response"]) @parametrize - async def test_method_create_with_all_params_overload_5(self, async_client: AsyncRunwayML) -> None: + 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( duration=8, model="veo3", @@ -492,7 +604,7 @@ async def test_method_create_with_all_params_overload_5(self, async_client: Asyn assert_matches_type(ImageToVideoCreateResponse, image_to_video, path=["response"]) @parametrize - async def test_raw_response_create_overload_5(self, async_client: AsyncRunwayML) -> None: + async def test_raw_response_create_overload_6(self, async_client: AsyncRunwayML) -> None: response = await async_client.image_to_video.with_raw_response.create( duration=8, model="veo3", @@ -506,7 +618,7 @@ async def test_raw_response_create_overload_5(self, async_client: AsyncRunwayML) assert_matches_type(ImageToVideoCreateResponse, image_to_video, path=["response"]) @parametrize - async def test_streaming_response_create_overload_5(self, async_client: AsyncRunwayML) -> None: + async def test_streaming_response_create_overload_6(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 49fb2f7..8ee3497 100644 --- a/tests/api_resources/test_text_to_video.py +++ b/tests/api_resources/test_text_to_video.py @@ -20,7 +20,8 @@ class TestTextToVideo: @parametrize def test_method_create_overload_1(self, client: RunwayML) -> None: text_to_video = client.text_to_video.create( - model="veo3.1", + duration=2, + model="gen4.5", prompt_text="x", ratio="1280:720", ) @@ -28,6 +29,57 @@ def test_method_create_overload_1(self, client: RunwayML) -> None: @parametrize def test_method_create_with_all_params_overload_1(self, client: RunwayML) -> None: + text_to_video = client.text_to_video.create( + duration=2, + model="gen4.5", + prompt_text="x", + ratio="1280:720", + content_moderation={"public_figure_threshold": "auto"}, + seed=0, + ) + assert_matches_type(TextToVideoCreateResponse, text_to_video, path=["response"]) + + @parametrize + def test_raw_response_create_overload_1(self, client: RunwayML) -> None: + response = client.text_to_video.with_raw_response.create( + duration=2, + model="gen4.5", + prompt_text="x", + ratio="1280:720", + ) + + 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_1(self, client: RunwayML) -> None: + with client.text_to_video.with_streaming_response.create( + duration=2, + model="gen4.5", + prompt_text="x", + ratio="1280:720", + ) 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_2(self, client: RunwayML) -> None: + text_to_video = client.text_to_video.create( + model="veo3.1", + prompt_text="x", + ratio="1280:720", + ) + assert_matches_type(TextToVideoCreateResponse, text_to_video, path=["response"]) + + @parametrize + def test_method_create_with_all_params_overload_2(self, client: RunwayML) -> None: text_to_video = client.text_to_video.create( model="veo3.1", prompt_text="x", @@ -38,7 +90,7 @@ def test_method_create_with_all_params_overload_1(self, client: RunwayML) -> Non assert_matches_type(TextToVideoCreateResponse, text_to_video, path=["response"]) @parametrize - def test_raw_response_create_overload_1(self, client: RunwayML) -> None: + def test_raw_response_create_overload_2(self, client: RunwayML) -> None: response = client.text_to_video.with_raw_response.create( model="veo3.1", prompt_text="x", @@ -51,7 +103,7 @@ def test_raw_response_create_overload_1(self, client: RunwayML) -> None: assert_matches_type(TextToVideoCreateResponse, text_to_video, path=["response"]) @parametrize - def test_streaming_response_create_overload_1(self, client: RunwayML) -> None: + def test_streaming_response_create_overload_2(self, client: RunwayML) -> None: with client.text_to_video.with_streaming_response.create( model="veo3.1", prompt_text="x", @@ -66,7 +118,7 @@ def test_streaming_response_create_overload_1(self, client: RunwayML) -> None: assert cast(Any, response.is_closed) is True @parametrize - def test_method_create_overload_2(self, client: RunwayML) -> None: + def test_method_create_overload_3(self, client: RunwayML) -> None: text_to_video = client.text_to_video.create( model="veo3.1_fast", prompt_text="x", @@ -75,7 +127,7 @@ def test_method_create_overload_2(self, client: RunwayML) -> None: assert_matches_type(TextToVideoCreateResponse, text_to_video, path=["response"]) @parametrize - def test_method_create_with_all_params_overload_2(self, client: RunwayML) -> None: + def test_method_create_with_all_params_overload_3(self, client: RunwayML) -> None: text_to_video = client.text_to_video.create( model="veo3.1_fast", prompt_text="x", @@ -86,7 +138,7 @@ def test_method_create_with_all_params_overload_2(self, client: RunwayML) -> Non assert_matches_type(TextToVideoCreateResponse, text_to_video, path=["response"]) @parametrize - def test_raw_response_create_overload_2(self, client: RunwayML) -> None: + def test_raw_response_create_overload_3(self, client: RunwayML) -> None: response = client.text_to_video.with_raw_response.create( model="veo3.1_fast", prompt_text="x", @@ -99,7 +151,7 @@ def test_raw_response_create_overload_2(self, client: RunwayML) -> None: assert_matches_type(TextToVideoCreateResponse, text_to_video, path=["response"]) @parametrize - def test_streaming_response_create_overload_2(self, client: RunwayML) -> None: + def test_streaming_response_create_overload_3(self, client: RunwayML) -> None: with client.text_to_video.with_streaming_response.create( model="veo3.1_fast", prompt_text="x", @@ -114,7 +166,7 @@ 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: + def test_method_create_overload_4(self, client: RunwayML) -> None: text_to_video = client.text_to_video.create( duration=8, model="veo3", @@ -124,7 +176,7 @@ def test_method_create_overload_3(self, client: RunwayML) -> None: assert_matches_type(TextToVideoCreateResponse, text_to_video, path=["response"]) @parametrize - def test_raw_response_create_overload_3(self, client: RunwayML) -> None: + def test_raw_response_create_overload_4(self, client: RunwayML) -> None: response = client.text_to_video.with_raw_response.create( duration=8, model="veo3", @@ -138,7 +190,7 @@ def test_raw_response_create_overload_3(self, client: RunwayML) -> None: assert_matches_type(TextToVideoCreateResponse, text_to_video, path=["response"]) @parametrize - def test_streaming_response_create_overload_3(self, client: RunwayML) -> None: + def test_streaming_response_create_overload_4(self, client: RunwayML) -> None: with client.text_to_video.with_streaming_response.create( duration=8, model="veo3", @@ -162,7 +214,8 @@ class TestAsyncTextToVideo: @parametrize async def test_method_create_overload_1(self, async_client: AsyncRunwayML) -> None: text_to_video = await async_client.text_to_video.create( - model="veo3.1", + duration=2, + model="gen4.5", prompt_text="x", ratio="1280:720", ) @@ -170,6 +223,57 @@ async def test_method_create_overload_1(self, async_client: AsyncRunwayML) -> No @parametrize async def test_method_create_with_all_params_overload_1(self, async_client: AsyncRunwayML) -> None: + text_to_video = await async_client.text_to_video.create( + duration=2, + model="gen4.5", + prompt_text="x", + ratio="1280:720", + content_moderation={"public_figure_threshold": "auto"}, + seed=0, + ) + assert_matches_type(TextToVideoCreateResponse, text_to_video, path=["response"]) + + @parametrize + async def test_raw_response_create_overload_1(self, async_client: AsyncRunwayML) -> None: + response = await async_client.text_to_video.with_raw_response.create( + duration=2, + model="gen4.5", + prompt_text="x", + ratio="1280:720", + ) + + 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_1(self, async_client: AsyncRunwayML) -> None: + async with async_client.text_to_video.with_streaming_response.create( + duration=2, + model="gen4.5", + prompt_text="x", + ratio="1280:720", + ) 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_2(self, async_client: AsyncRunwayML) -> None: + text_to_video = await async_client.text_to_video.create( + model="veo3.1", + prompt_text="x", + ratio="1280:720", + ) + assert_matches_type(TextToVideoCreateResponse, text_to_video, path=["response"]) + + @parametrize + async def test_method_create_with_all_params_overload_2(self, async_client: AsyncRunwayML) -> None: text_to_video = await async_client.text_to_video.create( model="veo3.1", prompt_text="x", @@ -180,7 +284,7 @@ async def test_method_create_with_all_params_overload_1(self, async_client: Asyn assert_matches_type(TextToVideoCreateResponse, text_to_video, path=["response"]) @parametrize - async def test_raw_response_create_overload_1(self, async_client: AsyncRunwayML) -> None: + async def test_raw_response_create_overload_2(self, async_client: AsyncRunwayML) -> None: response = await async_client.text_to_video.with_raw_response.create( model="veo3.1", prompt_text="x", @@ -193,7 +297,7 @@ async def test_raw_response_create_overload_1(self, async_client: AsyncRunwayML) assert_matches_type(TextToVideoCreateResponse, text_to_video, path=["response"]) @parametrize - async def test_streaming_response_create_overload_1(self, async_client: AsyncRunwayML) -> None: + async def test_streaming_response_create_overload_2(self, async_client: AsyncRunwayML) -> None: async with async_client.text_to_video.with_streaming_response.create( model="veo3.1", prompt_text="x", @@ -208,7 +312,7 @@ async def test_streaming_response_create_overload_1(self, async_client: AsyncRun assert cast(Any, response.is_closed) is True @parametrize - async def test_method_create_overload_2(self, async_client: AsyncRunwayML) -> None: + async def test_method_create_overload_3(self, async_client: AsyncRunwayML) -> None: text_to_video = await async_client.text_to_video.create( model="veo3.1_fast", prompt_text="x", @@ -217,7 +321,7 @@ async def test_method_create_overload_2(self, async_client: AsyncRunwayML) -> No assert_matches_type(TextToVideoCreateResponse, text_to_video, path=["response"]) @parametrize - async def test_method_create_with_all_params_overload_2(self, async_client: AsyncRunwayML) -> None: + async def test_method_create_with_all_params_overload_3(self, async_client: AsyncRunwayML) -> None: text_to_video = await async_client.text_to_video.create( model="veo3.1_fast", prompt_text="x", @@ -228,7 +332,7 @@ async def test_method_create_with_all_params_overload_2(self, async_client: Asyn assert_matches_type(TextToVideoCreateResponse, text_to_video, path=["response"]) @parametrize - async def test_raw_response_create_overload_2(self, async_client: AsyncRunwayML) -> None: + async def test_raw_response_create_overload_3(self, async_client: AsyncRunwayML) -> None: response = await async_client.text_to_video.with_raw_response.create( model="veo3.1_fast", prompt_text="x", @@ -241,7 +345,7 @@ async def test_raw_response_create_overload_2(self, async_client: AsyncRunwayML) assert_matches_type(TextToVideoCreateResponse, text_to_video, path=["response"]) @parametrize - async def test_streaming_response_create_overload_2(self, async_client: AsyncRunwayML) -> None: + async def test_streaming_response_create_overload_3(self, async_client: AsyncRunwayML) -> None: async with async_client.text_to_video.with_streaming_response.create( model="veo3.1_fast", prompt_text="x", @@ -256,7 +360,7 @@ async def test_streaming_response_create_overload_2(self, async_client: AsyncRun assert cast(Any, response.is_closed) is True @parametrize - async def test_method_create_overload_3(self, async_client: AsyncRunwayML) -> None: + async def test_method_create_overload_4(self, async_client: AsyncRunwayML) -> None: text_to_video = await async_client.text_to_video.create( duration=8, model="veo3", @@ -266,7 +370,7 @@ async def test_method_create_overload_3(self, async_client: AsyncRunwayML) -> No assert_matches_type(TextToVideoCreateResponse, text_to_video, path=["response"]) @parametrize - async def test_raw_response_create_overload_3(self, async_client: AsyncRunwayML) -> None: + async def test_raw_response_create_overload_4(self, async_client: AsyncRunwayML) -> None: response = await async_client.text_to_video.with_raw_response.create( duration=8, model="veo3", @@ -280,7 +384,7 @@ async def test_raw_response_create_overload_3(self, async_client: AsyncRunwayML) assert_matches_type(TextToVideoCreateResponse, text_to_video, path=["response"]) @parametrize - async def test_streaming_response_create_overload_3(self, async_client: AsyncRunwayML) -> None: + async def test_streaming_response_create_overload_4(self, async_client: AsyncRunwayML) -> None: async with async_client.text_to_video.with_streaming_response.create( duration=8, model="veo3", diff --git a/tests/test_client.py b/tests/test_client.py index 3e4deaa..41faab9 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -855,7 +855,7 @@ def test_retrying_timeout_errors_doesnt_leak(self, respx_mock: MockRouter, clien with pytest.raises(APITimeoutError): client.image_to_video.with_streaming_response.create( - model="gen4_turbo", prompt_image="https://example.com/file", ratio="1280:720" + duration=2, model="gen4.5", prompt_image="https://example.com/file", prompt_text="x", ratio="1280:720" ).__enter__() assert _get_open_connections(client) == 0 @@ -867,7 +867,7 @@ def test_retrying_status_errors_doesnt_leak(self, respx_mock: MockRouter, client with pytest.raises(APIStatusError): client.image_to_video.with_streaming_response.create( - model="gen4_turbo", prompt_image="https://example.com/file", ratio="1280:720" + duration=2, model="gen4.5", prompt_image="https://example.com/file", prompt_text="x", ratio="1280:720" ).__enter__() assert _get_open_connections(client) == 0 @@ -898,7 +898,7 @@ def retry_handler(_request: httpx.Request) -> httpx.Response: respx_mock.post("/v1/image_to_video").mock(side_effect=retry_handler) response = client.image_to_video.with_raw_response.create( - model="gen4_turbo", prompt_image="https://example.com/file", ratio="1280:720" + duration=2, model="gen4.5", prompt_image="https://example.com/file", prompt_text="x", ratio="1280:720" ) assert response.retries_taken == failures_before_success @@ -924,8 +924,10 @@ def retry_handler(_request: httpx.Request) -> httpx.Response: respx_mock.post("/v1/image_to_video").mock(side_effect=retry_handler) response = client.image_to_video.with_raw_response.create( - model="gen4_turbo", + duration=2, + model="gen4.5", prompt_image="https://example.com/file", + prompt_text="x", ratio="1280:720", extra_headers={"x-stainless-retry-count": Omit()}, ) @@ -952,8 +954,10 @@ def retry_handler(_request: httpx.Request) -> httpx.Response: respx_mock.post("/v1/image_to_video").mock(side_effect=retry_handler) response = client.image_to_video.with_raw_response.create( - model="gen4_turbo", + duration=2, + model="gen4.5", prompt_image="https://example.com/file", + prompt_text="x", ratio="1280:720", extra_headers={"x-stainless-retry-count": "42"}, ) @@ -1771,7 +1775,7 @@ async def test_retrying_timeout_errors_doesnt_leak( with pytest.raises(APITimeoutError): await async_client.image_to_video.with_streaming_response.create( - model="gen4_turbo", prompt_image="https://example.com/file", ratio="1280:720" + duration=2, model="gen4.5", prompt_image="https://example.com/file", prompt_text="x", ratio="1280:720" ).__aenter__() assert _get_open_connections(async_client) == 0 @@ -1785,7 +1789,7 @@ async def test_retrying_status_errors_doesnt_leak( with pytest.raises(APIStatusError): await async_client.image_to_video.with_streaming_response.create( - model="gen4_turbo", prompt_image="https://example.com/file", ratio="1280:720" + duration=2, model="gen4.5", prompt_image="https://example.com/file", prompt_text="x", ratio="1280:720" ).__aenter__() assert _get_open_connections(async_client) == 0 @@ -1816,7 +1820,7 @@ def retry_handler(_request: httpx.Request) -> httpx.Response: respx_mock.post("/v1/image_to_video").mock(side_effect=retry_handler) response = await client.image_to_video.with_raw_response.create( - model="gen4_turbo", prompt_image="https://example.com/file", ratio="1280:720" + duration=2, model="gen4.5", prompt_image="https://example.com/file", prompt_text="x", ratio="1280:720" ) assert response.retries_taken == failures_before_success @@ -1842,8 +1846,10 @@ def retry_handler(_request: httpx.Request) -> httpx.Response: respx_mock.post("/v1/image_to_video").mock(side_effect=retry_handler) response = await client.image_to_video.with_raw_response.create( - model="gen4_turbo", + duration=2, + model="gen4.5", prompt_image="https://example.com/file", + prompt_text="x", ratio="1280:720", extra_headers={"x-stainless-retry-count": Omit()}, ) @@ -1870,8 +1876,10 @@ def retry_handler(_request: httpx.Request) -> httpx.Response: respx_mock.post("/v1/image_to_video").mock(side_effect=retry_handler) response = await client.image_to_video.with_raw_response.create( - model="gen4_turbo", + duration=2, + model="gen4.5", prompt_image="https://example.com/file", + prompt_text="x", ratio="1280:720", extra_headers={"x-stainless-retry-count": "42"}, )