From cd34c4917f55acfe320ae676b5528dea314ae96a Mon Sep 17 00:00:00 2001 From: Stainless Bot <107565488+stainless-bot@users.noreply.github.com> Date: Fri, 23 Feb 2024 19:18:50 -0500 Subject: [PATCH] feat(api): add wav and pcm to response_format (#1189) --- src/openai/resources/audio/speech.py | 16 ++++++++++++---- src/openai/types/audio/speech_create_params.py | 10 ++++++++-- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/src/openai/resources/audio/speech.py b/src/openai/resources/audio/speech.py index fbdc1ecff1..a569751ee5 100644 --- a/src/openai/resources/audio/speech.py +++ b/src/openai/resources/audio/speech.py @@ -41,7 +41,7 @@ def create( input: str, model: Union[str, Literal["tts-1", "tts-1-hd"]], voice: Literal["alloy", "echo", "fable", "onyx", "nova", "shimmer"], - response_format: Literal["mp3", "opus", "aac", "flac"] | NotGiven = NOT_GIVEN, + response_format: Literal["mp3", "opus", "aac", "flac", "pcm", "wav"] | NotGiven = NOT_GIVEN, speed: float | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -65,7 +65,11 @@ def create( available in the [Text to speech guide](https://platform.openai.com/docs/guides/text-to-speech/voice-options). - response_format: The format to audio in. Supported formats are `mp3`, `opus`, `aac`, and `flac`. + response_format: The format to return audio in. Supported formats are `mp3`, `opus`, `aac`, + `flac`, `pcm`, and `wav`. + + The `pcm` audio format, similar to `wav` but without a header, utilizes a 24kHz + sample rate, mono channel, and 16-bit depth in signed little-endian format. speed: The speed of the generated audio. Select a value from `0.25` to `4.0`. `1.0` is the default. @@ -113,7 +117,7 @@ async def create( input: str, model: Union[str, Literal["tts-1", "tts-1-hd"]], voice: Literal["alloy", "echo", "fable", "onyx", "nova", "shimmer"], - response_format: Literal["mp3", "opus", "aac", "flac"] | NotGiven = NOT_GIVEN, + response_format: Literal["mp3", "opus", "aac", "flac", "pcm", "wav"] | NotGiven = NOT_GIVEN, speed: float | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -137,7 +141,11 @@ async def create( available in the [Text to speech guide](https://platform.openai.com/docs/guides/text-to-speech/voice-options). - response_format: The format to audio in. Supported formats are `mp3`, `opus`, `aac`, and `flac`. + response_format: The format to return audio in. Supported formats are `mp3`, `opus`, `aac`, + `flac`, `pcm`, and `wav`. + + The `pcm` audio format, similar to `wav` but without a header, utilizes a 24kHz + sample rate, mono channel, and 16-bit depth in signed little-endian format. speed: The speed of the generated audio. Select a value from `0.25` to `4.0`. `1.0` is the default. diff --git a/src/openai/types/audio/speech_create_params.py b/src/openai/types/audio/speech_create_params.py index 6a302dd3c8..00f862272e 100644 --- a/src/openai/types/audio/speech_create_params.py +++ b/src/openai/types/audio/speech_create_params.py @@ -26,8 +26,14 @@ class SpeechCreateParams(TypedDict, total=False): [Text to speech guide](https://platform.openai.com/docs/guides/text-to-speech/voice-options). """ - response_format: Literal["mp3", "opus", "aac", "flac"] - """The format to audio in. Supported formats are `mp3`, `opus`, `aac`, and `flac`.""" + response_format: Literal["mp3", "opus", "aac", "flac", "pcm", "wav"] + """The format to return audio in. + + Supported formats are `mp3`, `opus`, `aac`, `flac`, `pcm`, and `wav`. + + The `pcm` audio format, similar to `wav` but without a header, utilizes a 24kHz + sample rate, mono channel, and 16-bit depth in signed little-endian format. + """ speed: float """The speed of the generated audio.