runwayml 2.3.8__tar.gz → 3.0.1__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.
Files changed (73) hide show
  1. runwayml-3.0.1/.release-please-manifest.json +3 -0
  2. {runwayml-2.3.8 → runwayml-3.0.1}/CHANGELOG.md +31 -0
  3. {runwayml-2.3.8 → runwayml-3.0.1}/PKG-INFO +8 -8
  4. {runwayml-2.3.8 → runwayml-3.0.1}/README.md +7 -7
  5. {runwayml-2.3.8 → runwayml-3.0.1}/api.md +12 -0
  6. {runwayml-2.3.8 → runwayml-3.0.1}/pyproject.toml +2 -1
  7. {runwayml-2.3.8 → runwayml-3.0.1}/src/runwayml/_base_client.py +10 -1
  8. {runwayml-2.3.8 → runwayml-3.0.1}/src/runwayml/_client.py +9 -1
  9. {runwayml-2.3.8 → runwayml-3.0.1}/src/runwayml/_utils/_transform.py +46 -1
  10. {runwayml-2.3.8 → runwayml-3.0.1}/src/runwayml/_utils/_typing.py +2 -0
  11. {runwayml-2.3.8 → runwayml-3.0.1}/src/runwayml/_version.py +1 -1
  12. {runwayml-2.3.8 → runwayml-3.0.1}/src/runwayml/resources/__init__.py +14 -0
  13. {runwayml-2.3.8 → runwayml-3.0.1}/src/runwayml/resources/image_to_video.py +6 -14
  14. runwayml-3.0.1/src/runwayml/resources/organization.py +141 -0
  15. {runwayml-2.3.8 → runwayml-3.0.1}/src/runwayml/types/__init__.py +1 -0
  16. {runwayml-2.3.8 → runwayml-3.0.1}/src/runwayml/types/image_to_video_create_params.py +4 -8
  17. runwayml-3.0.1/src/runwayml/types/organization_retrieve_response.py +85 -0
  18. {runwayml-2.3.8 → runwayml-3.0.1}/tests/api_resources/test_image_to_video.py +10 -12
  19. runwayml-3.0.1/tests/api_resources/test_organization.py +72 -0
  20. {runwayml-2.3.8 → runwayml-3.0.1}/tests/test_client.py +11 -11
  21. {runwayml-2.3.8 → runwayml-3.0.1}/tests/test_transform.py +20 -1
  22. runwayml-2.3.8/.release-please-manifest.json +0 -3
  23. {runwayml-2.3.8 → runwayml-3.0.1}/.gitignore +0 -0
  24. {runwayml-2.3.8 → runwayml-3.0.1}/CONTRIBUTING.md +0 -0
  25. {runwayml-2.3.8 → runwayml-3.0.1}/LICENSE +0 -0
  26. {runwayml-2.3.8 → runwayml-3.0.1}/SECURITY.md +0 -0
  27. {runwayml-2.3.8 → runwayml-3.0.1}/bin/check-release-environment +0 -0
  28. {runwayml-2.3.8 → runwayml-3.0.1}/bin/publish-pypi +0 -0
  29. {runwayml-2.3.8 → runwayml-3.0.1}/examples/.keep +0 -0
  30. {runwayml-2.3.8 → runwayml-3.0.1}/mypy.ini +0 -0
  31. {runwayml-2.3.8 → runwayml-3.0.1}/noxfile.py +0 -0
  32. {runwayml-2.3.8 → runwayml-3.0.1}/release-please-config.json +0 -0
  33. {runwayml-2.3.8 → runwayml-3.0.1}/requirements-dev.lock +0 -0
  34. {runwayml-2.3.8 → runwayml-3.0.1}/requirements.lock +0 -0
  35. {runwayml-2.3.8 → runwayml-3.0.1}/src/runwayml/__init__.py +0 -0
  36. {runwayml-2.3.8 → runwayml-3.0.1}/src/runwayml/_compat.py +0 -0
  37. {runwayml-2.3.8 → runwayml-3.0.1}/src/runwayml/_constants.py +0 -0
  38. {runwayml-2.3.8 → runwayml-3.0.1}/src/runwayml/_exceptions.py +0 -0
  39. {runwayml-2.3.8 → runwayml-3.0.1}/src/runwayml/_files.py +0 -0
  40. {runwayml-2.3.8 → runwayml-3.0.1}/src/runwayml/_models.py +0 -0
  41. {runwayml-2.3.8 → runwayml-3.0.1}/src/runwayml/_qs.py +0 -0
  42. {runwayml-2.3.8 → runwayml-3.0.1}/src/runwayml/_resource.py +0 -0
  43. {runwayml-2.3.8 → runwayml-3.0.1}/src/runwayml/_response.py +0 -0
  44. {runwayml-2.3.8 → runwayml-3.0.1}/src/runwayml/_streaming.py +0 -0
  45. {runwayml-2.3.8 → runwayml-3.0.1}/src/runwayml/_types.py +0 -0
  46. {runwayml-2.3.8 → runwayml-3.0.1}/src/runwayml/_utils/__init__.py +0 -0
  47. {runwayml-2.3.8 → runwayml-3.0.1}/src/runwayml/_utils/_logs.py +0 -0
  48. {runwayml-2.3.8 → runwayml-3.0.1}/src/runwayml/_utils/_proxy.py +0 -0
  49. {runwayml-2.3.8 → runwayml-3.0.1}/src/runwayml/_utils/_reflection.py +0 -0
  50. {runwayml-2.3.8 → runwayml-3.0.1}/src/runwayml/_utils/_streams.py +0 -0
  51. {runwayml-2.3.8 → runwayml-3.0.1}/src/runwayml/_utils/_sync.py +0 -0
  52. {runwayml-2.3.8 → runwayml-3.0.1}/src/runwayml/_utils/_utils.py +0 -0
  53. {runwayml-2.3.8 → runwayml-3.0.1}/src/runwayml/lib/.keep +0 -0
  54. {runwayml-2.3.8 → runwayml-3.0.1}/src/runwayml/py.typed +0 -0
  55. {runwayml-2.3.8 → runwayml-3.0.1}/src/runwayml/resources/tasks.py +0 -0
  56. {runwayml-2.3.8 → runwayml-3.0.1}/src/runwayml/types/image_to_video_create_response.py +0 -0
  57. {runwayml-2.3.8 → runwayml-3.0.1}/src/runwayml/types/task_retrieve_response.py +0 -0
  58. {runwayml-2.3.8 → runwayml-3.0.1}/tests/__init__.py +0 -0
  59. {runwayml-2.3.8 → runwayml-3.0.1}/tests/api_resources/__init__.py +0 -0
  60. {runwayml-2.3.8 → runwayml-3.0.1}/tests/api_resources/test_tasks.py +0 -0
  61. {runwayml-2.3.8 → runwayml-3.0.1}/tests/conftest.py +0 -0
  62. {runwayml-2.3.8 → runwayml-3.0.1}/tests/sample_file.txt +0 -0
  63. {runwayml-2.3.8 → runwayml-3.0.1}/tests/test_deepcopy.py +0 -0
  64. {runwayml-2.3.8 → runwayml-3.0.1}/tests/test_extract_files.py +0 -0
  65. {runwayml-2.3.8 → runwayml-3.0.1}/tests/test_files.py +0 -0
  66. {runwayml-2.3.8 → runwayml-3.0.1}/tests/test_models.py +0 -0
  67. {runwayml-2.3.8 → runwayml-3.0.1}/tests/test_qs.py +0 -0
  68. {runwayml-2.3.8 → runwayml-3.0.1}/tests/test_required_args.py +0 -0
  69. {runwayml-2.3.8 → runwayml-3.0.1}/tests/test_response.py +0 -0
  70. {runwayml-2.3.8 → runwayml-3.0.1}/tests/test_streaming.py +0 -0
  71. {runwayml-2.3.8 → runwayml-3.0.1}/tests/test_utils/test_proxy.py +0 -0
  72. {runwayml-2.3.8 → runwayml-3.0.1}/tests/test_utils/test_typing.py +0 -0
  73. {runwayml-2.3.8 → runwayml-3.0.1}/tests/utils.py +0 -0
