Skip to content

Commit 52000cb

Browse files
feat(api): api update
1 parent b5f3b46 commit 52000cb

File tree

5 files changed

+43
-13
lines changed

5 files changed

+43
-13
lines changed

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 17
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/groqcloud%2Fgroqcloud-44f26c97b68dbe6075dfb8546a2dc8e34fbccb65144e743f18b45b09efc31812.yml
3-
openapi_spec_hash: b400d52f175e75661627bd99347fe888
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/groqcloud%2Fgroqcloud-a2ddf0c5cb796758690f28d02fef6ae46d2eab3fdc3e2d2cf99ef2b75cca4022.yml
3+
openapi_spec_hash: 0f3cd640ddd5f1f4e8ea20b9cfd86025
44
config_hash: 6b1c374dcc1ffa3165dd22f52a77ff89

src/groq/resources/audio/speech.py

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@ def create(
5353
input: str,
5454
model: Union[str, Literal["playai-tts", "playai-tts-arabic"]],
5555
voice: str,
56-
response_format: Literal["wav", "mp3"] | NotGiven = NOT_GIVEN,
56+
response_format: Literal["flac", "mp3", "mulaw", "ogg", "wav"] | NotGiven = NOT_GIVEN,
57+
sample_rate: Literal[8000, 16000, 22050, 24000, 32000, 44100, 48000] | NotGiven = NOT_GIVEN,
5758
speed: float | NotGiven = NOT_GIVEN,
5859
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
5960
# The extra values given here take precedence over values defined on the client or passed to this method.
@@ -73,9 +74,12 @@ def create(
7374
voice: The voice to use when generating the audio. List of voices can be found
7475
[here](/docs/text-to-speech).
7576
76-
response_format: The format to audio in. Supported formats are `wav, mp3`.
77+
response_format: The format of the generated audio. Supported formats are
78+
`flac, mp3, mulaw, ogg, wav`.
7779
78-
speed: The speed of the generated audio. 1.0 is the only supported value.
80+
sample_rate: The sample rate for generated audio
81+
82+
speed: The speed of the generated audio.
7983
8084
extra_headers: Send extra headers
8185
@@ -94,6 +98,7 @@ def create(
9498
"model": model,
9599
"voice": voice,
96100
"response_format": response_format,
101+
"sample_rate": sample_rate,
97102
"speed": speed,
98103
},
99104
speech_create_params.SpeechCreateParams,
@@ -131,7 +136,8 @@ async def create(
131136
input: str,
132137
model: Union[str, Literal["playai-tts", "playai-tts-arabic"]],
133138
voice: str,
134-
response_format: Literal["wav", "mp3"] | NotGiven = NOT_GIVEN,
139+
response_format: Literal["flac", "mp3", "mulaw", "ogg", "wav"] | NotGiven = NOT_GIVEN,
140+
sample_rate: Literal[8000, 16000, 22050, 24000, 32000, 44100, 48000] | NotGiven = NOT_GIVEN,
135141
speed: float | NotGiven = NOT_GIVEN,
136142
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
137143
# The extra values given here take precedence over values defined on the client or passed to this method.
@@ -151,9 +157,12 @@ async def create(
151157
voice: The voice to use when generating the audio. List of voices can be found
152158
[here](/docs/text-to-speech).
153159
154-
response_format: The format to audio in. Supported formats are `wav, mp3`.
160+
response_format: The format of the generated audio. Supported formats are
161+
`flac, mp3, mulaw, ogg, wav`.
162+
163+
sample_rate: The sample rate for generated audio
155164
156-
speed: The speed of the generated audio. 1.0 is the only supported value.
165+
speed: The speed of the generated audio.
157166
158167
extra_headers: Send extra headers
159168
@@ -172,6 +181,7 @@ async def create(
172181
"model": model,
173182
"voice": voice,
174183
"response_format": response_format,
184+
"sample_rate": sample_rate,
175185
"speed": speed,
176186
},
177187
speech_create_params.SpeechCreateParams,

src/groq/types/audio/speech_create_params.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,14 @@ class SpeechCreateParams(TypedDict, total=False):
2121
List of voices can be found [here](/docs/text-to-speech).
2222
"""
2323

24-
response_format: Literal["wav", "mp3"]
25-
"""The format to audio in. Supported formats are `wav, mp3`."""
24+
response_format: Literal["flac", "mp3", "mulaw", "ogg", "wav"]
25+
"""The format of the generated audio.
26+
27+
Supported formats are `flac, mp3, mulaw, ogg, wav`.
28+
"""
29+
30+
sample_rate: Literal[8000, 16000, 22050, 24000, 32000, 44100, 48000]
31+
"""The sample rate for generated audio"""
2632

2733
speed: float
28-
"""The speed of the generated audio. 1.0 is the only supported value."""
34+
"""The speed of the generated audio."""

src/groq/types/chat/chat_completion_message.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,21 @@
99
__all__ = [
1010
"ChatCompletionMessage",
1111
"ExecutedTool",
12+
"ExecutedToolCodeResult",
1213
"ExecutedToolSearchResults",
1314
"ExecutedToolSearchResultsResult",
1415
"FunctionCall",
1516
]
1617

1718

19+
class ExecutedToolCodeResult(BaseModel):
20+
png: Optional[str] = None
21+
"""Base64 encoded PNG image output from code execution"""
22+
23+
text: Optional[str] = None
24+
"""The text version of the code execution result"""
25+
26+
1827
class ExecutedToolSearchResultsResult(BaseModel):
1928
content: Optional[str] = None
2029
"""The content of the search result"""
@@ -47,6 +56,9 @@ class ExecutedTool(BaseModel):
4756
type: str
4857
"""The type of tool that was executed."""
4958

59+
code_results: Optional[List[ExecutedToolCodeResult]] = None
60+
"""Array of code execution results"""
61+
5062
output: Optional[str] = None
5163
"""The output returned by the tool."""
5264

tests/api_resources/audio/test_speech.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ def test_method_create_with_all_params(self, client: Groq, respx_mock: MockRoute
4545
input="The quick brown fox jumped over the lazy dog",
4646
model="playai-tts",
4747
voice="Fritz-PlayAI",
48-
response_format="wav",
48+
response_format="flac",
49+
sample_rate=48000,
4950
speed=1,
5051
)
5152
assert speech.is_closed
@@ -113,7 +114,8 @@ async def test_method_create_with_all_params(self, async_client: AsyncGroq, resp
113114
input="The quick brown fox jumped over the lazy dog",
114115
model="playai-tts",
115116
voice="Fritz-PlayAI",
116-
response_format="wav",
117+
response_format="flac",
118+
sample_rate=48000,
117119
speed=1,
118120
)
119121
assert speech.is_closed

0 commit comments

Comments
 (0)