Skip to content

Commit e8ba8cb

Browse files
feat(api): api update
1 parent 915b0ce commit e8ba8cb

File tree

6 files changed

+324
-3
lines changed

6 files changed

+324
-3
lines changed

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
configured_endpoints: 12
1+
configured_endpoints: 13
22
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/luma-ai-karanganesan%2Fluma_ai-3eb911b4125c57ada1096eaeb4cadab8ac71ac4f6e5cf178209ebd1a3d7f826a.yml
33
openapi_spec_hash: 69a6757bf5c41f96ae0694e0b9c86491
4-
config_hash: 99ed0ad60bce60c5aaf6e6e25f40c622
4+
config_hash: 8017bd140eecc6eedb1d788d7b0edb3b

api.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ Methods:
3939
Methods:
4040

4141
- <code title="post /generations/video">client.generations.video.<a href="./src/lumaai/resources/generations/video.py">create</a>(\*\*<a href="src/lumaai/types/generations/video_create_params.py">params</a>) -> <a href="./src/lumaai/types/generation.py">Generation</a></code>
42+
- <code title="post /generations/video/modify">client.generations.video.<a href="./src/lumaai/resources/generations/video.py">modify</a>(\*\*<a href="src/lumaai/types/generations/video_modify_params.py">params</a>) -> <a href="./src/lumaai/types/generation.py">Generation</a></code>
4243
- <code title="post /generations/video/reframe">client.generations.video.<a href="./src/lumaai/resources/generations/video.py">reframe</a>(\*\*<a href="src/lumaai/types/generations/video_reframe_params.py">params</a>) -> <a href="./src/lumaai/types/generation.py">Generation</a></code>
4344

4445
# Ping

src/lumaai/resources/generations/video.py

Lines changed: 159 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
)
2020
from ..._base_client import make_request_options
2121
from ...types.generation import Generation
22-
from ...types.generations import video_create_params, video_reframe_params
22+
from ...types.generations import video_create_params, video_modify_params, video_reframe_params
2323

2424
__all__ = ["VideoResource", "AsyncVideoResource"]
2525

@@ -119,6 +119,79 @@ def create(
119119
cast_to=Generation,
120120
)
121121

