Skip to content

Commit 697a42d

Browse files
feat(api): Gen-4 Aleph
1 parent fc3fde4 commit 697a42d

13 files changed

+537
-10
lines changed

.stats.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
configured_endpoints: 8
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/runwayml%2Frunwayml-a9b2a29d1786c09f3a6efa4d5ab2eb820ccba13ea476aaf9754bb25eb01b92df.yml
3-
openapi_spec_hash: ca05bb3d1f13ce552df9f83b0feda850
4-
config_hash: 065bd59fe026dffb4a72832aec4d8ae6
1+
configured_endpoints: 9
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/runwayml%2Frunwayml-d2db6763646d15916f002572d89adfc19c9b404a5b98c91704ab0fdb5bee8415.yml
3+
openapi_spec_hash: fa209808177d586327f4b03947af9338
4+
config_hash: 36e1bb61e6171d3b2cb41fe52f7eaea7

api.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,18 @@ Methods:
2323

2424
- <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>
2525

26+
# VideoToVideo
27+
28+
Types:
29+
30+
```python
31+
from runwayml.types import VideoToVideoCreateResponse
32+
```
33+
34+
Methods:
35+
36+
- <code title="post /v1/video_to_video">client.video_to_video.<a href="./src/runwayml/resources/video_to_video.py">create</a>(\*\*<a href="src/runwayml/types/video_to_video_create_params.py">params</a>) -> <a href="./src/runwayml/types/video_to_video_create_response.py">VideoToVideoCreateResponse</a></code>
37+
2638
# TextToImage
2739

2840
Types:

