Skip to content

Commit 4db81fc

Browse files
feat(api): api update (#111)
1 parent 75d1543 commit 4db81fc

File tree

10 files changed

+255
-12
lines changed

10 files changed

+255
-12
lines changed

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
configured_endpoints: 8
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/luma-ai-karanganesan%2Fluma_ai-7514d44d25b8dd931de982d593ba0d03467acdda95fc8367ef2732e7ad2e8086.yml
1+
configured_endpoints: 9
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/luma-ai-karanganesan%2Fluma_ai-5dbcb84a385ed55016c4d7ded7c0056e6e537b19fd3b626179a2c4c9bac8a90f.yml

api.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ Methods:
1212
- <code title="get /generations">client.generations.<a href="./src/lumaai/resources/generations/generations.py">list</a>(\*\*<a href="src/lumaai/types/generation_list_params.py">params</a>) -> <a href="./src/lumaai/types/generation_list_response.py">GenerationListResponse</a></code>
1313
- <code title="delete /generations/{id}">client.generations.<a href="./src/lumaai/resources/generations/generations.py">delete</a>(id) -> None</code>
1414
- <code title="get /generations/{id}">client.generations.<a href="./src/lumaai/resources/generations/generations.py">get</a>(id) -> <a href="./src/lumaai/types/generation.py">Generation</a></code>
15+
- <code title="post /generations/{id}/upscale">client.generations.<a href="./src/lumaai/resources/generations/generations.py">upscale</a>(id, \*\*<a href="src/lumaai/types/generation_upscale_params.py">params</a>) -> <a href="./src/lumaai/types/generation.py">Generation</a></code>
1516

1617
## CameraMotion
1718

src/lumaai/resources/generations/generations.py

Lines changed: 111 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
VideoResourceWithStreamingResponse,
2424
AsyncVideoResourceWithStreamingResponse,
2525
)
26-
from ...types import generation_list_params, generation_create_params
26+
from ...types import generation_list_params, generation_create_params, generation_upscale_params
2727
from ..._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven
2828
from ..._utils import (
2929
maybe_transform,
@@ -95,7 +95,7 @@ def create(
9595
loop: bool | NotGiven = NOT_GIVEN,
9696
model: Literal["ray-1-6", "ray-2"] | NotGiven = NOT_GIVEN,
9797
prompt: str | NotGiven = NOT_GIVEN,
98-
resolution: Union[Literal["540p", "720p"], str] | NotGiven = NOT_GIVEN,
98+
resolution: Union[Literal["540p", "720p", "1080p", "4k"], str] | NotGiven = NOT_GIVEN,
9999
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
100100
# The extra values given here take precedence over values defined on the client or passed to this method.
101101
extra_headers: Headers | None = None,
@@ -264,6 +264,54 @@ def get(
264264
cast_to=Generation,
265265
)
266266

267+
def upscale(
268+
self,
269+
id: str,
270+
*,
271+
callback_url: str | NotGiven = NOT_GIVEN,
272+
generation_type: Literal["upscale_video"] | NotGiven = NOT_GIVEN,
273+
resolution: Union[Literal["540p", "720p", "1080p", "4k"], str] | NotGiven = NOT_GIVEN,
274+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
275+
# The extra values given here take precedence over values defined on the client or passed to this method.
276+
extra_headers: Headers | None = None,
277+
extra_query: Query | None = None,
278+
extra_body: Body | None = None,
279+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
280+
) -> Generation:
281+
"""
282+
Upscale a generation by its ID
283+
284+
Args:
285+
callback_url: The callback URL for the upscale
286+
287+
resolution: The resolution of the upscale
288+
289+
extra_headers: Send extra headers
290+
291+
extra_query: Add additional query parameters to the request
292+
293+
extra_body: Add additional JSON properties to the request
294+
295+
timeout: Override the client-level default timeout for this request, in seconds
296+
"""
297+
if not id:
298+
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
299+
return self._post(
300+
f"/generations/{id}/upscale",
301+
body=maybe_transform(
302+
{
303+
"callback_url": callback_url,
304+
"generation_type": generation_type,
305+
"resolution": resolution,
306+
},
307+
generation_upscale_params.GenerationUpscaleParams,
308+
),
309+
options=make_request_options(
310+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
311+
),
312+
cast_to=Generation,
313+
)
314+
267315

268316
class AsyncGenerationsResource(AsyncAPIResource):
269317
@cached_property
@@ -308,7 +356,7 @@ async def create(
308356
loop: bool | NotGiven = NOT_GIVEN,
309357
model: Literal["ray-1-6", "ray-2"] | NotGiven = NOT_GIVEN,
310358
prompt: str | NotGiven = NOT_GIVEN,
311-
resolution: Union[Literal["540p", "720p"], str] | NotGiven = NOT_GIVEN,
359+
resolution: Union[Literal["540p", "720p", "1080p", "4k"], str] | NotGiven = NOT_GIVEN,
312360
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
313361
# The extra values given here take precedence over values defined on the client or passed to this method.
314362
extra_headers: Headers | None = None,
@@ -477,6 +525,54 @@ async def get(
477525
cast_to=Generation,
478526
)
479527

528+
async def upscale(
529+
self,
530+
id: str,
531+
*,
532+
callback_url: str | NotGiven = NOT_GIVEN,
533+
generation_type: Literal["upscale_video"] | NotGiven = NOT_GIVEN,
534+
resolution: Union[Literal["540p", "720p", "1080p", "4k"], str] | NotGiven = NOT_GIVEN,
535+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
536+
# The extra values given here take precedence over values defined on the client or passed to this method.
537+
extra_headers: Headers | None = None,
538+
extra_query: Query | None = None,
539+
extra_body: Body | None = None,
540+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
541+
) -> Generation:
542+
"""
543+
Upscale a generation by its ID
544+
545+
Args:
546+
callback_url: The callback URL for the upscale
547+
548+
resolution: The resolution of the upscale
549+
550+
extra_headers: Send extra headers
551+
552+
extra_query: Add additional query parameters to the request
553+
554+
extra_body: Add additional JSON properties to the request
555+
556+
timeout: Override the client-level default timeout for this request, in seconds
557+
"""
558+
if not id:
559+
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
560+
return await self._post(
561+
f"/generations/{id}/upscale",
562+
body=await async_maybe_transform(
563+
{
564+
"callback_url": callback_url,
565+
"generation_type": generation_type,
566+
"resolution": resolution,
567+
},
568+
generation_upscale_params.GenerationUpscaleParams,
569+
),
570+
options=make_request_options(
571+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
572+
),
573+
cast_to=Generation,
574+
)
575+
480576

481577
class GenerationsResourceWithRawResponse:
482578
def __init__(self, generations: GenerationsResource) -> None:
@@ -494,6 +590,9 @@ def __init__(self, generations: GenerationsResource) -> None:
494590
self.get = to_raw_response_wrapper(
495591
generations.get,
496592
)
593+
self.upscale = to_raw_response_wrapper(
594+
generations.upscale,
595+
)
497596

498597
@cached_property
499598
def camera_motion(self) -> CameraMotionResourceWithRawResponse:
@@ -524,6 +623,9 @@ def __init__(self, generations: AsyncGenerationsResource) -> None:
524623
self.get = async_to_raw_response_wrapper(
525624
generations.get,
526625
)
626+
self.upscale = async_to_raw_response_wrapper(
627+
generations.upscale,
628+
)
527629

528630
@cached_property
529631
def camera_motion(self) -> AsyncCameraMotionResourceWithRawResponse:
@@ -554,6 +656,9 @@ def __init__(self, generations: GenerationsResource) -> None:
554656
self.get = to_streamed_response_wrapper(
555657
generations.get,
556658
)
659+
self.upscale = to_streamed_response_wrapper(
660+
generations.upscale,
661+
)
557662

558663
@cached_property
559664
def camera_motion(self) -> CameraMotionResourceWithStreamingResponse:
@@ -584,6 +689,9 @@ def __init__(self, generations: AsyncGenerationsResource) -> None:
584689
self.get = async_to_streamed_response_wrapper(
585690
generations.get,
586691
)
692+
self.upscale = async_to_streamed_response_wrapper(
693+
generations.upscale,
694+
)
587695

588696
@cached_property
589697
def camera_motion(self) -> AsyncCameraMotionResourceWithStreamingResponse:

src/lumaai/resources/generations/video.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def create(
5858
loop: bool | NotGiven = NOT_GIVEN,
5959
model: Literal["ray-1-6", "ray-2"] | NotGiven = NOT_GIVEN,
6060
prompt: str | NotGiven = NOT_GIVEN,
61-
resolution: Union[Literal["540p", "720p"], str] | NotGiven = NOT_GIVEN,
61+
resolution: Union[Literal["540p", "720p", "1080p", "4k"], str] | NotGiven = NOT_GIVEN,
6262
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
6363
# The extra values given here take precedence over values defined on the client or passed to this method.
6464
extra_headers: Headers | None = None,
@@ -150,7 +150,7 @@ async def create(
150150
loop: bool | NotGiven = NOT_GIVEN,
151151
model: Literal["ray-1-6", "ray-2"] | NotGiven = NOT_GIVEN,
152152
prompt: str | NotGiven = NOT_GIVEN,
153-
resolution: Union[Literal["540p", "720p"], str] | NotGiven = NOT_GIVEN,
153+
resolution: Union[Literal["540p", "720p", "1080p", "4k"], str] | NotGiven = NOT_GIVEN,
154154
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
155155
# The extra values given here take precedence over values defined on the client or passed to this method.
156156
extra_headers: Headers | None = None,

src/lumaai/types/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@
88
from .generation_list_params import GenerationListParams as GenerationListParams
99
from .generation_create_params import GenerationCreateParams as GenerationCreateParams
1010
from .generation_list_response import GenerationListResponse as GenerationListResponse
11+
from .generation_upscale_params import GenerationUpscaleParams as GenerationUpscaleParams

src/lumaai/types/generation.py

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,17 @@
2525
"RequestImageGenerationRequestImageRef",
2626
"RequestImageGenerationRequestModifyImageRef",
2727
"RequestImageGenerationRequestStyleRef",
28+
"RequestUpscaleVideoGenerationRequest",
2829
]
2930

3031

3132
class Assets(BaseModel):
3233
image: Optional[str] = None
3334
"""The URL of the image"""
3435

36+
progress_video: Optional[str] = None
37+
"""The URL of the progress video"""
38+
3539
video: Optional[str] = None
3640
"""The URL of the video"""
3741

@@ -118,7 +122,7 @@ class RequestGenerationRequest(BaseModel):
118122
prompt: Optional[str] = None
119123
"""The prompt of the generation"""
120124

121-
resolution: Union[Literal["540p", "720p"], str, None] = None
125+
resolution: Union[Literal["540p", "720p", "1080p", "4k"], str, None] = None
122126
"""The resolution of the generation"""
123127

124128

@@ -181,7 +185,19 @@ class RequestImageGenerationRequest(BaseModel):
181185
style_ref: Optional[List[RequestImageGenerationRequestStyleRef]] = None
182186

183187

184-
Request: TypeAlias = Union[RequestGenerationRequest, RequestImageGenerationRequest]
188+
class RequestUpscaleVideoGenerationRequest(BaseModel):
189+
callback_url: Optional[str] = None
190+
"""The callback URL for the upscale"""
191+
192+
generation_type: Optional[Literal["upscale_video"]] = None
193+
194+
resolution: Union[Literal["540p", "720p", "1080p", "4k"], str, None] = None
195+
"""The resolution of the upscale"""
196+
197+
198+
Request: TypeAlias = Union[
199+
RequestGenerationRequest, RequestImageGenerationRequest, RequestUpscaleVideoGenerationRequest
200+
]
185201

186202

187203
class Generation(BaseModel):

src/lumaai/types/generation_create_params.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class GenerationCreateParams(TypedDict, total=False):
4545
prompt: str
4646
"""The prompt of the generation"""
4747

48-
resolution: Union[Literal["540p", "720p"], str]
48+
resolution: Union[Literal["540p", "720p", "1080p", "4k"], str]
4949
"""The resolution of the generation"""
5050

5151

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from __future__ import annotations
4+
5+
from typing import Union
6+
from typing_extensions import Literal, TypedDict
7+
8+
__all__ = ["GenerationUpscaleParams"]
9+
10+
11+
class GenerationUpscaleParams(TypedDict, total=False):
12+
callback_url: str
13+
"""The callback URL for the upscale"""
14+
15+
generation_type: Literal["upscale_video"]
16+
17+
resolution: Union[Literal["540p", "720p", "1080p", "4k"], str]
18+
"""The resolution of the upscale"""

src/lumaai/types/generations/video_create_params.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class VideoCreateParams(TypedDict, total=False):
4545
prompt: str
4646
"""The prompt of the generation"""
4747

48-
resolution: Union[Literal["540p", "720p"], str]
48+
resolution: Union[Literal["540p", "720p", "1080p", "4k"], str]
4949
"""The resolution of the generation"""
5050

5151

0 commit comments

Comments
 (0)