@@ -0,0 +1,3 @@
1
+ {
2
+ ".": "3.0.1"
3
+ }
@@ -1,5 +1,36 @@
1
1
  # Changelog
2
2
 
3
+ ## 3.0.1 (2025-04-15)
4
+
5
+ Full Changelog: [v3.0.0...v3.0.1](https://github.com/runwayml/sdk-python/compare/v3.0.0...v3.0.1)
6
+
7
+ ### Bug Fixes
8
+
9
+ * **perf:** optimize some hot paths ([0c187d1](https://github.com/runwayml/sdk-python/commit/0c187d1c445dd39661ec91f809ba1e51a9b5f0f2))
10
+ * **perf:** skip traversing types for NotGiven values ([a65d4b0](https://github.com/runwayml/sdk-python/commit/a65d4b0375c412d1b707550a8e1b1d9ba9319130))
11
+
12
+
13
+ ### Chores
14
+
15
+ * **client:** minor internal fixes ([09dd17f](https://github.com/runwayml/sdk-python/commit/09dd17fc639bc5c9aadfc033c131b133764d4e5b))
16
+ * **internal:** expand CI branch coverage ([8bde5ff](https://github.com/runwayml/sdk-python/commit/8bde5ff981d4acd0696ad3b7ac778ca21a49a8ac))
17
+ * **internal:** reduce CI branch coverage ([5892e7a](https://github.com/runwayml/sdk-python/commit/5892e7aa93fa9e091f111fd0590b239487ba61eb))
18
+ * **internal:** update pyright settings ([8b3a8ae](https://github.com/runwayml/sdk-python/commit/8b3a8ae32a589680549054328996ae7314be3033))
19
+
20
+ ## 3.0.0 (2025-04-09)
21
+
22
+ Full Changelog: [v2.3.8...v3.0.0](https://github.com/runwayml/sdk-python/compare/v2.3.8...v3.0.0)
23
+
24
+ ### Features
25
+
26
+ * **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))
27
+
28
+
29
+ ### Chores
30
+
31
+ * **internal:** remove trailing character ([#132](https://github.com/runwayml/sdk-python/issues/132)) ([cd78e34](https://github.com/runwayml/sdk-python/commit/cd78e34930a48a8696947178ee92ae22b1210898))
32
+ * **internal:** slight transform perf improvement ([#134](https://github.com/runwayml/sdk-python/issues/134)) ([33e5a68](https://github.com/runwayml/sdk-python/commit/33e5a68198c39c04edcf055c08f43e7800f8fbc0))
33
+
3
34
  ## 2.3.8 (2025-03-27)
4
35
 
5
36
  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: 2.3.8
3
+ Version: 3.0.1
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="gen3a_turbo",
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="gen3a_turbo",
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="gen3a_turbo",
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="gen3a_turbo",
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="gen3a_turbo",
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="gen3a_turbo",
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="gen3a_turbo",
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="gen3a_turbo",
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="gen3a_turbo",
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="gen3a_turbo",
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="gen3a_turbo",
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="gen3a_turbo",
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="gen3a_turbo",
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="gen3a_turbo",
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>
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "runwayml"
3
- version = "2.3.8"
3
+ version = "3.0.1"
4
4
  description = "The official Python library for the runwayml API"
5
5
  dynamic = ["readme"]
6
6
  license = "Apache-2.0"
@@ -147,6 +147,7 @@ exclude = [
147
147
  ]
148
148
 
149
149
  reportImplicitOverride = true
150
+ reportOverlappingOverload = false
150
151
 
151
152
  reportImportCycles = false
152
153
  reportPrivateUsage = false
@@ -409,7 +409,8 @@ class BaseClient(Generic[_HttpxClientT, _DefaultStreamT]):
409
409
 
410
410
  idempotency_header = self._idempotency_header
411
411
  if idempotency_header and options.method.lower() != "get" and idempotency_header not in headers:
412
- headers[idempotency_header] = options.idempotency_key or self._idempotency_key()
412
+ options.idempotency_key = options.idempotency_key or self._idempotency_key()
413
+ headers[idempotency_header] = options.idempotency_key
413
414
 
414
415
  # Don't set these headers if they were already set or removed by the caller. We check
415
416
  # `custom_headers`, which can contain `Omit()`, instead of `headers` to account for the removal case.
@@ -943,6 +944,10 @@ class SyncAPIClient(BaseClient[httpx.Client, Stream[Any]]):
943
944
  request = self._build_request(options, retries_taken=retries_taken)
944
945
  self._prepare_request(request)
945
946
 
947
+ if options.idempotency_key:
948
+ # ensure the idempotency key is reused between requests
949
+ input_options.idempotency_key = options.idempotency_key
950
+
946
951
  kwargs: HttpxSendArgs = {}
947
952
  if self.custom_auth is not None:
948
953
  kwargs["auth"] = self.custom_auth
@@ -1475,6 +1480,10 @@ class AsyncAPIClient(BaseClient[httpx.AsyncClient, AsyncStream[Any]]):
1475
1480
  request = self._build_request(options, retries_taken=retries_taken)
1476
1481
  await self._prepare_request(request)
1477
1482
 
1483
+ if options.idempotency_key:
1484
+ # ensure the idempotency key is reused between requests
1485
+ input_options.idempotency_key = options.idempotency_key
1486
+
1478
1487
  kwargs: HttpxSendArgs = {}
1479
1488
  if self.custom_auth is not None:
1480
1489
  kwargs["auth"] = self.custom_auth
@@ -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
@@ -5,13 +5,15 @@ import base64
5
5
  import pathlib
6
6
  from typing import Any, Mapping, TypeVar, cast
7
7
  from datetime import date, datetime
8
- from typing_extensions import Literal, get_args, override, get_type_hints
8
+ from typing_extensions import Literal, get_args, override, get_type_hints as _get_type_hints
9
9
 
10
10
  import anyio
11
11
  import pydantic
12
12
 
13
13
  from ._utils import (
14
14
  is_list,
15
+ is_given,
16
+ lru_cache,
15
17
  is_mapping,
16
18
  is_iterable,
17
19
  )
@@ -108,6 +110,7 @@ def transform(
108
110
  return cast(_T, transformed)
109
111
 
110
112
 
113
+ @lru_cache(maxsize=8096)
111
114
  def _get_annotated_type(type_: type) -> type | None:
112
115
  """If the given type is an `Annotated` type then it is returned, if not `None` is returned.
113
116
 
@@ -142,6 +145,10 @@ def _maybe_transform_key(key: str, type_: type) -> str:
142
145
  return key
143
146
 
144
147
 
148
+ def _no_transform_needed(annotation: type) -> bool:
149
+ return annotation == float or annotation == int
150
+
151
+
145
152
  def _transform_recursive(
146
153
  data: object,
147
154
  *,
@@ -184,6 +191,15 @@ def _transform_recursive(
184
191
  return cast(object, data)
185
192
 
186
193
  inner_type = extract_type_arg(stripped_type, 0)
194
+ if _no_transform_needed(inner_type):
195
+ # for some types there is no need to transform anything, so we can get a small
196
+ # perf boost from skipping that work.
197
+ #
198
+ # but we still need to convert to a list to ensure the data is json-serializable
199
+ if is_list(data):
200
+ return data
201
+ return list(data)
202
+
187
203
  return [_transform_recursive(d, annotation=annotation, inner_type=inner_type) for d in data]
188
204
 
189
205
  if is_union_type(stripped_type):
@@ -245,6 +261,11 @@ def _transform_typeddict(
245
261
  result: dict[str, object] = {}
246
262
  annotations = get_type_hints(expected_type, include_extras=True)
247
263
  for key, value in data.items():
264
+ if not is_given(value):
265
+ # we don't need to include `NotGiven` values here as they'll
266
+ # be stripped out before the request is sent anyway
267
+ continue
268
+
248
269
  type_ = annotations.get(key)
249
270
  if type_ is None:
250
271
  # we do not have a type annotation for this field, leave it as is
@@ -332,6 +353,15 @@ async def _async_transform_recursive(
332
353
  return cast(object, data)
333
354
 
334
355
  inner_type = extract_type_arg(stripped_type, 0)
356
+ if _no_transform_needed(inner_type):
357
+ # for some types there is no need to transform anything, so we can get a small
358
+ # perf boost from skipping that work.
359
+ #
360
+ # but we still need to convert to a list to ensure the data is json-serializable
361
+ if is_list(data):
362
+ return data
363
+ return list(data)
364
+
335
365
  return [await _async_transform_recursive(d, annotation=annotation, inner_type=inner_type) for d in data]
336
366
 
337
367
  if is_union_type(stripped_type):
@@ -393,6 +423,11 @@ async def _async_transform_typeddict(
393
423
  result: dict[str, object] = {}
394
424
  annotations = get_type_hints(expected_type, include_extras=True)
395
425
  for key, value in data.items():
426
+ if not is_given(value):
427
+ # we don't need to include `NotGiven` values here as they'll
428
+ # be stripped out before the request is sent anyway
429
+ continue
430
+
396
431
  type_ = annotations.get(key)
397
432
  if type_ is None:
398
433
  # we do not have a type annotation for this field, leave it as is
@@ -400,3 +435,13 @@ async def _async_transform_typeddict(
400
435
  else:
401
436
  result[_maybe_transform_key(key, type_)] = await _async_transform_recursive(value, annotation=type_)
402
437
  return result
438
+
439
+
440
+ @lru_cache(maxsize=8096)
441
+ def get_type_hints(
442
+ obj: Any,
443
+ globalns: dict[str, Any] | None = None,
444
+ localns: Mapping[str, Any] | None = None,
445
+ include_extras: bool = False,
446
+ ) -> dict[str, Any]:
447
+ return _get_type_hints(obj, globalns=globalns, localns=localns, include_extras=include_extras)
@@ -13,6 +13,7 @@ from typing_extensions import (
13
13
  get_origin,
14
14
  )
15
15
 
16
+ from ._utils import lru_cache
16
17
  from .._types import InheritsGeneric
17
18
  from .._compat import is_union as _is_union
18
19
 
@@ -66,6 +67,7 @@ def is_type_alias_type(tp: Any, /) -> TypeIs[typing_extensions.TypeAliasType]:
66
67
 
67
68
 
68
69
  # Extracts T from Annotated[T, ...] or from Required[Annotated[T, ...]]
70
+ @lru_cache(maxsize=8096)
69
71
  def strip_annotated_type(typ: type) -> type:
70
72
  if is_required_type(typ) or is_annotated_type(typ):
71
73
  return strip_annotated_type(cast(type, get_args(typ)[0]))
@@ -1,4 +1,4 @@
1
1
  # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
3
  __title__ = "runwayml"
4
- __version__ = "2.3.8" # x-release-please-version
4
+ __version__ = "3.0.1" # x-release-please-version
@@ -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:768", "768:1280"] | NotGiven = NOT_GIVEN,
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:768", "768:1280"] | NotGiven = NOT_GIVEN,
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
+ )