runwayml 2.3.8__tar.gz → 3.0.0__tar.gz
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-3.0.0/.release-please-manifest.json +3 -0
- {runwayml-2.3.8 → runwayml-3.0.0}/CHANGELOG.md +14 -0
- {runwayml-2.3.8 → runwayml-3.0.0}/PKG-INFO +8 -8
- {runwayml-2.3.8 → runwayml-3.0.0}/README.md +7 -7
- {runwayml-2.3.8 → runwayml-3.0.0}/api.md +12 -0
- {runwayml-2.3.8 → runwayml-3.0.0}/pyproject.toml +1 -1
- {runwayml-2.3.8 → runwayml-3.0.0}/src/runwayml/_client.py +9 -1
- {runwayml-2.3.8 → runwayml-3.0.0}/src/runwayml/_utils/_transform.py +22 -0
- {runwayml-2.3.8 → runwayml-3.0.0}/src/runwayml/_version.py +1 -1
- {runwayml-2.3.8 → runwayml-3.0.0}/src/runwayml/resources/__init__.py +14 -0
- {runwayml-2.3.8 → runwayml-3.0.0}/src/runwayml/resources/image_to_video.py +6 -14
- runwayml-3.0.0/src/runwayml/resources/organization.py +141 -0
- {runwayml-2.3.8 → runwayml-3.0.0}/src/runwayml/types/__init__.py +1 -0
- {runwayml-2.3.8 → runwayml-3.0.0}/src/runwayml/types/image_to_video_create_params.py +4 -8
- runwayml-3.0.0/src/runwayml/types/organization_retrieve_response.py +85 -0
- {runwayml-2.3.8 → runwayml-3.0.0}/tests/api_resources/test_image_to_video.py +10 -12
- runwayml-3.0.0/tests/api_resources/test_organization.py +72 -0
- {runwayml-2.3.8 → runwayml-3.0.0}/tests/test_client.py +11 -11
- {runwayml-2.3.8 → runwayml-3.0.0}/tests/test_transform.py +12 -0
- runwayml-2.3.8/.release-please-manifest.json +0 -3
- {runwayml-2.3.8 → runwayml-3.0.0}/.gitignore +0 -0
- {runwayml-2.3.8 → runwayml-3.0.0}/CONTRIBUTING.md +0 -0
- {runwayml-2.3.8 → runwayml-3.0.0}/LICENSE +0 -0
- {runwayml-2.3.8 → runwayml-3.0.0}/SECURITY.md +0 -0
- {runwayml-2.3.8 → runwayml-3.0.0}/bin/check-release-environment +0 -0
- {runwayml-2.3.8 → runwayml-3.0.0}/bin/publish-pypi +0 -0
- {runwayml-2.3.8 → runwayml-3.0.0}/examples/.keep +0 -0
- {runwayml-2.3.8 → runwayml-3.0.0}/mypy.ini +0 -0
- {runwayml-2.3.8 → runwayml-3.0.0}/noxfile.py +0 -0
- {runwayml-2.3.8 → runwayml-3.0.0}/release-please-config.json +0 -0
- {runwayml-2.3.8 → runwayml-3.0.0}/requirements-dev.lock +0 -0
- {runwayml-2.3.8 → runwayml-3.0.0}/requirements.lock +0 -0
- {runwayml-2.3.8 → runwayml-3.0.0}/src/runwayml/__init__.py +0 -0
- {runwayml-2.3.8 → runwayml-3.0.0}/src/runwayml/_base_client.py +0 -0
- {runwayml-2.3.8 → runwayml-3.0.0}/src/runwayml/_compat.py +0 -0
- {runwayml-2.3.8 → runwayml-3.0.0}/src/runwayml/_constants.py +0 -0
- {runwayml-2.3.8 → runwayml-3.0.0}/src/runwayml/_exceptions.py +0 -0
- {runwayml-2.3.8 → runwayml-3.0.0}/src/runwayml/_files.py +0 -0
- {runwayml-2.3.8 → runwayml-3.0.0}/src/runwayml/_models.py +0 -0
- {runwayml-2.3.8 → runwayml-3.0.0}/src/runwayml/_qs.py +0 -0
- {runwayml-2.3.8 → runwayml-3.0.0}/src/runwayml/_resource.py +0 -0
- {runwayml-2.3.8 → runwayml-3.0.0}/src/runwayml/_response.py +0 -0
- {runwayml-2.3.8 → runwayml-3.0.0}/src/runwayml/_streaming.py +0 -0
- {runwayml-2.3.8 → runwayml-3.0.0}/src/runwayml/_types.py +0 -0
- {runwayml-2.3.8 → runwayml-3.0.0}/src/runwayml/_utils/__init__.py +0 -0
- {runwayml-2.3.8 → runwayml-3.0.0}/src/runwayml/_utils/_logs.py +0 -0
- {runwayml-2.3.8 → runwayml-3.0.0}/src/runwayml/_utils/_proxy.py +0 -0
- {runwayml-2.3.8 → runwayml-3.0.0}/src/runwayml/_utils/_reflection.py +0 -0
- {runwayml-2.3.8 → runwayml-3.0.0}/src/runwayml/_utils/_streams.py +0 -0
- {runwayml-2.3.8 → runwayml-3.0.0}/src/runwayml/_utils/_sync.py +0 -0
- {runwayml-2.3.8 → runwayml-3.0.0}/src/runwayml/_utils/_typing.py +0 -0
- {runwayml-2.3.8 → runwayml-3.0.0}/src/runwayml/_utils/_utils.py +0 -0
- {runwayml-2.3.8 → runwayml-3.0.0}/src/runwayml/lib/.keep +0 -0
- {runwayml-2.3.8 → runwayml-3.0.0}/src/runwayml/py.typed +0 -0
- {runwayml-2.3.8 → runwayml-3.0.0}/src/runwayml/resources/tasks.py +0 -0
- {runwayml-2.3.8 → runwayml-3.0.0}/src/runwayml/types/image_to_video_create_response.py +0 -0
- {runwayml-2.3.8 → runwayml-3.0.0}/src/runwayml/types/task_retrieve_response.py +0 -0
- {runwayml-2.3.8 → runwayml-3.0.0}/tests/__init__.py +0 -0
- {runwayml-2.3.8 → runwayml-3.0.0}/tests/api_resources/__init__.py +0 -0
- {runwayml-2.3.8 → runwayml-3.0.0}/tests/api_resources/test_tasks.py +0 -0
- {runwayml-2.3.8 → runwayml-3.0.0}/tests/conftest.py +0 -0
- {runwayml-2.3.8 → runwayml-3.0.0}/tests/sample_file.txt +0 -0
- {runwayml-2.3.8 → runwayml-3.0.0}/tests/test_deepcopy.py +0 -0
- {runwayml-2.3.8 → runwayml-3.0.0}/tests/test_extract_files.py +0 -0
- {runwayml-2.3.8 → runwayml-3.0.0}/tests/test_files.py +0 -0
- {runwayml-2.3.8 → runwayml-3.0.0}/tests/test_models.py +0 -0
- {runwayml-2.3.8 → runwayml-3.0.0}/tests/test_qs.py +0 -0
- {runwayml-2.3.8 → runwayml-3.0.0}/tests/test_required_args.py +0 -0
- {runwayml-2.3.8 → runwayml-3.0.0}/tests/test_response.py +0 -0
- {runwayml-2.3.8 → runwayml-3.0.0}/tests/test_streaming.py +0 -0
- {runwayml-2.3.8 → runwayml-3.0.0}/tests/test_utils/test_proxy.py +0 -0
- {runwayml-2.3.8 → runwayml-3.0.0}/tests/test_utils/test_typing.py +0 -0
- {runwayml-2.3.8 → runwayml-3.0.0}/tests/utils.py +0 -0
@@ -1,5 +1,19 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## 3.0.0 (2025-04-09)
|
4
|
+
|
5
|
+
Full Changelog: [v2.3.8...v3.0.0](https://github.com/runwayml/sdk-python/compare/v2.3.8...v3.0.0)
|
6
|
+
|
7
|
+
### Features
|
8
|
+
|
9
|
+
* **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))
|
10
|
+
|
11
|
+
|
12
|
+
### Chores
|
13
|
+
|
14
|
+
* **internal:** remove trailing character ([#132](https://github.com/runwayml/sdk-python/issues/132)) ([cd78e34](https://github.com/runwayml/sdk-python/commit/cd78e34930a48a8696947178ee92ae22b1210898))
|
15
|
+
* **internal:** slight transform perf improvement ([#134](https://github.com/runwayml/sdk-python/issues/134)) ([33e5a68](https://github.com/runwayml/sdk-python/commit/33e5a68198c39c04edcf055c08f43e7800f8fbc0))
|
16
|
+
|
3
17
|
## 2.3.8 (2025-03-27)
|
4
18
|
|
5
19
|
Full Changelog: [v2.3.7...v2.3.8](https://github.com/runwayml/sdk-python/compare/v2.3.7...v2.3.8)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.3
|
2
2
|
Name: runwayml
|
3
|
-
Version:
|
3
|
+
Version: 3.0.0
|
4
4
|
Summary: The official Python library for the runwayml API
|
5
5
|
Project-URL: Homepage, https://github.com/runwayml/sdk-python
|
6
6
|
Project-URL: Repository, https://github.com/runwayml/sdk-python
|
@@ -63,7 +63,7 @@ client = RunwayML(
|
|
63
63
|
)
|
64
64
|
|
65
65
|
image_to_video = client.image_to_video.create(
|
66
|
-
model="
|
66
|
+
model="gen4_turbo",
|
67
67
|
prompt_image="https://example.com/assets/bunny.jpg",
|
68
68
|
prompt_text="The bunny is eating a carrot",
|
69
69
|
)
|
@@ -91,7 +91,7 @@ client = AsyncRunwayML(
|
|
91
91
|
|
92
92
|
async def main() -> None:
|
93
93
|
image_to_video = await client.image_to_video.create(
|
94
|
-
model="
|
94
|
+
model="gen4_turbo",
|
95
95
|
prompt_image="https://example.com/assets/bunny.jpg",
|
96
96
|
prompt_text="The bunny is eating a carrot",
|
97
97
|
)
|
@@ -129,7 +129,7 @@ client = RunwayML()
|
|
129
129
|
|
130
130
|
try:
|
131
131
|
client.image_to_video.create(
|
132
|
-
model="
|
132
|
+
model="gen4_turbo",
|
133
133
|
prompt_image="https://example.com/assets/bunny.jpg",
|
134
134
|
prompt_text="The bunny is eating a carrot",
|
135
135
|
)
|
@@ -176,7 +176,7 @@ client = RunwayML(
|
|
176
176
|
|
177
177
|
# Or, configure per-request:
|
178
178
|
client.with_options(max_retries=5).image_to_video.create(
|
179
|
-
model="
|
179
|
+
model="gen4_turbo",
|
180
180
|
prompt_image="https://example.com/assets/bunny.jpg",
|
181
181
|
prompt_text="The bunny is eating a carrot",
|
182
182
|
)
|
@@ -203,7 +203,7 @@ client = RunwayML(
|
|
203
203
|
|
204
204
|
# Override per-request:
|
205
205
|
client.with_options(timeout=5.0).image_to_video.create(
|
206
|
-
model="
|
206
|
+
model="gen4_turbo",
|
207
207
|
prompt_image="https://example.com/assets/bunny.jpg",
|
208
208
|
prompt_text="The bunny is eating a carrot",
|
209
209
|
)
|
@@ -248,7 +248,7 @@ from runwayml import RunwayML
|
|
248
248
|
|
249
249
|
client = RunwayML()
|
250
250
|
response = client.image_to_video.with_raw_response.create(
|
251
|
-
model="
|
251
|
+
model="gen4_turbo",
|
252
252
|
prompt_image="https://example.com/assets/bunny.jpg",
|
253
253
|
prompt_text="The bunny is eating a carrot",
|
254
254
|
)
|
@@ -270,7 +270,7 @@ To stream the response body, use `.with_streaming_response` instead, which requi
|
|
270
270
|
|
271
271
|
```python
|
272
272
|
with client.image_to_video.with_streaming_response.create(
|
273
|
-
model="
|
273
|
+
model="gen4_turbo",
|
274
274
|
prompt_image="https://example.com/assets/bunny.jpg",
|
275
275
|
prompt_text="The bunny is eating a carrot",
|
276
276
|
) as response:
|
@@ -32,7 +32,7 @@ client = RunwayML(
|
|
32
32
|
)
|
33
33
|
|
34
34
|
image_to_video = client.image_to_video.create(
|
35
|
-
model="
|
35
|
+
model="gen4_turbo",
|
36
36
|
prompt_image="https://example.com/assets/bunny.jpg",
|
37
37
|
prompt_text="The bunny is eating a carrot",
|
38
38
|
)
|
@@ -60,7 +60,7 @@ client = AsyncRunwayML(
|
|
60
60
|
|
61
61
|
async def main() -> None:
|
62
62
|
image_to_video = await client.image_to_video.create(
|
63
|
-
model="
|
63
|
+
model="gen4_turbo",
|
64
64
|
prompt_image="https://example.com/assets/bunny.jpg",
|
65
65
|
prompt_text="The bunny is eating a carrot",
|
66
66
|
)
|
@@ -98,7 +98,7 @@ client = RunwayML()
|
|
98
98
|
|
99
99
|
try:
|
100
100
|
client.image_to_video.create(
|
101
|
-
model="
|
101
|
+
model="gen4_turbo",
|
102
102
|
prompt_image="https://example.com/assets/bunny.jpg",
|
103
103
|
prompt_text="The bunny is eating a carrot",
|
104
104
|
)
|
@@ -145,7 +145,7 @@ client = RunwayML(
|
|
145
145
|
|
146
146
|
# Or, configure per-request:
|
147
147
|
client.with_options(max_retries=5).image_to_video.create(
|
148
|
-
model="
|
148
|
+
model="gen4_turbo",
|
149
149
|
prompt_image="https://example.com/assets/bunny.jpg",
|
150
150
|
prompt_text="The bunny is eating a carrot",
|
151
151
|
)
|
@@ -172,7 +172,7 @@ client = RunwayML(
|
|
172
172
|
|
173
173
|
# Override per-request:
|
174
174
|
client.with_options(timeout=5.0).image_to_video.create(
|
175
|
-
model="
|
175
|
+
model="gen4_turbo",
|
176
176
|
prompt_image="https://example.com/assets/bunny.jpg",
|
177
177
|
prompt_text="The bunny is eating a carrot",
|
178
178
|
)
|
@@ -217,7 +217,7 @@ from runwayml import RunwayML
|
|
217
217
|
|
218
218
|
client = RunwayML()
|
219
219
|
response = client.image_to_video.with_raw_response.create(
|
220
|
-
model="
|
220
|
+
model="gen4_turbo",
|
221
221
|
prompt_image="https://example.com/assets/bunny.jpg",
|
222
222
|
prompt_text="The bunny is eating a carrot",
|
223
223
|
)
|
@@ -239,7 +239,7 @@ To stream the response body, use `.with_streaming_response` instead, which requi
|
|
239
239
|
|
240
240
|
```python
|
241
241
|
with client.image_to_video.with_streaming_response.create(
|
242
|
-
model="
|
242
|
+
model="gen4_turbo",
|
243
243
|
prompt_image="https://example.com/assets/bunny.jpg",
|
244
244
|
prompt_text="The bunny is eating a carrot",
|
245
245
|
) as response:
|
@@ -22,3 +22,15 @@ from runwayml.types import ImageToVideoCreateResponse
|
|
22
22
|
Methods:
|
23
23
|
|
24
24
|
- <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>
|
25
|
+
|
26
|
+
# Organization
|
27
|
+
|
28
|
+
Types:
|
29
|
+
|
30
|
+
```python
|
31
|
+
from runwayml.types import OrganizationRetrieveResponse
|
32
|
+
```
|
33
|
+
|
34
|
+
Methods:
|
35
|
+
|
36
|
+
- <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>
|
@@ -24,7 +24,7 @@ from ._utils import (
|
|
24
24
|
get_async_library,
|
25
25
|
)
|
26
26
|
from ._version import __version__
|
27
|
-
from .resources import tasks, image_to_video
|
27
|
+
from .resources import tasks, organization, image_to_video
|
28
28
|
from ._streaming import Stream as Stream, AsyncStream as AsyncStream
|
29
29
|
from ._exceptions import RunwayMLError, APIStatusError
|
30
30
|
from ._base_client import (
|
@@ -48,6 +48,7 @@ __all__ = [
|
|
48
48
|
class RunwayML(SyncAPIClient):
|
49
49
|
tasks: tasks.TasksResource
|
50
50
|
image_to_video: image_to_video.ImageToVideoResource
|
51
|
+
organization: organization.OrganizationResource
|
51
52
|
with_raw_response: RunwayMLWithRawResponse
|
52
53
|
with_streaming_response: RunwayMLWithStreamedResponse
|
53
54
|
|
@@ -113,6 +114,7 @@ class RunwayML(SyncAPIClient):
|
|
113
114
|
|
114
115
|
self.tasks = tasks.TasksResource(self)
|
115
116
|
self.image_to_video = image_to_video.ImageToVideoResource(self)
|
117
|
+
self.organization = organization.OrganizationResource(self)
|
116
118
|
self.with_raw_response = RunwayMLWithRawResponse(self)
|
117
119
|
self.with_streaming_response = RunwayMLWithStreamedResponse(self)
|
118
120
|
|
@@ -227,6 +229,7 @@ class RunwayML(SyncAPIClient):
|
|
227
229
|
class AsyncRunwayML(AsyncAPIClient):
|
228
230
|
tasks: tasks.AsyncTasksResource
|
229
231
|
image_to_video: image_to_video.AsyncImageToVideoResource
|
232
|
+
organization: organization.AsyncOrganizationResource
|
230
233
|
with_raw_response: AsyncRunwayMLWithRawResponse
|
231
234
|
with_streaming_response: AsyncRunwayMLWithStreamedResponse
|
232
235
|
|
@@ -292,6 +295,7 @@ class AsyncRunwayML(AsyncAPIClient):
|
|
292
295
|
|
293
296
|
self.tasks = tasks.AsyncTasksResource(self)
|
294
297
|
self.image_to_video = image_to_video.AsyncImageToVideoResource(self)
|
298
|
+
self.organization = organization.AsyncOrganizationResource(self)
|
295
299
|
self.with_raw_response = AsyncRunwayMLWithRawResponse(self)
|
296
300
|
self.with_streaming_response = AsyncRunwayMLWithStreamedResponse(self)
|
297
301
|
|
@@ -407,24 +411,28 @@ class RunwayMLWithRawResponse:
|
|
407
411
|
def __init__(self, client: RunwayML) -> None:
|
408
412
|
self.tasks = tasks.TasksResourceWithRawResponse(client.tasks)
|
409
413
|
self.image_to_video = image_to_video.ImageToVideoResourceWithRawResponse(client.image_to_video)
|
414
|
+
self.organization = organization.OrganizationResourceWithRawResponse(client.organization)
|
410
415
|
|
411
416
|
|
412
417
|
class AsyncRunwayMLWithRawResponse:
|
413
418
|
def __init__(self, client: AsyncRunwayML) -> None:
|
414
419
|
self.tasks = tasks.AsyncTasksResourceWithRawResponse(client.tasks)
|
415
420
|
self.image_to_video = image_to_video.AsyncImageToVideoResourceWithRawResponse(client.image_to_video)
|
421
|
+
self.organization = organization.AsyncOrganizationResourceWithRawResponse(client.organization)
|
416
422
|
|
417
423
|
|
418
424
|
class RunwayMLWithStreamedResponse:
|
419
425
|
def __init__(self, client: RunwayML) -> None:
|
420
426
|
self.tasks = tasks.TasksResourceWithStreamingResponse(client.tasks)
|
421
427
|
self.image_to_video = image_to_video.ImageToVideoResourceWithStreamingResponse(client.image_to_video)
|
428
|
+
self.organization = organization.OrganizationResourceWithStreamingResponse(client.organization)
|
422
429
|
|
423
430
|
|
424
431
|
class AsyncRunwayMLWithStreamedResponse:
|
425
432
|
def __init__(self, client: AsyncRunwayML) -> None:
|
426
433
|
self.tasks = tasks.AsyncTasksResourceWithStreamingResponse(client.tasks)
|
427
434
|
self.image_to_video = image_to_video.AsyncImageToVideoResourceWithStreamingResponse(client.image_to_video)
|
435
|
+
self.organization = organization.AsyncOrganizationResourceWithStreamingResponse(client.organization)
|
428
436
|
|
429
437
|
|
430
438
|
Client = RunwayML
|
@@ -142,6 +142,10 @@ def _maybe_transform_key(key: str, type_: type) -> str:
|
|
142
142
|
return key
|
143
143
|
|
144
144
|
|
145
|
+
def _no_transform_needed(annotation: type) -> bool:
|
146
|
+
return annotation == float or annotation == int
|
147
|
+
|
148
|
+
|
145
149
|
def _transform_recursive(
|
146
150
|
data: object,
|
147
151
|
*,
|
@@ -184,6 +188,15 @@ def _transform_recursive(
|
|
184
188
|
return cast(object, data)
|
185
189
|
|
186
190
|
inner_type = extract_type_arg(stripped_type, 0)
|
191
|
+
if _no_transform_needed(inner_type):
|
192
|
+
# for some types there is no need to transform anything, so we can get a small
|
193
|
+
# perf boost from skipping that work.
|
194
|
+
#
|
195
|
+
# but we still need to convert to a list to ensure the data is json-serializable
|
196
|
+
if is_list(data):
|
197
|
+
return data
|
198
|
+
return list(data)
|
199
|
+
|
187
200
|
return [_transform_recursive(d, annotation=annotation, inner_type=inner_type) for d in data]
|
188
201
|
|
189
202
|
if is_union_type(stripped_type):
|
@@ -332,6 +345,15 @@ async def _async_transform_recursive(
|
|
332
345
|
return cast(object, data)
|
333
346
|
|
334
347
|
inner_type = extract_type_arg(stripped_type, 0)
|
348
|
+
if _no_transform_needed(inner_type):
|
349
|
+
# for some types there is no need to transform anything, so we can get a small
|
350
|
+
# perf boost from skipping that work.
|
351
|
+
#
|
352
|
+
# but we still need to convert to a list to ensure the data is json-serializable
|
353
|
+
if is_list(data):
|
354
|
+
return data
|
355
|
+
return list(data)
|
356
|
+
|
335
357
|
return [await _async_transform_recursive(d, annotation=annotation, inner_type=inner_type) for d in data]
|
336
358
|
|
337
359
|
if is_union_type(stripped_type):
|
@@ -8,6 +8,14 @@ from .tasks import (
|
|
8
8
|
TasksResourceWithStreamingResponse,
|
9
9
|
AsyncTasksResourceWithStreamingResponse,
|
10
10
|
)
|
11
|
+
from .organization import (
|
12
|
+
OrganizationResource,
|
13
|
+
AsyncOrganizationResource,
|
14
|
+
OrganizationResourceWithRawResponse,
|
15
|
+
AsyncOrganizationResourceWithRawResponse,
|
16
|
+
OrganizationResourceWithStreamingResponse,
|
17
|
+
AsyncOrganizationResourceWithStreamingResponse,
|
18
|
+
)
|
11
19
|
from .image_to_video import (
|
12
20
|
ImageToVideoResource,
|
13
21
|
AsyncImageToVideoResource,
|
@@ -30,4 +38,10 @@ __all__ = [
|
|
30
38
|
"AsyncImageToVideoResourceWithRawResponse",
|
31
39
|
"ImageToVideoResourceWithStreamingResponse",
|
32
40
|
"AsyncImageToVideoResourceWithStreamingResponse",
|
41
|
+
"OrganizationResource",
|
42
|
+
"AsyncOrganizationResource",
|
43
|
+
"OrganizationResourceWithRawResponse",
|
44
|
+
"AsyncOrganizationResourceWithRawResponse",
|
45
|
+
"OrganizationResourceWithStreamingResponse",
|
46
|
+
"AsyncOrganizationResourceWithStreamingResponse",
|
33
47
|
]
|
@@ -50,13 +50,13 @@ class ImageToVideoResource(SyncAPIResource):
|
|
50
50
|
def create(
|
51
51
|
self,
|
52
52
|
*,
|
53
|
-
model: Literal["gen3a_turbo"],
|
53
|
+
model: Literal["gen4_turbo", "gen3a_turbo"],
|
54
54
|
prompt_image: Union[str, Iterable[image_to_video_create_params.PromptImagePromptImage]],
|
55
55
|
duration: Literal[5, 10] | NotGiven = NOT_GIVEN,
|
56
56
|
prompt_text: str | NotGiven = NOT_GIVEN,
|
57
|
-
ratio: Literal["1280:
|
57
|
+
ratio: Literal["1280:720", "720:1280", "1104:832", "832:1104", "960:960", "1584:672", "1280:768", "768:1280"]
|
58
|
+
| NotGiven = NOT_GIVEN,
|
58
59
|
seed: int | NotGiven = NOT_GIVEN,
|
59
|
-
watermark: bool | NotGiven = NOT_GIVEN,
|
60
60
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
61
61
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
62
62
|
extra_headers: Headers | None = None,
|
@@ -84,9 +84,6 @@ class ImageToVideoResource(SyncAPIResource):
|
|
84
84
|
get different results for the same other request parameters. Using the same seed
|
85
85
|
integer for an identical request will produce similar results.
|
86
86
|
|
87
|
-
watermark: A boolean indicating whether or not the output video will contain a Runway
|
88
|
-
watermark.
|
89
|
-
|
90
87
|
extra_headers: Send extra headers
|
91
88
|
|
92
89
|
extra_query: Add additional query parameters to the request
|
@@ -105,7 +102,6 @@ class ImageToVideoResource(SyncAPIResource):
|
|
105
102
|
"prompt_text": prompt_text,
|
106
103
|
"ratio": ratio,
|
107
104
|
"seed": seed,
|
108
|
-
"watermark": watermark,
|
109
105
|
},
|
110
106
|
image_to_video_create_params.ImageToVideoCreateParams,
|
111
107
|
),
|
@@ -139,13 +135,13 @@ class AsyncImageToVideoResource(AsyncAPIResource):
|
|
139
135
|
async def create(
|
140
136
|
self,
|
141
137
|
*,
|
142
|
-
model: Literal["gen3a_turbo"],
|
138
|
+
model: Literal["gen4_turbo", "gen3a_turbo"],
|
143
139
|
prompt_image: Union[str, Iterable[image_to_video_create_params.PromptImagePromptImage]],
|
144
140
|
duration: Literal[5, 10] | NotGiven = NOT_GIVEN,
|
145
141
|
prompt_text: str | NotGiven = NOT_GIVEN,
|
146
|
-
ratio: Literal["1280:
|
142
|
+
ratio: Literal["1280:720", "720:1280", "1104:832", "832:1104", "960:960", "1584:672", "1280:768", "768:1280"]
|
143
|
+
| NotGiven = NOT_GIVEN,
|
147
144
|
seed: int | NotGiven = NOT_GIVEN,
|
148
|
-
watermark: bool | NotGiven = NOT_GIVEN,
|
149
145
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
150
146
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
151
147
|
extra_headers: Headers | None = None,
|
@@ -173,9 +169,6 @@ class AsyncImageToVideoResource(AsyncAPIResource):
|
|
173
169
|
get different results for the same other request parameters. Using the same seed
|
174
170
|
integer for an identical request will produce similar results.
|
175
171
|
|
176
|
-
watermark: A boolean indicating whether or not the output video will contain a Runway
|
177
|
-
watermark.
|
178
|
-
|
179
172
|
extra_headers: Send extra headers
|
180
173
|
|
181
174
|
extra_query: Add additional query parameters to the request
|
@@ -194,7 +187,6 @@ class AsyncImageToVideoResource(AsyncAPIResource):
|
|
194
187
|
"prompt_text": prompt_text,
|
195
188
|
"ratio": ratio,
|
196
189
|
"seed": seed,
|
197
|
-
"watermark": watermark,
|
198
190
|
},
|
199
191
|
image_to_video_create_params.ImageToVideoCreateParams,
|
200
192
|
),
|
@@ -0,0 +1,141 @@
|
|
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, 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.organization_retrieve_response import OrganizationRetrieveResponse
|
18
|
+
|
19
|
+
__all__ = ["OrganizationResource", "AsyncOrganizationResource"]
|
20
|
+
|
21
|
+
|
22
|
+
class OrganizationResource(SyncAPIResource):
|
23
|
+
@cached_property
|
24
|
+
def with_raw_response(self) -> OrganizationResourceWithRawResponse:
|
25
|
+
"""
|
26
|
+
This property can be used as a prefix for any HTTP method call to return
|
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 OrganizationResourceWithRawResponse(self)
|
32
|
+
|
33
|
+
@cached_property
|
34
|
+
def with_streaming_response(self) -> OrganizationResourceWithStreamingResponse:
|
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 OrganizationResourceWithStreamingResponse(self)
|
41
|
+
|
42
|
+
def retrieve(
|
43
|
+
self,
|
44
|
+
*,
|
45
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
46
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
47
|
+
extra_headers: Headers | None = None,
|
48
|
+
extra_query: Query | None = None,
|
49
|
+
extra_body: Body | None = None,
|
50
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
51
|
+
) -> OrganizationRetrieveResponse:
|
52
|
+
"""
|
53
|
+
Get usage tier and credit balance information about the organization associated
|
54
|
+
with the API key used to make the request.
|
55
|
+
"""
|
56
|
+
return self._get(
|
57
|
+
"/v1/organization",
|
58
|
+
options=make_request_options(
|
59
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
60
|
+
),
|
61
|
+
cast_to=OrganizationRetrieveResponse,
|
62
|
+
)
|
63
|
+
|
64
|
+
|
65
|
+
class AsyncOrganizationResource(AsyncAPIResource):
|
66
|
+
@cached_property
|
67
|
+
def with_raw_response(self) -> AsyncOrganizationResourceWithRawResponse:
|
68
|
+
"""
|
69
|
+
This property can be used as a prefix for any HTTP method call to return
|
70
|
+
the raw response object instead of the parsed content.
|
71
|
+
|
72
|
+
For more information, see https://www.github.com/runwayml/sdk-python#accessing-raw-response-data-eg-headers
|
73
|
+
"""
|
74
|
+
return AsyncOrganizationResourceWithRawResponse(self)
|
75
|
+
|
76
|
+
@cached_property
|
77
|
+
def with_streaming_response(self) -> AsyncOrganizationResourceWithStreamingResponse:
|
78
|
+
"""
|
79
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
80
|
+
|
81
|
+
For more information, see https://www.github.com/runwayml/sdk-python#with_streaming_response
|
82
|
+
"""
|
83
|
+
return AsyncOrganizationResourceWithStreamingResponse(self)
|
84
|
+
|
85
|
+
async def retrieve(
|
86
|
+
self,
|
87
|
+
*,
|
88
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
89
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
90
|
+
extra_headers: Headers | None = None,
|
91
|
+
extra_query: Query | None = None,
|
92
|
+
extra_body: Body | None = None,
|
93
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
94
|
+
) -> OrganizationRetrieveResponse:
|
95
|
+
"""
|
96
|
+
Get usage tier and credit balance information about the organization associated
|
97
|
+
with the API key used to make the request.
|
98
|
+
"""
|
99
|
+
return await self._get(
|
100
|
+
"/v1/organization",
|
101
|
+
options=make_request_options(
|
102
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
103
|
+
),
|
104
|
+
cast_to=OrganizationRetrieveResponse,
|
105
|
+
)
|
106
|
+
|
107
|
+
|
108
|
+
class OrganizationResourceWithRawResponse:
|
109
|
+
def __init__(self, organization: OrganizationResource) -> None:
|
110
|
+
self._organization = organization
|
111
|
+
|
112
|
+
self.retrieve = to_raw_response_wrapper(
|
113
|
+
organization.retrieve,
|
114
|
+
)
|
115
|
+
|
116
|
+
|
117
|
+
class AsyncOrganizationResourceWithRawResponse:
|
118
|
+
def __init__(self, organization: AsyncOrganizationResource) -> None:
|
119
|
+
self._organization = organization
|
120
|
+
|
121
|
+
self.retrieve = async_to_raw_response_wrapper(
|
122
|
+
organization.retrieve,
|
123
|
+
)
|
124
|
+
|
125
|
+
|
126
|
+
class OrganizationResourceWithStreamingResponse:
|
127
|
+
def __init__(self, organization: OrganizationResource) -> None:
|
128
|
+
self._organization = organization
|
129
|
+
|
130
|
+
self.retrieve = to_streamed_response_wrapper(
|
131
|
+
organization.retrieve,
|
132
|
+
)
|
133
|
+
|
134
|
+
|
135
|
+
class AsyncOrganizationResourceWithStreamingResponse:
|
136
|
+
def __init__(self, organization: AsyncOrganizationResource) -> None:
|
137
|
+
self._organization = organization
|
138
|
+
|
139
|
+
self.retrieve = async_to_streamed_response_wrapper(
|
140
|
+
organization.retrieve,
|
141
|
+
)
|
@@ -5,3 +5,4 @@ from __future__ import annotations
|
|
5
5
|
from .task_retrieve_response import TaskRetrieveResponse as TaskRetrieveResponse
|
6
6
|
from .image_to_video_create_params import ImageToVideoCreateParams as ImageToVideoCreateParams
|
7
7
|
from .image_to_video_create_response import ImageToVideoCreateResponse as ImageToVideoCreateResponse
|
8
|
+
from .organization_retrieve_response import OrganizationRetrieveResponse as OrganizationRetrieveResponse
|
@@ -11,7 +11,7 @@ __all__ = ["ImageToVideoCreateParams", "PromptImagePromptImage"]
|
|
11
11
|
|
12
12
|
|
13
13
|
class ImageToVideoCreateParams(TypedDict, total=False):
|
14
|
-
model: Required[Literal["gen3a_turbo"]]
|
14
|
+
model: Required[Literal["gen4_turbo", "gen3a_turbo"]]
|
15
15
|
"""The model variant to use."""
|
16
16
|
|
17
17
|
prompt_image: Required[Annotated[Union[str, Iterable[PromptImagePromptImage]], PropertyInfo(alias="promptImage")]]
|
@@ -26,7 +26,7 @@ class ImageToVideoCreateParams(TypedDict, total=False):
|
|
26
26
|
|
27
27
|
prompt_text: Annotated[str, PropertyInfo(alias="promptText")]
|
28
28
|
|
29
|
-
ratio: Literal["1280:768", "768:1280"]
|
29
|
+
ratio: Literal["1280:720", "720:1280", "1104:832", "832:1104", "960:960", "1584:672", "1280:768", "768:1280"]
|
30
30
|
|
31
31
|
seed: int
|
32
32
|
"""If unspecified, a random number is chosen.
|
@@ -36,12 +36,6 @@ class ImageToVideoCreateParams(TypedDict, total=False):
|
|
36
36
|
produce similar results.
|
37
37
|
"""
|
38
38
|
|
39
|
-
watermark: bool
|
40
|
-
"""
|
41
|
-
A boolean indicating whether or not the output video will contain a Runway
|
42
|
-
watermark.
|
43
|
-
"""
|
44
|
-
|
45
39
|
|
46
40
|
class PromptImagePromptImage(TypedDict, total=False):
|
47
41
|
position: Required[Literal["first", "last"]]
|
@@ -49,6 +43,8 @@ class PromptImagePromptImage(TypedDict, total=False):
|
|
49
43
|
|
50
44
|
"first" will use the image as the first frame of the video, "last" will use the
|
51
45
|
image as the last frame of the video.
|
46
|
+
|
47
|
+
"last" is currently supported for `gen3a_turbo` only.
|
52
48
|
"""
|
53
49
|
|
54
50
|
uri: Required[str]
|
@@ -0,0 +1,85 @@
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
2
|
+
|
3
|
+
from typing import Optional
|
4
|
+
|
5
|
+
from pydantic import Field as FieldInfo
|
6
|
+
|
7
|
+
from .._models import BaseModel
|
8
|
+
|
9
|
+
__all__ = [
|
10
|
+
"OrganizationRetrieveResponse",
|
11
|
+
"Tier",
|
12
|
+
"TierModels",
|
13
|
+
"TierModelsGen3aTurbo",
|
14
|
+
"TierModelsGen4Turbo",
|
15
|
+
"Usage",
|
16
|
+
"UsageModels",
|
17
|
+
"UsageModelsGen3aTurbo",
|
18
|
+
"UsageModelsGen4Turbo",
|
19
|
+
]
|
20
|
+
|
21
|
+
|
22
|
+
class TierModelsGen3aTurbo(BaseModel):
|
23
|
+
max_concurrent_generations: int = FieldInfo(alias="maxConcurrentGenerations")
|
24
|
+
"""The maximum number of generations that can be run concurrently for this model."""
|
25
|
+
|
26
|
+
max_daily_generations: int = FieldInfo(alias="maxDailyGenerations")
|
27
|
+
"""The maximum number of generations that can be created each day for this model."""
|
28
|
+
|
29
|
+
|
30
|
+
class TierModelsGen4Turbo(BaseModel):
|
31
|
+
max_concurrent_generations: int = FieldInfo(alias="maxConcurrentGenerations")
|
32
|
+
"""The maximum number of generations that can be run concurrently for this model."""
|
33
|
+
|
34
|
+
max_daily_generations: int = FieldInfo(alias="maxDailyGenerations")
|
35
|
+
"""The maximum number of generations that can be created each day for this model."""
|
36
|
+
|
37
|
+
|
38
|
+
class TierModels(BaseModel):
|
39
|
+
gen3a_turbo: Optional[TierModelsGen3aTurbo] = None
|
40
|
+
"""Limits associated with the gen3a_turbo model."""
|
41
|
+
|
42
|
+
gen4_turbo: Optional[TierModelsGen4Turbo] = None
|
43
|
+
"""Limits associated with the gen4_turbo model."""
|
44
|
+
|
45
|
+
|
46
|
+
class Tier(BaseModel):
|
47
|
+
max_monthly_credit_spend: int = FieldInfo(alias="maxMonthlyCreditSpend")
|
48
|
+
"""The maximum number of credits that can be purchased in a month."""
|
49
|
+
|
50
|
+
models: TierModels
|
51
|
+
"""An object containing model-specific limits. Each key represents a model."""
|
52
|
+
|
53
|
+
|
54
|
+
class UsageModelsGen3aTurbo(BaseModel):
|
55
|
+
daily_generations: int = FieldInfo(alias="dailyGenerations")
|
56
|
+
"""The number of generations that have been run for this model in the past day."""
|
57
|
+
|
58
|
+
|
59
|
+
class UsageModelsGen4Turbo(BaseModel):
|
60
|
+
daily_generations: int = FieldInfo(alias="dailyGenerations")
|
61
|
+
"""The number of generations that have been run for this model in the past day."""
|
62
|
+
|
63
|
+
|
64
|
+
class UsageModels(BaseModel):
|
65
|
+
gen3a_turbo: Optional[UsageModelsGen3aTurbo] = None
|
66
|
+
"""Usage data for the gen3a_turbo model."""
|
67
|
+
|
68
|
+
gen4_turbo: Optional[UsageModelsGen4Turbo] = None
|
69
|
+
"""Usage data for the gen4_turbo model."""
|
70
|
+
|
71
|
+
|
72
|
+
class Usage(BaseModel):
|
73
|
+
models: UsageModels
|
74
|
+
"""Usage data for each model."""
|
75
|
+
|
76
|
+
|
77
|
+
class OrganizationRetrieveResponse(BaseModel):
|
78
|
+
credit_balance: int = FieldInfo(alias="creditBalance")
|
79
|
+
"""The number of credits remaining in the organization account."""
|
80
|
+
|
81
|
+
tier: Tier
|
82
|
+
"""Limits associated with the organization's tier."""
|
83
|
+
|
84
|
+
usage: Usage
|
85
|
+
"""Usage data for the organization."""
|
@@ -20,7 +20,7 @@ class TestImageToVideo:
|
|
20
20
|
@parametrize
|
21
21
|
def test_method_create(self, client: RunwayML) -> None:
|
22
22
|
image_to_video = client.image_to_video.create(
|
23
|
-
model="
|
23
|
+
model="gen4_turbo",
|
24
24
|
prompt_image="https://example.com",
|
25
25
|
)
|
26
26
|
assert_matches_type(ImageToVideoCreateResponse, image_to_video, path=["response"])
|
@@ -28,20 +28,19 @@ class TestImageToVideo:
|
|
28
28
|
@parametrize
|
29
29
|
def test_method_create_with_all_params(self, client: RunwayML) -> None:
|
30
30
|
image_to_video = client.image_to_video.create(
|
31
|
-
model="
|
31
|
+
model="gen4_turbo",
|
32
32
|
prompt_image="https://example.com",
|
33
33
|
duration=5,
|
34
34
|
prompt_text="promptText",
|
35
|
-
ratio="1280:
|
35
|
+
ratio="1280:720",
|
36
36
|
seed=0,
|
37
|
-
watermark=True,
|
38
37
|
)
|
39
38
|
assert_matches_type(ImageToVideoCreateResponse, image_to_video, path=["response"])
|
40
39
|
|
41
40
|
@parametrize
|
42
41
|
def test_raw_response_create(self, client: RunwayML) -> None:
|
43
42
|
response = client.image_to_video.with_raw_response.create(
|
44
|
-
model="
|
43
|
+
model="gen4_turbo",
|
45
44
|
prompt_image="https://example.com",
|
46
45
|
)
|
47
46
|
|
@@ -53,7 +52,7 @@ class TestImageToVideo:
|
|
53
52
|
@parametrize
|
54
53
|
def test_streaming_response_create(self, client: RunwayML) -> None:
|
55
54
|
with client.image_to_video.with_streaming_response.create(
|
56
|
-
model="
|
55
|
+
model="gen4_turbo",
|
57
56
|
prompt_image="https://example.com",
|
58
57
|
) as response:
|
59
58
|
assert not response.is_closed
|
@@ -71,7 +70,7 @@ class TestAsyncImageToVideo:
|
|
71
70
|
@parametrize
|
72
71
|
async def test_method_create(self, async_client: AsyncRunwayML) -> None:
|
73
72
|
image_to_video = await async_client.image_to_video.create(
|
74
|
-
model="
|
73
|
+
model="gen4_turbo",
|
75
74
|
prompt_image="https://example.com",
|
76
75
|
)
|
77
76
|
assert_matches_type(ImageToVideoCreateResponse, image_to_video, path=["response"])
|
@@ -79,20 +78,19 @@ class TestAsyncImageToVideo:
|
|
79
78
|
@parametrize
|
80
79
|
async def test_method_create_with_all_params(self, async_client: AsyncRunwayML) -> None:
|
81
80
|
image_to_video = await async_client.image_to_video.create(
|
82
|
-
model="
|
81
|
+
model="gen4_turbo",
|
83
82
|
prompt_image="https://example.com",
|
84
83
|
duration=5,
|
85
84
|
prompt_text="promptText",
|
86
|
-
ratio="1280:
|
85
|
+
ratio="1280:720",
|
87
86
|
seed=0,
|
88
|
-
watermark=True,
|
89
87
|
)
|
90
88
|
assert_matches_type(ImageToVideoCreateResponse, image_to_video, path=["response"])
|
91
89
|
|
92
90
|
@parametrize
|
93
91
|
async def test_raw_response_create(self, async_client: AsyncRunwayML) -> None:
|
94
92
|
response = await async_client.image_to_video.with_raw_response.create(
|
95
|
-
model="
|
93
|
+
model="gen4_turbo",
|
96
94
|
prompt_image="https://example.com",
|
97
95
|
)
|
98
96
|
|
@@ -104,7 +102,7 @@ class TestAsyncImageToVideo:
|
|
104
102
|
@parametrize
|
105
103
|
async def test_streaming_response_create(self, async_client: AsyncRunwayML) -> None:
|
106
104
|
async with async_client.image_to_video.with_streaming_response.create(
|
107
|
-
model="
|
105
|
+
model="gen4_turbo",
|
108
106
|
prompt_image="https://example.com",
|
109
107
|
) as response:
|
110
108
|
assert not response.is_closed
|
@@ -0,0 +1,72 @@
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
2
|
+
|
3
|
+
from __future__ import annotations
|
4
|
+
|
5
|
+
import os
|
6
|
+
from typing import Any, cast
|
7
|
+
|
8
|
+
import pytest
|
9
|
+
|
10
|
+
from runwayml import RunwayML, AsyncRunwayML
|
11
|
+
from tests.utils import assert_matches_type
|
12
|
+
from runwayml.types import OrganizationRetrieveResponse
|
13
|
+
|
14
|
+
base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
|
15
|
+
|
16
|
+
|
17
|
+
class TestOrganization:
|
18
|
+
parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"])
|
19
|
+
|
20
|
+
@parametrize
|
21
|
+
def test_method_retrieve(self, client: RunwayML) -> None:
|
22
|
+
organization = client.organization.retrieve()
|
23
|
+
assert_matches_type(OrganizationRetrieveResponse, organization, path=["response"])
|
24
|
+
|
25
|
+
@parametrize
|
26
|
+
def test_raw_response_retrieve(self, client: RunwayML) -> None:
|
27
|
+
response = client.organization.with_raw_response.retrieve()
|
28
|
+
|
29
|
+
assert response.is_closed is True
|
30
|
+
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
31
|
+
organization = response.parse()
|
32
|
+
assert_matches_type(OrganizationRetrieveResponse, organization, path=["response"])
|
33
|
+
|
34
|
+
@parametrize
|
35
|
+
def test_streaming_response_retrieve(self, client: RunwayML) -> None:
|
36
|
+
with client.organization.with_streaming_response.retrieve() as response:
|
37
|
+
assert not response.is_closed
|
38
|
+
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
39
|
+
|
40
|
+
organization = response.parse()
|
41
|
+
assert_matches_type(OrganizationRetrieveResponse, organization, path=["response"])
|
42
|
+
|
43
|
+
assert cast(Any, response.is_closed) is True
|
44
|
+
|
45
|
+
|
46
|
+
class TestAsyncOrganization:
|
47
|
+
parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"])
|
48
|
+
|
49
|
+
@parametrize
|
50
|
+
async def test_method_retrieve(self, async_client: AsyncRunwayML) -> None:
|
51
|
+
organization = await async_client.organization.retrieve()
|
52
|
+
assert_matches_type(OrganizationRetrieveResponse, organization, path=["response"])
|
53
|
+
|
54
|
+
@parametrize
|
55
|
+
async def test_raw_response_retrieve(self, async_client: AsyncRunwayML) -> None:
|
56
|
+
response = await async_client.organization.with_raw_response.retrieve()
|
57
|
+
|
58
|
+
assert response.is_closed is True
|
59
|
+
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
60
|
+
organization = await response.parse()
|
61
|
+
assert_matches_type(OrganizationRetrieveResponse, organization, path=["response"])
|
62
|
+
|
63
|
+
@parametrize
|
64
|
+
async def test_streaming_response_retrieve(self, async_client: AsyncRunwayML) -> None:
|
65
|
+
async with async_client.organization.with_streaming_response.retrieve() as response:
|
66
|
+
assert not response.is_closed
|
67
|
+
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
68
|
+
|
69
|
+
organization = await response.parse()
|
70
|
+
assert_matches_type(OrganizationRetrieveResponse, organization, path=["response"])
|
71
|
+
|
72
|
+
assert cast(Any, response.is_closed) is True
|
@@ -723,7 +723,7 @@ class TestRunwayML:
|
|
723
723
|
object,
|
724
724
|
maybe_transform(
|
725
725
|
dict(
|
726
|
-
model="
|
726
|
+
model="gen4_turbo",
|
727
727
|
prompt_image="https://example.com/assets/bunny.jpg",
|
728
728
|
prompt_text="The bunny is eating a carrot",
|
729
729
|
),
|
@@ -748,7 +748,7 @@ class TestRunwayML:
|
|
748
748
|
object,
|
749
749
|
maybe_transform(
|
750
750
|
dict(
|
751
|
-
model="
|
751
|
+
model="gen4_turbo",
|
752
752
|
prompt_image="https://example.com/assets/bunny.jpg",
|
753
753
|
prompt_text="The bunny is eating a carrot",
|
754
754
|
),
|
@@ -788,7 +788,7 @@ class TestRunwayML:
|
|
788
788
|
respx_mock.post("/v1/image_to_video").mock(side_effect=retry_handler)
|
789
789
|
|
790
790
|
response = client.image_to_video.with_raw_response.create(
|
791
|
-
model="
|
791
|
+
model="gen4_turbo", prompt_image="https://example.com"
|
792
792
|
)
|
793
793
|
|
794
794
|
assert response.retries_taken == failures_before_success
|
@@ -814,7 +814,7 @@ class TestRunwayML:
|
|
814
814
|
respx_mock.post("/v1/image_to_video").mock(side_effect=retry_handler)
|
815
815
|
|
816
816
|
response = client.image_to_video.with_raw_response.create(
|
817
|
-
model="
|
817
|
+
model="gen4_turbo", prompt_image="https://example.com", extra_headers={"x-stainless-retry-count": Omit()}
|
818
818
|
)
|
819
819
|
|
820
820
|
assert len(response.http_request.headers.get_list("x-stainless-retry-count")) == 0
|
@@ -839,7 +839,7 @@ class TestRunwayML:
|
|
839
839
|
respx_mock.post("/v1/image_to_video").mock(side_effect=retry_handler)
|
840
840
|
|
841
841
|
response = client.image_to_video.with_raw_response.create(
|
842
|
-
model="
|
842
|
+
model="gen4_turbo", prompt_image="https://example.com", extra_headers={"x-stainless-retry-count": "42"}
|
843
843
|
)
|
844
844
|
|
845
845
|
assert response.http_request.headers.get("x-stainless-retry-count") == "42"
|
@@ -1525,7 +1525,7 @@ class TestAsyncRunwayML:
|
|
1525
1525
|
object,
|
1526
1526
|
maybe_transform(
|
1527
1527
|
dict(
|
1528
|
-
model="
|
1528
|
+
model="gen4_turbo",
|
1529
1529
|
prompt_image="https://example.com/assets/bunny.jpg",
|
1530
1530
|
prompt_text="The bunny is eating a carrot",
|
1531
1531
|
),
|
@@ -1550,7 +1550,7 @@ class TestAsyncRunwayML:
|
|
1550
1550
|
object,
|
1551
1551
|
maybe_transform(
|
1552
1552
|
dict(
|
1553
|
-
model="
|
1553
|
+
model="gen4_turbo",
|
1554
1554
|
prompt_image="https://example.com/assets/bunny.jpg",
|
1555
1555
|
prompt_text="The bunny is eating a carrot",
|
1556
1556
|
),
|
@@ -1591,7 +1591,7 @@ class TestAsyncRunwayML:
|
|
1591
1591
|
respx_mock.post("/v1/image_to_video").mock(side_effect=retry_handler)
|
1592
1592
|
|
1593
1593
|
response = await client.image_to_video.with_raw_response.create(
|
1594
|
-
model="
|
1594
|
+
model="gen4_turbo", prompt_image="https://example.com"
|
1595
1595
|
)
|
1596
1596
|
|
1597
1597
|
assert response.retries_taken == failures_before_success
|
@@ -1618,7 +1618,7 @@ class TestAsyncRunwayML:
|
|
1618
1618
|
respx_mock.post("/v1/image_to_video").mock(side_effect=retry_handler)
|
1619
1619
|
|
1620
1620
|
response = await client.image_to_video.with_raw_response.create(
|
1621
|
-
model="
|
1621
|
+
model="gen4_turbo", prompt_image="https://example.com", extra_headers={"x-stainless-retry-count": Omit()}
|
1622
1622
|
)
|
1623
1623
|
|
1624
1624
|
assert len(response.http_request.headers.get_list("x-stainless-retry-count")) == 0
|
@@ -1644,7 +1644,7 @@ class TestAsyncRunwayML:
|
|
1644
1644
|
respx_mock.post("/v1/image_to_video").mock(side_effect=retry_handler)
|
1645
1645
|
|
1646
1646
|
response = await client.image_to_video.with_raw_response.create(
|
1647
|
-
model="
|
1647
|
+
model="gen4_turbo", prompt_image="https://example.com", extra_headers={"x-stainless-retry-count": "42"}
|
1648
1648
|
)
|
1649
1649
|
|
1650
1650
|
assert response.http_request.headers.get("x-stainless-retry-count") == "42"
|
@@ -1661,7 +1661,7 @@ class TestAsyncRunwayML:
|
|
1661
1661
|
import threading
|
1662
1662
|
|
1663
1663
|
from runwayml._utils import asyncify
|
1664
|
-
from runwayml._base_client import get_platform
|
1664
|
+
from runwayml._base_client import get_platform
|
1665
1665
|
|
1666
1666
|
async def test_main() -> None:
|
1667
1667
|
result = await asyncify(get_platform)()
|
@@ -432,3 +432,15 @@ async def test_base64_file_input(use_async: bool) -> None:
|
|
432
432
|
assert await transform({"foo": io.BytesIO(b"Hello, world!")}, TypedDictBase64Input, use_async) == {
|
433
433
|
"foo": "SGVsbG8sIHdvcmxkIQ=="
|
434
434
|
} # type: ignore[comparison-overlap]
|
435
|
+
|
436
|
+
|
437
|
+
@parametrize
|
438
|
+
@pytest.mark.asyncio
|
439
|
+
async def test_transform_skipping(use_async: bool) -> None:
|
440
|
+
# lists of ints are left as-is
|
441
|
+
data = [1, 2, 3]
|
442
|
+
assert await transform(data, List[int], use_async) is data
|
443
|
+
|
444
|
+
# iterables of ints are converted to a list
|
445
|
+
data = iter([1, 2, 3])
|
446
|
+
assert await transform(data, Iterable[int], use_async) == [1, 2, 3]
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|