122+
def modify(
123+
self,
124+
*,
125+
generation_type: Literal["modify_video"],
126+
media: video_modify_params.Media,
127+
mode: Literal[
128+
"adhere_1",
129+
"adhere_2",
130+
"adhere_3",
131+
"flex_1",
132+
"flex_2",
133+
"flex_3",
134+
"reimagine_1",
135+
"reimagine_2",
136+
"reimagine_3",
137+
],
138+
model: Literal["ray-2"],
139+
callback_url: str | NotGiven = NOT_GIVEN,
140+
first_frame: video_modify_params.FirstFrame | NotGiven = NOT_GIVEN,
141+
prompt: str | NotGiven = NOT_GIVEN,
142+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
143+
# The extra values given here take precedence over values defined on the client or passed to this method.
144+
extra_headers: Headers | None = None,
145+
extra_query: Query | None = None,
146+
extra_body: Body | None = None,
147+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
148+
) -> Generation:
149+
"""
150+
Modify a video with style transfer and prompt-based editing
151+
152+
Args:
153+
media: The image entity object
154+
155+
mode: The mode of the modify video
156+
157+
model: The model used for the modify video
158+
159+
callback_url: The callback URL of the generation, a POST request with Generation object will
160+
be sent to the callback URL when the generation is dreaming, completed, or
161+
failed
162+
163+
first_frame: The image entity object
164+
165+
prompt: The prompt of the generation
166+
167+
extra_headers: Send extra headers
168+
169+
extra_query: Add additional query parameters to the request
170+
171+
extra_body: Add additional JSON properties to the request
172+
173+
timeout: Override the client-level default timeout for this request, in seconds
174+
"""
175+
return self._post(
176+
"/generations/video/modify",
177+
body=maybe_transform(
178+
{
179+
"generation_type": generation_type,
180+
"media": media,
181+
"mode": mode,
182+
"model": model,
183+
"callback_url": callback_url,
184+
"first_frame": first_frame,
185+
"prompt": prompt,
186+
},
187+
video_modify_params.VideoModifyParams,
188+
),
189+
options=make_request_options(
190+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
191+
),
192+
cast_to=Generation,
193+
)
194+
122195
def reframe(
123196
self,
124197
*,
@@ -310,6 +383,79 @@ async def create(
310383
cast_to=Generation,
311384
)
312385

386+
async def modify(
387+
self,
388+
*,
389+
generation_type: Literal["modify_video"],
390+
media: video_modify_params.Media,
391+
mode: Literal[
392+
"adhere_1",
393+
"adhere_2",
394+
"adhere_3",
395+
"flex_1",
396+
"flex_2",
397+
"flex_3",
398+
"reimagine_1",
399+
"reimagine_2",
400+
"reimagine_3",
401+
],
402+
model: Literal["ray-2"],
403+
callback_url: str | NotGiven = NOT_GIVEN,
404+
first_frame: video_modify_params.FirstFrame | NotGiven = NOT_GIVEN,
405+
prompt: str | NotGiven = NOT_GIVEN,
406+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
407+
# The extra values given here take precedence over values defined on the client or passed to this method.
408+
extra_headers: Headers | None = None,
409+
extra_query: Query | None = None,
410+
extra_body: Body | None = None,
411+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
412+
) -> Generation:
413+
"""
414+
Modify a video with style transfer and prompt-based editing
415+
416+
Args:
417+
media: The image entity object
418+
419+
mode: The mode of the modify video
420+
421+
model: The model used for the modify video
422+
423+
callback_url: The callback URL of the generation, a POST request with Generation object will
424+
be sent to the callback URL when the generation is dreaming, completed, or
425+
failed
426+
427+
first_frame: The image entity object
428+
429+
prompt: The prompt of the generation
430+
431+
extra_headers: Send extra headers
432+
433+
extra_query: Add additional query parameters to the request
434+
435+
extra_body: Add additional JSON properties to the request
436+
437+
timeout: Override the client-level default timeout for this request, in seconds
438+
"""
439+
return await self._post(
440+
"/generations/video/modify",
441+
body=await async_maybe_transform(
442+
{
443+
"generation_type": generation_type,
444+
"media": media,
445+
"mode": mode,
446+
"model": model,
447+
"callback_url": callback_url,
448+
"first_frame": first_frame,
449+
"prompt": prompt,
450+
},
451+
video_modify_params.VideoModifyParams,
452+
),
453+
options=make_request_options(
454+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
455+
),
456+
cast_to=Generation,
457+
)
458+
313459
async def reframe(
314460
self,
315461
*,
@@ -413,6 +559,9 @@ def __init__(self, video: VideoResource) -> None:
413559
self.create = to_raw_response_wrapper(
414560
video.create,
415561
)
562+
self.modify = to_raw_response_wrapper(
563+
video.modify,
564+
)
416565
self.reframe = to_raw_response_wrapper(
417566
video.reframe,
418567
)
@@ -425,6 +574,9 @@ def __init__(self, video: AsyncVideoResource) -> None:
425574
self.create = async_to_raw_response_wrapper(
426575
video.create,
427576
)
577+
self.modify = async_to_raw_response_wrapper(
578+
video.modify,
579+
)
428580
self.reframe = async_to_raw_response_wrapper(
429581
video.reframe,
430582
)
@@ -437,6 +589,9 @@ def __init__(self, video: VideoResource) -> None:
437589
self.create = to_streamed_response_wrapper(
438590
video.create,
439591
)
592+
self.modify = to_streamed_response_wrapper(
593+
video.modify,
594+
)
440595
self.reframe = to_streamed_response_wrapper(
441596
video.reframe,
442597
)
@@ -449,6 +604,9 @@ def __init__(self, video: AsyncVideoResource) -> None:
449604
self.create = async_to_streamed_response_wrapper(
450605
video.create,
451606
)
607+
self.modify = async_to_streamed_response_wrapper(
608+
video.modify,
609+
)
452610
self.reframe = async_to_streamed_response_wrapper(
453611
video.reframe,
454612
)

src/lumaai/types/generations/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
from .image_create_params import ImageCreateParams as ImageCreateParams
66
from .video_create_params import VideoCreateParams as VideoCreateParams
7+
from .video_modify_params import VideoModifyParams as VideoModifyParams
78
from .image_reframe_params import ImageReframeParams as ImageReframeParams
89
from .video_reframe_params import VideoReframeParams as VideoReframeParams
910
from .concept_list_response import ConceptListResponse as ConceptListResponse
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from __future__ import annotations
4+
5+
from typing_extensions import Literal, Required, TypedDict
6+
7+
__all__ = ["VideoModifyParams", "Media", "FirstFrame"]
8+
9+
10+
class VideoModifyParams(TypedDict, total=False):
11+
generation_type: Required[Literal["modify_video"]]
12+
13+
media: Required[Media]
14+
"""The image entity object"""
15+
16+
mode: Required[
17+
Literal[
18+
"adhere_1",
19+
"adhere_2",
20+
"adhere_3",
21+
"flex_1",
22+
"flex_2",
23+
"flex_3",
24+
"reimagine_1",
25+
"reimagine_2",
26+
"reimagine_3",
27+
]
28+
]
29+
"""The mode of the modify video"""
30+
31+
model: Required[Literal["ray-2"]]
32+
"""The model used for the modify video"""
33+
34+
callback_url: str
35+
"""
36+
The callback URL of the generation, a POST request with Generation object will
37+
be sent to the callback URL when the generation is dreaming, completed, or
38+
failed
39+
"""
40+
41+
first_frame: FirstFrame
42+
"""The image entity object"""
43+
44+
prompt: str
45+
"""The prompt of the generation"""
46+
47+
48+
class Media(TypedDict, total=False):
49+
url: Required[str]
50+
"""The URL of the media"""
51+
52+
53+
class FirstFrame(TypedDict, total=False):
54+
url: Required[str]
55+
"""The URL of the media"""

0 commit comments

Comments
 (0)