src/runwayml/_client.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,15 @@
2121
)
2222
from ._utils import is_given, get_async_library
2323
from ._version import __version__
24-
from .resources import tasks, organization, text_to_image, video_upscale, image_to_video, character_performance
24+
from .resources import (
25+
tasks,
26+
organization,
27+
text_to_image,
28+
video_upscale,
29+
image_to_video,
30+
video_to_video,
31+
character_performance,
32+
)
2533
from ._streaming import Stream as Stream, AsyncStream as AsyncStream
2634
from ._exceptions import RunwayMLError, APIStatusError
2735
from ._base_client import (
@@ -45,6 +53,7 @@
4553
class RunwayML(SyncAPIClient):
4654
tasks: tasks.TasksResource
4755
image_to_video: image_to_video.ImageToVideoResource
56+
video_to_video: video_to_video.VideoToVideoResource
4857
text_to_image: text_to_image.TextToImageResource
4958
video_upscale: video_upscale.VideoUpscaleResource
5059
character_performance: character_performance.CharacterPerformanceResource
@@ -114,6 +123,7 @@ def __init__(
114123

115124
self.tasks = tasks.TasksResource(self)
116125
self.image_to_video = image_to_video.ImageToVideoResource(self)
126+
self.video_to_video = video_to_video.VideoToVideoResource(self)
117127
self.text_to_image = text_to_image.TextToImageResource(self)
118128
self.video_upscale = video_upscale.VideoUpscaleResource(self)
119129
self.character_performance = character_performance.CharacterPerformanceResource(self)
@@ -232,6 +242,7 @@ def _make_status_error(
232242
class AsyncRunwayML(AsyncAPIClient):
233243
tasks: tasks.AsyncTasksResource
234244
image_to_video: image_to_video.AsyncImageToVideoResource
245+
video_to_video: video_to_video.AsyncVideoToVideoResource
235246
text_to_image: text_to_image.AsyncTextToImageResource
236247
video_upscale: video_upscale.AsyncVideoUpscaleResource
237248
character_performance: character_performance.AsyncCharacterPerformanceResource
@@ -301,6 +312,7 @@ def __init__(
301312

302313
self.tasks = tasks.AsyncTasksResource(self)
303314
self.image_to_video = image_to_video.AsyncImageToVideoResource(self)
315+
self.video_to_video = video_to_video.AsyncVideoToVideoResource(self)
304316
self.text_to_image = text_to_image.AsyncTextToImageResource(self)
305317
self.video_upscale = video_upscale.AsyncVideoUpscaleResource(self)
306318
self.character_performance = character_performance.AsyncCharacterPerformanceResource(self)
@@ -420,6 +432,7 @@ class RunwayMLWithRawResponse:
420432
def __init__(self, client: RunwayML) -> None:
421433
self.tasks = tasks.TasksResourceWithRawResponse(client.tasks)
422434
self.image_to_video = image_to_video.ImageToVideoResourceWithRawResponse(client.image_to_video)
435+
self.video_to_video = video_to_video.VideoToVideoResourceWithRawResponse(client.video_to_video)
423436
self.text_to_image = text_to_image.TextToImageResourceWithRawResponse(client.text_to_image)
424437
self.video_upscale = video_upscale.VideoUpscaleResourceWithRawResponse(client.video_upscale)
425438
self.character_performance = character_performance.CharacterPerformanceResourceWithRawResponse(
@@ -432,6 +445,7 @@ class AsyncRunwayMLWithRawResponse:
432445
def __init__(self, client: AsyncRunwayML) -> None:
433446
self.tasks = tasks.AsyncTasksResourceWithRawResponse(client.tasks)
434447
self.image_to_video = image_to_video.AsyncImageToVideoResourceWithRawResponse(client.image_to_video)
448+
self.video_to_video = video_to_video.AsyncVideoToVideoResourceWithRawResponse(client.video_to_video)
435449
self.text_to_image = text_to_image.AsyncTextToImageResourceWithRawResponse(client.text_to_image)
436450
self.video_upscale = video_upscale.AsyncVideoUpscaleResourceWithRawResponse(client.video_upscale)
437451
self.character_performance = character_performance.AsyncCharacterPerformanceResourceWithRawResponse(
@@ -444,6 +458,7 @@ class RunwayMLWithStreamedResponse:
444458
def __init__(self, client: RunwayML) -> None:
445459
self.tasks = tasks.TasksResourceWithStreamingResponse(client.tasks)
446460
self.image_to_video = image_to_video.ImageToVideoResourceWithStreamingResponse(client.image_to_video)
461+
self.video_to_video = video_to_video.VideoToVideoResourceWithStreamingResponse(client.video_to_video)
447462
self.text_to_image = text_to_image.TextToImageResourceWithStreamingResponse(client.text_to_image)
448463
self.video_upscale = video_upscale.VideoUpscaleResourceWithStreamingResponse(client.video_upscale)
449464
self.character_performance = character_performance.CharacterPerformanceResourceWithStreamingResponse(
@@ -456,6 +471,7 @@ class AsyncRunwayMLWithStreamedResponse:
456471
def __init__(self, client: AsyncRunwayML) -> None:
457472
self.tasks = tasks.AsyncTasksResourceWithStreamingResponse(client.tasks)
458473
self.image_to_video = image_to_video.AsyncImageToVideoResourceWithStreamingResponse(client.image_to_video)
474+
self.video_to_video = video_to_video.AsyncVideoToVideoResourceWithStreamingResponse(client.video_to_video)
459475
self.text_to_image = text_to_image.AsyncTextToImageResourceWithStreamingResponse(client.text_to_image)
460476
self.video_upscale = video_upscale.AsyncVideoUpscaleResourceWithStreamingResponse(client.video_upscale)
461477
self.character_performance = character_performance.AsyncCharacterPerformanceResourceWithStreamingResponse(

src/runwayml/resources/__init__.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,14 @@
4040
ImageToVideoResourceWithStreamingResponse,
4141
AsyncImageToVideoResourceWithStreamingResponse,
4242
)
43+
from .video_to_video import (
44+
VideoToVideoResource,
45+
AsyncVideoToVideoResource,
46+
VideoToVideoResourceWithRawResponse,
47+
AsyncVideoToVideoResourceWithRawResponse,
48+
VideoToVideoResourceWithStreamingResponse,
49+
AsyncVideoToVideoResourceWithStreamingResponse,
50+
)
4351
from .character_performance import (
4452
CharacterPerformanceResource,
4553
AsyncCharacterPerformanceResource,
@@ -62,6 +70,12 @@
6270
"AsyncImageToVideoResourceWithRawResponse",
6371
"ImageToVideoResourceWithStreamingResponse",
6472
"AsyncImageToVideoResourceWithStreamingResponse",
73+
"VideoToVideoResource",
74+
"AsyncVideoToVideoResource",
75+
"VideoToVideoResourceWithRawResponse",
76+
"AsyncVideoToVideoResourceWithRawResponse",
77+
"VideoToVideoResourceWithStreamingResponse",
78+
"AsyncVideoToVideoResourceWithStreamingResponse",
6579
"TextToImageResource",
6680
"AsyncTextToImageResource",
6781
"TextToImageResourceWithRawResponse",

src/runwayml/resources/text_to_image.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ def create(
9797
content_moderation: Settings that affect the behavior of the content moderation system.
9898
9999
reference_images: An array of images to be used as references for the generated image output. Up
100-
to three reference images can be provided.
100+
to three reference images can be provided for `gen4_image`.
101101
102102
seed: If unspecified, a random number is chosen. Varying the seed integer is a way to
103103
get different results for the same other request parameters. Using the same seed
@@ -198,7 +198,7 @@ async def create(
198198
content_moderation: Settings that affect the behavior of the content moderation system.
199199
200200
reference_images: An array of images to be used as references for the generated image output. Up
201-
to three reference images can be provided.
201+
to three reference images can be provided for `gen4_image`.
202202
203203
seed: If unspecified, a random number is chosen. Varying the seed integer is a way to
204204
get different results for the same other request parameters. Using the same seed
Lines changed: 244 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,244 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from __future__ import annotations
4+
5+
from typing import Iterable
6+
from typing_extensions import Literal
7+
8+
import httpx
9+
10+
from ..types import video_to_video_create_params
11+
from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven
12+
from .._utils import maybe_transform, async_maybe_transform
13+
from .._compat import cached_property
14+
from .._resource import SyncAPIResource, AsyncAPIResource
15+
from .._response import (
16+
to_raw_response_wrapper,
17+
to_streamed_response_wrapper,
18+
async_to_raw_response_wrapper,
19+
async_to_streamed_response_wrapper,
20+
)
21+
from ..lib.polling import (
22+
NewTaskCreatedResponse,
23+
AsyncNewTaskCreatedResponse,
24+
create_waitable_resource,
25+
create_async_waitable_resource,
26+
)
27+
from .._base_client import make_request_options
28+
from ..types.video_to_video_create_response import VideoToVideoCreateResponse
29+
30+
__all__ = ["VideoToVideoResource", "AsyncVideoToVideoResource"]
31+
32+
33+
class VideoToVideoResource(SyncAPIResource):
34+
@cached_property
35+
def with_raw_response(self) -> VideoToVideoResourceWithRawResponse:
36+
"""
37+
This property can be used as a prefix for any HTTP method call to return
38+
the raw response object instead of the parsed content.
39+
40+
For more information, see https://www.github.com/runwayml/sdk-python#accessing-raw-response-data-eg-headers
41+
"""
42+
return VideoToVideoResourceWithRawResponse(self)
43+
44+
@cached_property
45+
def with_streaming_response(self) -> VideoToVideoResourceWithStreamingResponse:
46+
"""
47+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
48+
49+
For more information, see https://www.github.com/runwayml/sdk-python#with_streaming_response
50+
"""
51+
return VideoToVideoResourceWithStreamingResponse(self)
52+
53+
def create(
54+
self,
55+
*,
56+
model: Literal["gen4_aleph"],
57+
prompt_text: str,
58+
ratio: Literal["1280:720", "720:1280", "1104:832", "960:960", "832:1104", "1584:672", "848:480", "640:480"],
59+
video_uri: str,
60+
content_moderation: video_to_video_create_params.ContentModeration | NotGiven = NOT_GIVEN,
61+
references: Iterable[video_to_video_create_params.Reference] | NotGiven = NOT_GIVEN,
62+
seed: int | NotGiven = NOT_GIVEN,
63+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
64+
# The extra values given here take precedence over values defined on the client or passed to this method.
65+
extra_headers: Headers | None = None,
66+
extra_query: Query | None = None,
67+
extra_body: Body | None = None,
68+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
69+
) -> NewTaskCreatedResponse:
70+
"""
71+
This endpoint will start a new task to generate a video from a video.
72+
73+
Args:
74+
model: The model variant to use.
75+
76+
prompt_text: A non-empty string up to 1000 characters (measured in UTF-16 code units). This
77+
should describe in detail what should appear in the output.
78+
79+
ratio: The resolution of the output video.
80+
81+
video_uri: A HTTPS URL pointing to a video or a data URI containing a video. See
82+
[our docs](/assets/inputs#videos) on video inputs for more information.
83+
84+
content_moderation: Settings that affect the behavior of the content moderation system.
85+
86+
references: An array of references. Currently up to one reference is supported. See
87+
[our docs](/assets/inputs#images) on image inputs for more information.
88+
89+
seed: If unspecified, a random number is chosen. Varying the seed integer is a way to
90+
get different results for the same other request parameters. Using the same seed
91+
integer for an identical request will produce similar results.
92+
93+
extra_headers: Send extra headers
94+
95+
extra_query: Add additional query parameters to the request
96+
97+
extra_body: Add additional JSON properties to the request
98+
99+
timeout: Override the client-level default timeout for this request, in seconds
100+
"""
101+
return self._post(
102+
"/v1/video_to_video",
103+
body=maybe_transform(
104+
{
105+
"model": model,
106+
"prompt_text": prompt_text,
107+
"ratio": ratio,
108+
"video_uri": video_uri,
109+
"content_moderation": content_moderation,
110+
"references": references,
111+
"seed": seed,
112+
},
113+
video_to_video_create_params.VideoToVideoCreateParams,
114+
),
115+
options=make_request_options(
116+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
117+
),
118+
cast_to=create_waitable_resource(VideoToVideoCreateResponse, self._client),
119+
)
120+
121+
122+
class AsyncVideoToVideoResource(AsyncAPIResource):
123+
@cached_property
124+
def with_raw_response(self) -> AsyncVideoToVideoResourceWithRawResponse:
125+
"""
126+
This property can be used as a prefix for any HTTP method call to return
127+
the raw response object instead of the parsed content.
128+
129+
For more information, see https://www.github.com/runwayml/sdk-python#accessing-raw-response-data-eg-headers
130+
"""
131+
return AsyncVideoToVideoResourceWithRawResponse(self)
132+
133+
@cached_property
134+
def with_streaming_response(self) -> AsyncVideoToVideoResourceWithStreamingResponse:
135+
"""
136+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
137+
138+
For more information, see https://www.github.com/runwayml/sdk-python#with_streaming_response
139+
"""
140+
return AsyncVideoToVideoResourceWithStreamingResponse(self)
141+
142+
async def create(
143+
self,
144+
*,
145+
model: Literal["gen4_aleph"],
146+
prompt_text: str,
147+
ratio: Literal["1280:720", "720:1280", "1104:832", "960:960", "832:1104", "1584:672", "848:480", "640:480"],
148+
video_uri: str,
149+
content_moderation: video_to_video_create_params.ContentModeration | NotGiven = NOT_GIVEN,
150+
references: Iterable[video_to_video_create_params.Reference] | NotGiven = NOT_GIVEN,
151+
seed: int | NotGiven = NOT_GIVEN,
152+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
153+
# The extra values given here take precedence over values defined on the client or passed to this method.
154+
extra_headers: Headers | None = None,
155+
extra_query: Query | None = None,
156+
extra_body: Body | None = None,
157+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
158+
) -> AsyncNewTaskCreatedResponse:
159+
"""
160+
This endpoint will start a new task to generate a video from a video.
161+
162+
Args:
163+
model: The model variant to use.
164+
165+
prompt_text: A non-empty string up to 1000 characters (measured in UTF-16 code units). This
166+
should describe in detail what should appear in the output.
167+
168+
ratio: The resolution of the output video.
169+
170+
video_uri: A HTTPS URL pointing to a video or a data URI containing a video. See
171+
[our docs](/assets/inputs#videos) on video inputs for more information.
172+
173+
content_moderation: Settings that affect the behavior of the content moderation system.
174+
175+
references: An array of references. Currently up to one reference is supported. See
176+
[our docs](/assets/inputs#images) on image inputs for more information.
177+
178+
seed: If unspecified, a random number is chosen. Varying the seed integer is a way to
179+
get different results for the same other request parameters. Using the same seed
180+
integer for an identical request will produce similar results.
181+
182+
extra_headers: Send extra headers
183+
184+
extra_query: Add additional query parameters to the request
185+
186+
extra_body: Add additional JSON properties to the request
187+
188+
timeout: Override the client-level default timeout for this request, in seconds
189+
"""
190+
return await self._post(
191+
"/v1/video_to_video",
192+
body=await async_maybe_transform(
193+
{
194+
"model": model,
195+
"prompt_text": prompt_text,
196+
"ratio": ratio,
197+
"video_uri": video_uri,
198+
"content_moderation": content_moderation,
199+
"references": references,
200+
"seed": seed,
201+
},
202+
video_to_video_create_params.VideoToVideoCreateParams,
203+
),
204+
options=make_request_options(
205+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
206+
),
207+
cast_to=create_async_waitable_resource(VideoToVideoCreateResponse, self._client),
208+
)
209+
210+
211+
class VideoToVideoResourceWithRawResponse:
212+
def __init__(self, video_to_video: VideoToVideoResource) -> None:
213+
self._video_to_video = video_to_video
214+
215+
self.create = to_raw_response_wrapper(
216+
video_to_video.create,
217+
)
218+
219+
220+
class AsyncVideoToVideoResourceWithRawResponse:
221+
def __init__(self, video_to_video: AsyncVideoToVideoResource) -> None:
222+
self._video_to_video = video_to_video
223+
224+
self.create = async_to_raw_response_wrapper(
225+
video_to_video.create,
226+
)
227+
228+
229+
class VideoToVideoResourceWithStreamingResponse:
230+
def __init__(self, video_to_video: VideoToVideoResource) -> None:
231+
self._video_to_video = video_to_video
232+
233+
self.create = to_streamed_response_wrapper(
234+
video_to_video.create,
235+
)
236+
237+
238+
class AsyncVideoToVideoResourceWithStreamingResponse:
239+
def __init__(self, video_to_video: AsyncVideoToVideoResource) -> None:
240+
self._video_to_video = video_to_video
241+
242+
self.create = async_to_streamed_response_wrapper(
243+
video_to_video.create,
244+
)

0 commit comments

Comments
 (0)