runwayml 1.0.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- runwayml/__init__.py +93 -0
- runwayml/_base_client.py +2019 -0
- runwayml/_client.py +432 -0
- runwayml/_compat.py +217 -0
- runwayml/_constants.py +14 -0
- runwayml/_exceptions.py +108 -0
- runwayml/_files.py +123 -0
- runwayml/_models.py +785 -0
- runwayml/_qs.py +150 -0
- runwayml/_resource.py +43 -0
- runwayml/_response.py +821 -0
- runwayml/_streaming.py +333 -0
- runwayml/_types.py +217 -0
- runwayml/_utils/__init__.py +55 -0
- runwayml/_utils/_logs.py +25 -0
- runwayml/_utils/_proxy.py +62 -0
- runwayml/_utils/_reflection.py +42 -0
- runwayml/_utils/_streams.py +12 -0
- runwayml/_utils/_sync.py +81 -0
- runwayml/_utils/_transform.py +382 -0
- runwayml/_utils/_typing.py +120 -0
- runwayml/_utils/_utils.py +397 -0
- runwayml/_version.py +4 -0
- runwayml/lib/.keep +4 -0
- runwayml/py.typed +0 -0
- runwayml/resources/__init__.py +33 -0
- runwayml/resources/image_to_video.py +222 -0
- runwayml/resources/tasks.py +257 -0
- runwayml/types/__init__.py +7 -0
- runwayml/types/image_to_video_create_params.py +37 -0
- runwayml/types/image_to_video_create_response.py +12 -0
- runwayml/types/task_retrieve_response.py +58 -0
- runwayml-1.0.0.dist-info/METADATA +379 -0
- runwayml-1.0.0.dist-info/RECORD +36 -0
- runwayml-1.0.0.dist-info/WHEEL +4 -0
- runwayml-1.0.0.dist-info/licenses/LICENSE +201 -0
@@ -0,0 +1,257 @@
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
2
|
+
|
3
|
+
from __future__ import annotations
|
4
|
+
|
5
|
+
import httpx
|
6
|
+
|
7
|
+
from .._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven
|
8
|
+
from .._compat import cached_property
|
9
|
+
from .._resource import SyncAPIResource, AsyncAPIResource
|
10
|
+
from .._response import (
|
11
|
+
to_raw_response_wrapper,
|
12
|
+
to_streamed_response_wrapper,
|
13
|
+
async_to_raw_response_wrapper,
|
14
|
+
async_to_streamed_response_wrapper,
|
15
|
+
)
|
16
|
+
from .._base_client import make_request_options
|
17
|
+
from ..types.task_retrieve_response import TaskRetrieveResponse
|
18
|
+
|
19
|
+
__all__ = ["TasksResource", "AsyncTasksResource"]
|
20
|
+
|
21
|
+
|
22
|
+
class TasksResource(SyncAPIResource):
|
23
|
+
@cached_property
|
24
|
+
def with_raw_response(self) -> TasksResourceWithRawResponse:
|
25
|
+
"""
|
26
|
+
This property can be used as a prefix for any HTTP method call to return the
|
27
|
+
the raw response object instead of the parsed content.
|
28
|
+
|
29
|
+
For more information, see https://www.github.com/runwayml/sdk-python#accessing-raw-response-data-eg-headers
|
30
|
+
"""
|
31
|
+
return TasksResourceWithRawResponse(self)
|
32
|
+
|
33
|
+
@cached_property
|
34
|
+
def with_streaming_response(self) -> TasksResourceWithStreamingResponse:
|
35
|
+
"""
|
36
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
37
|
+
|
38
|
+
For more information, see https://www.github.com/runwayml/sdk-python#with_streaming_response
|
39
|
+
"""
|
40
|
+
return TasksResourceWithStreamingResponse(self)
|
41
|
+
|
42
|
+
def retrieve(
|
43
|
+
self,
|
44
|
+
id: str,
|
45
|
+
*,
|
46
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
47
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
48
|
+
extra_headers: Headers | None = None,
|
49
|
+
extra_query: Query | None = None,
|
50
|
+
extra_body: Body | None = None,
|
51
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
52
|
+
) -> TaskRetrieveResponse:
|
53
|
+
"""Return details about a task.
|
54
|
+
|
55
|
+
Consumers of this API should not expect updates
|
56
|
+
more frequent than once every five seconds for a given task.
|
57
|
+
|
58
|
+
Args:
|
59
|
+
extra_headers: Send extra headers
|
60
|
+
|
61
|
+
extra_query: Add additional query parameters to the request
|
62
|
+
|
63
|
+
extra_body: Add additional JSON properties to the request
|
64
|
+
|
65
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
66
|
+
"""
|
67
|
+
if not id:
|
68
|
+
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
|
69
|
+
return self._get(
|
70
|
+
f"/v1/tasks/{id}",
|
71
|
+
options=make_request_options(
|
72
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
73
|
+
),
|
74
|
+
cast_to=TaskRetrieveResponse,
|
75
|
+
)
|
76
|
+
|
77
|
+
def delete(
|
78
|
+
self,
|
79
|
+
id: str,
|
80
|
+
*,
|
81
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
82
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
83
|
+
extra_headers: Headers | None = None,
|
84
|
+
extra_query: Query | None = None,
|
85
|
+
extra_body: Body | None = None,
|
86
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
87
|
+
) -> None:
|
88
|
+
"""
|
89
|
+
Tasks that are running, pending, or throttled can be canceled by invoking this
|
90
|
+
method. Invoking this method for other tasks will delete them.
|
91
|
+
|
92
|
+
The output data associated with a deleted task will be deleted from persistent
|
93
|
+
storage in accordance with our data retention policy. Aborted and deleted tasks
|
94
|
+
will not be able to be fetched again in the future.
|
95
|
+
|
96
|
+
Args:
|
97
|
+
extra_headers: Send extra headers
|
98
|
+
|
99
|
+
extra_query: Add additional query parameters to the request
|
100
|
+
|
101
|
+
extra_body: Add additional JSON properties to the request
|
102
|
+
|
103
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
104
|
+
"""
|
105
|
+
if not id:
|
106
|
+
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
|
107
|
+
extra_headers = {"Accept": "*/*", **(extra_headers or {})}
|
108
|
+
return self._delete(
|
109
|
+
f"/v1/tasks/{id}",
|
110
|
+
options=make_request_options(
|
111
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
112
|
+
),
|
113
|
+
cast_to=NoneType,
|
114
|
+
)
|
115
|
+
|
116
|
+
|
117
|
+
class AsyncTasksResource(AsyncAPIResource):
|
118
|
+
@cached_property
|
119
|
+
def with_raw_response(self) -> AsyncTasksResourceWithRawResponse:
|
120
|
+
"""
|
121
|
+
This property can be used as a prefix for any HTTP method call to return the
|
122
|
+
the raw response object instead of the parsed content.
|
123
|
+
|
124
|
+
For more information, see https://www.github.com/runwayml/sdk-python#accessing-raw-response-data-eg-headers
|
125
|
+
"""
|
126
|
+
return AsyncTasksResourceWithRawResponse(self)
|
127
|
+
|
128
|
+
@cached_property
|
129
|
+
def with_streaming_response(self) -> AsyncTasksResourceWithStreamingResponse:
|
130
|
+
"""
|
131
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
132
|
+
|
133
|
+
For more information, see https://www.github.com/runwayml/sdk-python#with_streaming_response
|
134
|
+
"""
|
135
|
+
return AsyncTasksResourceWithStreamingResponse(self)
|
136
|
+
|
137
|
+
async def retrieve(
|
138
|
+
self,
|
139
|
+
id: str,
|
140
|
+
*,
|
141
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
142
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
143
|
+
extra_headers: Headers | None = None,
|
144
|
+
extra_query: Query | None = None,
|
145
|
+
extra_body: Body | None = None,
|
146
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
147
|
+
) -> TaskRetrieveResponse:
|
148
|
+
"""Return details about a task.
|
149
|
+
|
150
|
+
Consumers of this API should not expect updates
|
151
|
+
more frequent than once every five seconds for a given task.
|
152
|
+
|
153
|
+
Args:
|
154
|
+
extra_headers: Send extra headers
|
155
|
+
|
156
|
+
extra_query: Add additional query parameters to the request
|
157
|
+
|
158
|
+
extra_body: Add additional JSON properties to the request
|
159
|
+
|
160
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
161
|
+
"""
|
162
|
+
if not id:
|
163
|
+
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
|
164
|
+
return await self._get(
|
165
|
+
f"/v1/tasks/{id}",
|
166
|
+
options=make_request_options(
|
167
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
168
|
+
),
|
169
|
+
cast_to=TaskRetrieveResponse,
|
170
|
+
)
|
171
|
+
|
172
|
+
async def delete(
|
173
|
+
self,
|
174
|
+
id: str,
|
175
|
+
*,
|
176
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
177
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
178
|
+
extra_headers: Headers | None = None,
|
179
|
+
extra_query: Query | None = None,
|
180
|
+
extra_body: Body | None = None,
|
181
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
182
|
+
) -> None:
|
183
|
+
"""
|
184
|
+
Tasks that are running, pending, or throttled can be canceled by invoking this
|
185
|
+
method. Invoking this method for other tasks will delete them.
|
186
|
+
|
187
|
+
The output data associated with a deleted task will be deleted from persistent
|
188
|
+
storage in accordance with our data retention policy. Aborted and deleted tasks
|
189
|
+
will not be able to be fetched again in the future.
|
190
|
+
|
191
|
+
Args:
|
192
|
+
extra_headers: Send extra headers
|
193
|
+
|
194
|
+
extra_query: Add additional query parameters to the request
|
195
|
+
|
196
|
+
extra_body: Add additional JSON properties to the request
|
197
|
+
|
198
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
199
|
+
"""
|
200
|
+
if not id:
|
201
|
+
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
|
202
|
+
extra_headers = {"Accept": "*/*", **(extra_headers or {})}
|
203
|
+
return await self._delete(
|
204
|
+
f"/v1/tasks/{id}",
|
205
|
+
options=make_request_options(
|
206
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
207
|
+
),
|
208
|
+
cast_to=NoneType,
|
209
|
+
)
|
210
|
+
|
211
|
+
|
212
|
+
class TasksResourceWithRawResponse:
|
213
|
+
def __init__(self, tasks: TasksResource) -> None:
|
214
|
+
self._tasks = tasks
|
215
|
+
|
216
|
+
self.retrieve = to_raw_response_wrapper(
|
217
|
+
tasks.retrieve,
|
218
|
+
)
|
219
|
+
self.delete = to_raw_response_wrapper(
|
220
|
+
tasks.delete,
|
221
|
+
)
|
222
|
+
|
223
|
+
|
224
|
+
class AsyncTasksResourceWithRawResponse:
|
225
|
+
def __init__(self, tasks: AsyncTasksResource) -> None:
|
226
|
+
self._tasks = tasks
|
227
|
+
|
228
|
+
self.retrieve = async_to_raw_response_wrapper(
|
229
|
+
tasks.retrieve,
|
230
|
+
)
|
231
|
+
self.delete = async_to_raw_response_wrapper(
|
232
|
+
tasks.delete,
|
233
|
+
)
|
234
|
+
|
235
|
+
|
236
|
+
class TasksResourceWithStreamingResponse:
|
237
|
+
def __init__(self, tasks: TasksResource) -> None:
|
238
|
+
self._tasks = tasks
|
239
|
+
|
240
|
+
self.retrieve = to_streamed_response_wrapper(
|
241
|
+
tasks.retrieve,
|
242
|
+
)
|
243
|
+
self.delete = to_streamed_response_wrapper(
|
244
|
+
tasks.delete,
|
245
|
+
)
|
246
|
+
|
247
|
+
|
248
|
+
class AsyncTasksResourceWithStreamingResponse:
|
249
|
+
def __init__(self, tasks: AsyncTasksResource) -> None:
|
250
|
+
self._tasks = tasks
|
251
|
+
|
252
|
+
self.retrieve = async_to_streamed_response_wrapper(
|
253
|
+
tasks.retrieve,
|
254
|
+
)
|
255
|
+
self.delete = async_to_streamed_response_wrapper(
|
256
|
+
tasks.delete,
|
257
|
+
)
|
@@ -0,0 +1,7 @@
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
2
|
+
|
3
|
+
from __future__ import annotations
|
4
|
+
|
5
|
+
from .task_retrieve_response import TaskRetrieveResponse as TaskRetrieveResponse
|
6
|
+
from .image_to_video_create_params import ImageToVideoCreateParams as ImageToVideoCreateParams
|
7
|
+
from .image_to_video_create_response import ImageToVideoCreateResponse as ImageToVideoCreateResponse
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
2
|
+
|
3
|
+
from __future__ import annotations
|
4
|
+
|
5
|
+
from typing_extensions import Literal, Required, Annotated, TypedDict
|
6
|
+
|
7
|
+
from .._utils import PropertyInfo
|
8
|
+
|
9
|
+
__all__ = ["ImageToVideoCreateParams"]
|
10
|
+
|
11
|
+
|
12
|
+
class ImageToVideoCreateParams(TypedDict, total=False):
|
13
|
+
model: Required[Literal["gen3a_turbo"]]
|
14
|
+
"""The model variant to use."""
|
15
|
+
|
16
|
+
prompt_image: Required[Annotated[str, PropertyInfo(alias="promptImage")]]
|
17
|
+
"""A HTTPS URL pointing to an image.
|
18
|
+
|
19
|
+
Images must be JPEG, PNG, or WebP and are limited to 16MB. Responses must
|
20
|
+
include a valid `Content-Length` header.
|
21
|
+
"""
|
22
|
+
|
23
|
+
prompt_text: Annotated[str, PropertyInfo(alias="promptText")]
|
24
|
+
|
25
|
+
seed: int
|
26
|
+
"""If unspecified, a random number is chosen.
|
27
|
+
|
28
|
+
Varying the seed integer is a way to get different results for the same other
|
29
|
+
request parameters. Using the same seed integer for an identical request will
|
30
|
+
produce similar results.
|
31
|
+
"""
|
32
|
+
|
33
|
+
watermark: bool
|
34
|
+
"""
|
35
|
+
A boolean indicating whether or not the output video will contain a Runway
|
36
|
+
watermark.
|
37
|
+
"""
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
2
|
+
|
3
|
+
|
4
|
+
|
5
|
+
from .._models import BaseModel
|
6
|
+
|
7
|
+
__all__ = ["ImageToVideoCreateResponse"]
|
8
|
+
|
9
|
+
|
10
|
+
class ImageToVideoCreateResponse(BaseModel):
|
11
|
+
id: str
|
12
|
+
"""The ID of the newly created task."""
|
@@ -0,0 +1,58 @@
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
2
|
+
|
3
|
+
from typing import List, Optional
|
4
|
+
from datetime import datetime
|
5
|
+
from typing_extensions import Literal
|
6
|
+
|
7
|
+
from pydantic import Field as FieldInfo
|
8
|
+
|
9
|
+
from .._models import BaseModel
|
10
|
+
|
11
|
+
__all__ = ["TaskRetrieveResponse"]
|
12
|
+
|
13
|
+
|
14
|
+
class TaskRetrieveResponse(BaseModel):
|
15
|
+
id: str
|
16
|
+
|
17
|
+
created_at: datetime = FieldInfo(alias="createdAt")
|
18
|
+
"""The timestamp that the task was submitted at."""
|
19
|
+
|
20
|
+
status: Literal["RUNNING", "SUCCEEDED", "FAILED", "PENDING", "CANCELLED", "THROTTLED"]
|
21
|
+
"""
|
22
|
+
- `PENDING` tasks have been enqueued and are waiting to run.
|
23
|
+
- `THROTTLED` tasks are waiting to be enqueued until other jobs have finished
|
24
|
+
running.
|
25
|
+
- `RUNNING` tasks are currently being processed.
|
26
|
+
- `SUCCEEDED` tasks have completed successfully.
|
27
|
+
- `FAILED` tasks have failed.
|
28
|
+
- `CANCELLED` tasks have been aborted.
|
29
|
+
"""
|
30
|
+
|
31
|
+
failure: Optional[str] = None
|
32
|
+
"""
|
33
|
+
If the status is `FAILED`, this will contain a human-friendly reason for the
|
34
|
+
failure.
|
35
|
+
"""
|
36
|
+
|
37
|
+
failure_code: Optional[str] = FieldInfo(alias="failureCode", default=None)
|
38
|
+
"""
|
39
|
+
If the task has a status of `FAILED`, this contains a machine-readable error
|
40
|
+
code. This is a dot-separated string, with the leftmost segment being the most
|
41
|
+
generic and the rightmost segment being the most specific. For example,
|
42
|
+
`SAFETY.INPUT.TEXT` would indicate that the task failed due to a content
|
43
|
+
moderation error on the input text.
|
44
|
+
"""
|
45
|
+
|
46
|
+
output: Optional[List[str]] = None
|
47
|
+
"""If the status is `SUCCEEDED`, this will contain an array of strings.
|
48
|
+
|
49
|
+
Each string will be a URL that returns an output from the task. URLs expire
|
50
|
+
within 24-48 hours; fetch the task again to get fresh URLs. It is expected that
|
51
|
+
you download the assets at these URLs and store them in your own storage system.
|
52
|
+
"""
|
53
|
+
|
54
|
+
progress: Optional[float] = None
|
55
|
+
"""
|
56
|
+
If the task has a status of `RUNNING`, this will contain a floating point number
|
57
|
+
between 0 and 1 representing the progress of the generation.
|
58
|
+
"""
|