Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "2.3.8"
".": "3.0.0"
}
8 changes: 4 additions & 4 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 3
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/runwayml%2Frunwayml-256f9e345a6be31b0c9fc494e70c5ff977f52316c2a7b07f388154522e74d7bb.yml
openapi_spec_hash: 209a527f6ae5a1c2ed3a0e105df23277
config_hash: b2e67f7e840f18a352ace32dc0778534
configured_endpoints: 4
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/runwayml%2Frunwayml-8572445174f75794a6c3bdd3ffacd7ea80b140bb5ffbf59656e7da3668228249.yml
openapi_spec_hash: 8b99d38d0511b6f4291a7d39c12d580e
config_hash: 77ce816c37172a537f337abfaf2d65a9
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
# Changelog

## 3.0.0 (2025-04-09)

Full Changelog: [v2.3.8...v3.0.0](https://github.com/runwayml/sdk-python/compare/v2.3.8...v3.0.0)

### Features

* **api:** Update with gen4_turbo, org endpoint ([#135](https://github.com/runwayml/sdk-python/issues/135)) ([7f5d1ae](https://github.com/runwayml/sdk-python/commit/7f5d1ae46c6d54576771b66abd3259641072c066))


### Chores

* **internal:** remove trailing character ([#132](https://github.com/runwayml/sdk-python/issues/132)) ([cd78e34](https://github.com/runwayml/sdk-python/commit/cd78e34930a48a8696947178ee92ae22b1210898))
* **internal:** slight transform perf improvement ([#134](https://github.com/runwayml/sdk-python/issues/134)) ([33e5a68](https://github.com/runwayml/sdk-python/commit/33e5a68198c39c04edcf055c08f43e7800f8fbc0))

## 2.3.8 (2025-03-27)

Full Changelog: [v2.3.7...v2.3.8](https://github.com/runwayml/sdk-python/compare/v2.3.7...v2.3.8)
Expand Down
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ client = RunwayML(
)

image_to_video = client.image_to_video.create(
model="gen3a_turbo",
model="gen4_turbo",
prompt_image="https://example.com/assets/bunny.jpg",
prompt_text="The bunny is eating a carrot",
)
Expand Down Expand Up @@ -60,7 +60,7 @@ client = AsyncRunwayML(

async def main() -> None:
image_to_video = await client.image_to_video.create(
model="gen3a_turbo",
model="gen4_turbo",
prompt_image="https://example.com/assets/bunny.jpg",
prompt_text="The bunny is eating a carrot",
)
Expand Down Expand Up @@ -98,7 +98,7 @@ client = RunwayML()

try:
client.image_to_video.create(
model="gen3a_turbo",
model="gen4_turbo",
prompt_image="https://example.com/assets/bunny.jpg",
prompt_text="The bunny is eating a carrot",
)
Expand Down Expand Up @@ -145,7 +145,7 @@ client = RunwayML(

# Or, configure per-request:
client.with_options(max_retries=5).image_to_video.create(
model="gen3a_turbo",
model="gen4_turbo",
prompt_image="https://example.com/assets/bunny.jpg",
prompt_text="The bunny is eating a carrot",
)
Expand All @@ -172,7 +172,7 @@ client = RunwayML(

# Override per-request:
client.with_options(timeout=5.0).image_to_video.create(
model="gen3a_turbo",
model="gen4_turbo",
prompt_image="https://example.com/assets/bunny.jpg",
prompt_text="The bunny is eating a carrot",
)
Expand Down Expand Up @@ -217,7 +217,7 @@ from runwayml import RunwayML

client = RunwayML()
response = client.image_to_video.with_raw_response.create(
model="gen3a_turbo",
model="gen4_turbo",
prompt_image="https://example.com/assets/bunny.jpg",
prompt_text="The bunny is eating a carrot",
)
Expand All @@ -239,7 +239,7 @@ To stream the response body, use `.with_streaming_response` instead, which requi

```python
with client.image_to_video.with_streaming_response.create(
model="gen3a_turbo",
model="gen4_turbo",
prompt_image="https://example.com/assets/bunny.jpg",
prompt_text="The bunny is eating a carrot",
) as response:
Expand Down
12 changes: 12 additions & 0 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,15 @@ from runwayml.types import ImageToVideoCreateResponse
Methods:

- <code title="post /v1/image_to_video">client.image_to_video.<a href="./src/runwayml/resources/image_to_video.py">create</a>(\*\*<a href="src/runwayml/types/image_to_video_create_params.py">params</a>) -> <a href="./src/runwayml/types/image_to_video_create_response.py">ImageToVideoCreateResponse</a></code>

# Organization

Types:

```python
from runwayml.types import OrganizationRetrieveResponse
```

Methods:

- <code title="get /v1/organization">client.organization.<a href="./src/runwayml/resources/organization.py">retrieve</a>() -> <a href="./src/runwayml/types/organization_retrieve_response.py">OrganizationRetrieveResponse</a></code>
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "runwayml"
version = "2.3.8"
version = "3.0.0"
description = "The official Python library for the runwayml API"
dynamic = ["readme"]
license = "Apache-2.0"
Expand Down
10 changes: 9 additions & 1 deletion src/runwayml/_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
get_async_library,
)
from ._version import __version__
from .resources import tasks, image_to_video
from .resources import tasks, organization, image_to_video
from ._streaming import Stream as Stream, AsyncStream as AsyncStream
from ._exceptions import RunwayMLError, APIStatusError
from ._base_client import (
Expand All @@ -48,6 +48,7 @@
class RunwayML(SyncAPIClient):
tasks: tasks.TasksResource
image_to_video: image_to_video.ImageToVideoResource
organization: organization.OrganizationResource
with_raw_response: RunwayMLWithRawResponse
with_streaming_response: RunwayMLWithStreamedResponse

Expand Down Expand Up @@ -113,6 +114,7 @@ def __init__(

self.tasks = tasks.TasksResource(self)
self.image_to_video = image_to_video.ImageToVideoResource(self)
self.organization = organization.OrganizationResource(self)
self.with_raw_response = RunwayMLWithRawResponse(self)
self.with_streaming_response = RunwayMLWithStreamedResponse(self)

Expand Down Expand Up @@ -227,6 +229,7 @@ def _make_status_error(
class AsyncRunwayML(AsyncAPIClient):
tasks: tasks.AsyncTasksResource
image_to_video: image_to_video.AsyncImageToVideoResource
organization: organization.AsyncOrganizationResource
with_raw_response: AsyncRunwayMLWithRawResponse
with_streaming_response: AsyncRunwayMLWithStreamedResponse

Expand Down Expand Up @@ -292,6 +295,7 @@ def __init__(

self.tasks = tasks.AsyncTasksResource(self)
self.image_to_video = image_to_video.AsyncImageToVideoResource(self)
self.organization = organization.AsyncOrganizationResource(self)
self.with_raw_response = AsyncRunwayMLWithRawResponse(self)
self.with_streaming_response = AsyncRunwayMLWithStreamedResponse(self)

Expand Down Expand Up @@ -407,24 +411,28 @@ class RunwayMLWithRawResponse:
def __init__(self, client: RunwayML) -> None:
self.tasks = tasks.TasksResourceWithRawResponse(client.tasks)
self.image_to_video = image_to_video.ImageToVideoResourceWithRawResponse(client.image_to_video)
self.organization = organization.OrganizationResourceWithRawResponse(client.organization)


class AsyncRunwayMLWithRawResponse:
def __init__(self, client: AsyncRunwayML) -> None:
self.tasks = tasks.AsyncTasksResourceWithRawResponse(client.tasks)
self.image_to_video = image_to_video.AsyncImageToVideoResourceWithRawResponse(client.image_to_video)
self.organization = organization.AsyncOrganizationResourceWithRawResponse(client.organization)


class RunwayMLWithStreamedResponse:
def __init__(self, client: RunwayML) -> None:
self.tasks = tasks.TasksResourceWithStreamingResponse(client.tasks)
self.image_to_video = image_to_video.ImageToVideoResourceWithStreamingResponse(client.image_to_video)
self.organization = organization.OrganizationResourceWithStreamingResponse(client.organization)


class AsyncRunwayMLWithStreamedResponse:
def __init__(self, client: AsyncRunwayML) -> None:
self.tasks = tasks.AsyncTasksResourceWithStreamingResponse(client.tasks)
self.image_to_video = image_to_video.AsyncImageToVideoResourceWithStreamingResponse(client.image_to_video)
self.organization = organization.AsyncOrganizationResourceWithStreamingResponse(client.organization)


Client = RunwayML
Expand Down
22 changes: 22 additions & 0 deletions src/runwayml/_utils/_transform.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,10 @@ def _maybe_transform_key(key: str, type_: type) -> str:
return key


def _no_transform_needed(annotation: type) -> bool:
return annotation == float or annotation == int


def _transform_recursive(
data: object,
*,
Expand Down Expand Up @@ -184,6 +188,15 @@ def _transform_recursive(
return cast(object, data)

inner_type = extract_type_arg(stripped_type, 0)
if _no_transform_needed(inner_type):
# for some types there is no need to transform anything, so we can get a small
# perf boost from skipping that work.
#
# but we still need to convert to a list to ensure the data is json-serializable
if is_list(data):
return data
return list(data)

return [_transform_recursive(d, annotation=annotation, inner_type=inner_type) for d in data]

if is_union_type(stripped_type):
Expand Down Expand Up @@ -332,6 +345,15 @@ async def _async_transform_recursive(
return cast(object, data)

inner_type = extract_type_arg(stripped_type, 0)
if _no_transform_needed(inner_type):
# for some types there is no need to transform anything, so we can get a small
# perf boost from skipping that work.
#
# but we still need to convert to a list to ensure the data is json-serializable
if is_list(data):
return data
return list(data)

return [await _async_transform_recursive(d, annotation=annotation, inner_type=inner_type) for d in data]

if is_union_type(stripped_type):
Expand Down
2 changes: 1 addition & 1 deletion src/runwayml/_version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

__title__ = "runwayml"
__version__ = "2.3.8" # x-release-please-version
__version__ = "3.0.0" # x-release-please-version
14 changes: 14 additions & 0 deletions src/runwayml/resources/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,14 @@
TasksResourceWithStreamingResponse,
AsyncTasksResourceWithStreamingResponse,
)
from .organization import (
OrganizationResource,
AsyncOrganizationResource,
OrganizationResourceWithRawResponse,
AsyncOrganizationResourceWithRawResponse,
OrganizationResourceWithStreamingResponse,
AsyncOrganizationResourceWithStreamingResponse,
)
from .image_to_video import (
ImageToVideoResource,
AsyncImageToVideoResource,
Expand All @@ -30,4 +38,10 @@
"AsyncImageToVideoResourceWithRawResponse",
"ImageToVideoResourceWithStreamingResponse",
"AsyncImageToVideoResourceWithStreamingResponse",
"OrganizationResource",
"AsyncOrganizationResource",
"OrganizationResourceWithRawResponse",
"AsyncOrganizationResourceWithRawResponse",
"OrganizationResourceWithStreamingResponse",
"AsyncOrganizationResourceWithStreamingResponse",
]
20 changes: 6 additions & 14 deletions src/runwayml/resources/image_to_video.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,13 @@ def with_streaming_response(self) -> ImageToVideoResourceWithStreamingResponse:
def create(
self,
*,
model: Literal["gen3a_turbo"],
model: Literal["gen4_turbo", "gen3a_turbo"],
prompt_image: Union[str, Iterable[image_to_video_create_params.PromptImagePromptImage]],
duration: Literal[5, 10] | NotGiven = NOT_GIVEN,
prompt_text: str | NotGiven = NOT_GIVEN,
ratio: Literal["1280:768", "768:1280"] | NotGiven = NOT_GIVEN,
ratio: Literal["1280:720", "720:1280", "1104:832", "832:1104", "960:960", "1584:672", "1280:768", "768:1280"]
| NotGiven = NOT_GIVEN,
seed: int | NotGiven = NOT_GIVEN,
watermark: bool | NotGiven = NOT_GIVEN,
# 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,
Expand Down Expand Up @@ -84,9 +84,6 @@ def create(
get different results for the same other request parameters. Using the same seed
integer for an identical request will produce similar results.

watermark: A boolean indicating whether or not the output video will contain a Runway
watermark.

extra_headers: Send extra headers

extra_query: Add additional query parameters to the request
Expand All @@ -105,7 +102,6 @@ def create(
"prompt_text": prompt_text,
"ratio": ratio,
"seed": seed,
"watermark": watermark,
},
image_to_video_create_params.ImageToVideoCreateParams,
),
Expand Down Expand Up @@ -139,13 +135,13 @@ def with_streaming_response(self) -> AsyncImageToVideoResourceWithStreamingRespo
async def create(
self,
*,
model: Literal["gen3a_turbo"],
model: Literal["gen4_turbo", "gen3a_turbo"],
prompt_image: Union[str, Iterable[image_to_video_create_params.PromptImagePromptImage]],
duration: Literal[5, 10] | NotGiven = NOT_GIVEN,
prompt_text: str | NotGiven = NOT_GIVEN,
ratio: Literal["1280:768", "768:1280"] | NotGiven = NOT_GIVEN,
ratio: Literal["1280:720", "720:1280", "1104:832", "832:1104", "960:960", "1584:672", "1280:768", "768:1280"]
| NotGiven = NOT_GIVEN,
seed: int | NotGiven = NOT_GIVEN,
watermark: bool | NotGiven = NOT_GIVEN,
# 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,
Expand Down Expand Up @@ -173,9 +169,6 @@ async def create(
get different results for the same other request parameters. Using the same seed
integer for an identical request will produce similar results.

watermark: A boolean indicating whether or not the output video will contain a Runway
watermark.

extra_headers: Send extra headers

extra_query: Add additional query parameters to the request
Expand All @@ -194,7 +187,6 @@ async def create(
"prompt_text": prompt_text,
"ratio": ratio,
"seed": seed,
"watermark": watermark,
},
image_to_video_create_params.ImageToVideoCreateParams,
),
Expand Down
Loading