|
23 | 23 | VideoResourceWithStreamingResponse, |
24 | 24 | AsyncVideoResourceWithStreamingResponse, |
25 | 25 | ) |
26 | | -from ...types import generation_list_params, generation_create_params, generation_upscale_params |
| 26 | +from ...types import ( |
| 27 | + generation_list_params, |
| 28 | + generation_audio_params, |
| 29 | + generation_create_params, |
| 30 | + generation_upscale_params, |
| 31 | +) |
27 | 32 | from ..._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven |
28 | 33 | from ..._utils import ( |
29 | 34 | maybe_transform, |
@@ -231,6 +236,58 @@ def delete( |
231 | 236 | cast_to=NoneType, |
232 | 237 | ) |
233 | 238 |
|
| 239 | + def audio( |
| 240 | + self, |
| 241 | + id: str, |
| 242 | + *, |
| 243 | + callback_url: str | NotGiven = NOT_GIVEN, |
| 244 | + generation_type: Literal["add_audio"] | NotGiven = NOT_GIVEN, |
| 245 | + negative_prompt: str | NotGiven = NOT_GIVEN, |
| 246 | + prompt: str | NotGiven = NOT_GIVEN, |
| 247 | + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. |
| 248 | + # The extra values given here take precedence over values defined on the client or passed to this method. |
| 249 | + extra_headers: Headers | None = None, |
| 250 | + extra_query: Query | None = None, |
| 251 | + extra_body: Body | None = None, |
| 252 | + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, |
| 253 | + ) -> Generation: |
| 254 | + """ |
| 255 | + Add audio to a generation by its ID |
| 256 | +
|
| 257 | + Args: |
| 258 | + callback_url: The callback URL for the audio |
| 259 | +
|
| 260 | + negative_prompt: The negative prompt of the audio |
| 261 | +
|
| 262 | + prompt: The prompt of the audio |
| 263 | +
|
| 264 | + extra_headers: Send extra headers |
| 265 | +
|
| 266 | + extra_query: Add additional query parameters to the request |
| 267 | +
|
| 268 | + extra_body: Add additional JSON properties to the request |
| 269 | +
|
| 270 | + timeout: Override the client-level default timeout for this request, in seconds |
| 271 | + """ |
| 272 | + if not id: |
| 273 | + raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") |
| 274 | + return self._post( |
| 275 | + f"/generations/{id}/audio", |
| 276 | + body=maybe_transform( |
| 277 | + { |
| 278 | + "callback_url": callback_url, |
| 279 | + "generation_type": generation_type, |
| 280 | + "negative_prompt": negative_prompt, |
| 281 | + "prompt": prompt, |
| 282 | + }, |
| 283 | + generation_audio_params.GenerationAudioParams, |
| 284 | + ), |
| 285 | + options=make_request_options( |
| 286 | + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout |
| 287 | + ), |
| 288 | + cast_to=Generation, |
| 289 | + ) |
| 290 | + |
234 | 291 | def get( |
235 | 292 | self, |
236 | 293 | id: str, |
@@ -492,6 +549,58 @@ async def delete( |
492 | 549 | cast_to=NoneType, |
493 | 550 | ) |
494 | 551 |
|
| 552 | + async def audio( |
| 553 | + self, |
| 554 | + id: str, |
| 555 | + *, |
| 556 | + callback_url: str | NotGiven = NOT_GIVEN, |
| 557 | + generation_type: Literal["add_audio"] | NotGiven = NOT_GIVEN, |
| 558 | + negative_prompt: str | NotGiven = NOT_GIVEN, |
| 559 | + prompt: str | NotGiven = NOT_GIVEN, |
| 560 | + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. |
| 561 | + # The extra values given here take precedence over values defined on the client or passed to this method. |
| 562 | + extra_headers: Headers | None = None, |
| 563 | + extra_query: Query | None = None, |
| 564 | + extra_body: Body | None = None, |
| 565 | + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, |
| 566 | + ) -> Generation: |
| 567 | + """ |
| 568 | + Add audio to a generation by its ID |
| 569 | +
|
| 570 | + Args: |
| 571 | + callback_url: The callback URL for the audio |
| 572 | +
|
| 573 | + negative_prompt: The negative prompt of the audio |
| 574 | +
|
| 575 | + prompt: The prompt of the audio |
| 576 | +
|
| 577 | + extra_headers: Send extra headers |
| 578 | +
|
| 579 | + extra_query: Add additional query parameters to the request |
| 580 | +
|
| 581 | + extra_body: Add additional JSON properties to the request |
| 582 | +
|
| 583 | + timeout: Override the client-level default timeout for this request, in seconds |
| 584 | + """ |
| 585 | + if not id: |
| 586 | + raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") |
| 587 | + return await self._post( |
| 588 | + f"/generations/{id}/audio", |
| 589 | + body=await async_maybe_transform( |
| 590 | + { |
| 591 | + "callback_url": callback_url, |
| 592 | + "generation_type": generation_type, |
| 593 | + "negative_prompt": negative_prompt, |
| 594 | + "prompt": prompt, |
| 595 | + }, |
| 596 | + generation_audio_params.GenerationAudioParams, |
| 597 | + ), |
| 598 | + options=make_request_options( |
| 599 | + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout |
| 600 | + ), |
| 601 | + cast_to=Generation, |
| 602 | + ) |
| 603 | + |
495 | 604 | async def get( |
496 | 605 | self, |
497 | 606 | id: str, |
@@ -587,6 +696,9 @@ def __init__(self, generations: GenerationsResource) -> None: |
587 | 696 | self.delete = to_raw_response_wrapper( |
588 | 697 | generations.delete, |
589 | 698 | ) |
| 699 | + self.audio = to_raw_response_wrapper( |
| 700 | + generations.audio, |
| 701 | + ) |
590 | 702 | self.get = to_raw_response_wrapper( |
591 | 703 | generations.get, |
592 | 704 | ) |
@@ -620,6 +732,9 @@ def __init__(self, generations: AsyncGenerationsResource) -> None: |
620 | 732 | self.delete = async_to_raw_response_wrapper( |
621 | 733 | generations.delete, |
622 | 734 | ) |
| 735 | + self.audio = async_to_raw_response_wrapper( |
| 736 | + generations.audio, |
| 737 | + ) |
623 | 738 | self.get = async_to_raw_response_wrapper( |
624 | 739 | generations.get, |
625 | 740 | ) |
@@ -653,6 +768,9 @@ def __init__(self, generations: GenerationsResource) -> None: |
653 | 768 | self.delete = to_streamed_response_wrapper( |
654 | 769 | generations.delete, |
655 | 770 | ) |
| 771 | + self.audio = to_streamed_response_wrapper( |
| 772 | + generations.audio, |
| 773 | + ) |
656 | 774 | self.get = to_streamed_response_wrapper( |
657 | 775 | generations.get, |
658 | 776 | ) |
@@ -686,6 +804,9 @@ def __init__(self, generations: AsyncGenerationsResource) -> None: |
686 | 804 | self.delete = async_to_streamed_response_wrapper( |
687 | 805 | generations.delete, |
688 | 806 | ) |
| 807 | + self.audio = async_to_streamed_response_wrapper( |
| 808 | + generations.audio, |
| 809 | + ) |
689 | 810 | self.get = async_to_streamed_response_wrapper( |
690 | 811 | generations.get, |
691 | 812 | ) |
|
0 commit comments