Skip to content

Commit 71236e0

Browse files
chore(api): update docs (#1212)
1 parent d0e4baa commit 71236e0

17 files changed

+98
-73
lines changed

Diff for: src/openai/resources/audio/speech.py

+6-12
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def create(
4444
input: str,
4545
model: Union[str, Literal["tts-1", "tts-1-hd"]],
4646
voice: Literal["alloy", "echo", "fable", "onyx", "nova", "shimmer"],
47-
response_format: Literal["mp3", "opus", "aac", "flac", "pcm", "wav"] | NotGiven = NOT_GIVEN,
47+
response_format: Literal["mp3", "opus", "aac", "flac", "wav", "pcm"] | NotGiven = NOT_GIVEN,
4848
speed: float | NotGiven = NOT_GIVEN,
4949
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
5050
# The extra values given here take precedence over values defined on the client or passed to this method.
@@ -68,11 +68,8 @@ def create(
6868
available in the
6969
[Text to speech guide](https://platform.openai.com/docs/guides/text-to-speech/voice-options).
7070
71-
response_format: The format to return audio in. Supported formats are `mp3`, `opus`, `aac`,
72-
`flac`, `pcm`, and `wav`.
73-
74-
The `pcm` audio format, similar to `wav` but without a header, utilizes a 24kHz
75-
sample rate, mono channel, and 16-bit depth in signed little-endian format.
71+
response_format: The format to audio in. Supported formats are `mp3`, `opus`, `aac`, `flac`,
72+
`wav`, and `pcm`.
7673
7774
speed: The speed of the generated audio. Select a value from `0.25` to `4.0`. `1.0` is
7875
the default.
@@ -120,7 +117,7 @@ async def create(
120117
input: str,
121118
model: Union[str, Literal["tts-1", "tts-1-hd"]],
122119
voice: Literal["alloy", "echo", "fable", "onyx", "nova", "shimmer"],
123-
response_format: Literal["mp3", "opus", "aac", "flac", "pcm", "wav"] | NotGiven = NOT_GIVEN,
120+
response_format: Literal["mp3", "opus", "aac", "flac", "wav", "pcm"] | NotGiven = NOT_GIVEN,
124121
speed: float | NotGiven = NOT_GIVEN,
125122
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
126123
# The extra values given here take precedence over values defined on the client or passed to this method.
@@ -144,11 +141,8 @@ async def create(
144141
available in the
145142
[Text to speech guide](https://platform.openai.com/docs/guides/text-to-speech/voice-options).
146143
147-
response_format: The format to return audio in. Supported formats are `mp3`, `opus`, `aac`,
148-
`flac`, `pcm`, and `wav`.
149-
150-
The `pcm` audio format, similar to `wav` but without a header, utilizes a 24kHz
151-
sample rate, mono channel, and 16-bit depth in signed little-endian format.
144+
response_format: The format to audio in. Supported formats are `mp3`, `opus`, `aac`, `flac`,
145+
`wav`, and `pcm`.
152146
153147
speed: The speed of the generated audio. Select a value from `0.25` to `4.0`. `1.0` is
154148
the default.

Diff for: src/openai/resources/audio/transcriptions.py

+14-8
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@ def create(
6060
The audio file object (not file name) to transcribe, in one of these formats:
6161
flac, mp3, mp4, mpeg, mpga, m4a, ogg, wav, or webm.
6262
63-
model: ID of the model to use. Only `whisper-1` is currently available.
63+
model: ID of the model to use. Only `whisper-1` (which is powered by our open source
64+
Whisper V2 model) is currently available.
6465
6566
language: The language of the input audio. Supplying the input language in
6667
[ISO-639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) format will
@@ -80,9 +81,11 @@ def create(
8081
[log probability](https://en.wikipedia.org/wiki/Log_probability) to
8182
automatically increase the temperature until certain thresholds are hit.
8283
83-
timestamp_granularities: The timestamp granularities to populate for this transcription. Any of these
84-
options: `word`, or `segment`. Note: There is no additional latency for segment
85-
timestamps, but generating word timestamps incurs additional latency.
84+
timestamp_granularities: The timestamp granularities to populate for this transcription.
85+
`response_format` must be set `verbose_json` to use timestamp granularities.
86+
Either or both of these options are supported: `word`, or `segment`. Note: There
87+
is no additional latency for segment timestamps, but generating word timestamps
88+
incurs additional latency.
8689
8790
extra_headers: Send extra headers
8891
@@ -154,7 +157,8 @@ async def create(
154157
The audio file object (not file name) to transcribe, in one of these formats:
155158
flac, mp3, mp4, mpeg, mpga, m4a, ogg, wav, or webm.
156159
157-
model: ID of the model to use. Only `whisper-1` is currently available.
160+
model: ID of the model to use. Only `whisper-1` (which is powered by our open source
161+
Whisper V2 model) is currently available.
158162
159163
language: The language of the input audio. Supplying the input language in
160164
[ISO-639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) format will
@@ -174,9 +178,11 @@ async def create(
174178
[log probability](https://en.wikipedia.org/wiki/Log_probability) to
175179
automatically increase the temperature until certain thresholds are hit.
176180
177-
timestamp_granularities: The timestamp granularities to populate for this transcription. Any of these
178-
options: `word`, or `segment`. Note: There is no additional latency for segment
179-
timestamps, but generating word timestamps incurs additional latency.
181+
timestamp_granularities: The timestamp granularities to populate for this transcription.
182+
`response_format` must be set `verbose_json` to use timestamp granularities.
183+
Either or both of these options are supported: `word`, or `segment`. Note: There
184+
is no additional latency for segment timestamps, but generating word timestamps
185+
incurs additional latency.
180186
181187
extra_headers: Send extra headers
182188

Diff for: src/openai/resources/audio/translations.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@ def create(
5757
file: The audio file object (not file name) translate, in one of these formats: flac,
5858
mp3, mp4, mpeg, mpga, m4a, ogg, wav, or webm.
5959
60-
model: ID of the model to use. Only `whisper-1` is currently available.
60+
model: ID of the model to use. Only `whisper-1` (which is powered by our open source
61+
Whisper V2 model) is currently available.
6162
6263
prompt: An optional text to guide the model's style or continue a previous audio
6364
segment. The
@@ -138,7 +139,8 @@ async def create(
138139
file: The audio file object (not file name) translate, in one of these formats: flac,
139140
mp3, mp4, mpeg, mpga, m4a, ogg, wav, or webm.
140141
141-
model: ID of the model to use. Only `whisper-1` is currently available.
142+
model: ID of the model to use. Only `whisper-1` (which is powered by our open source
143+
Whisper V2 model) is currently available.
142144
143145
prompt: An optional text to guide the model's style or continue a previous audio
144146
segment. The

Diff for: src/openai/resources/chat/completions.py

+18-18
Original file line numberDiff line numberDiff line change
@@ -208,9 +208,9 @@ def create(
208208
tool. Use this to provide a list of functions the model may generate JSON inputs
209209
for.
210210
211-
top_logprobs: An integer between 0 and 5 specifying the number of most likely tokens to return
212-
at each token position, each with an associated log probability. `logprobs` must
213-
be set to `true` if this parameter is used.
211+
top_logprobs: An integer between 0 and 20 specifying the number of most likely tokens to
212+
return at each token position, each with an associated log probability.
213+
`logprobs` must be set to `true` if this parameter is used.
214214
215215
top_p: An alternative to sampling with temperature, called nucleus sampling, where the
216216
model considers the results of the tokens with top_p probability mass. So 0.1
@@ -398,9 +398,9 @@ def create(
398398
tool. Use this to provide a list of functions the model may generate JSON inputs
399399
for.
400400
401-
top_logprobs: An integer between 0 and 5 specifying the number of most likely tokens to return
402-
at each token position, each with an associated log probability. `logprobs` must
403-
be set to `true` if this parameter is used.
401+
top_logprobs: An integer between 0 and 20 specifying the number of most likely tokens to
402+
return at each token position, each with an associated log probability.
403+
`logprobs` must be set to `true` if this parameter is used.
404404
405405
top_p: An alternative to sampling with temperature, called nucleus sampling, where the
406406
model considers the results of the tokens with top_p probability mass. So 0.1
@@ -588,9 +588,9 @@ def create(
588588
tool. Use this to provide a list of functions the model may generate JSON inputs
589589
for.
590590
591-
top_logprobs: An integer between 0 and 5 specifying the number of most likely tokens to return
592-
at each token position, each with an associated log probability. `logprobs` must
593-
be set to `true` if this parameter is used.
591+
top_logprobs: An integer between 0 and 20 specifying the number of most likely tokens to
592+
return at each token position, each with an associated log probability.
593+
`logprobs` must be set to `true` if this parameter is used.
594594
595595
top_p: An alternative to sampling with temperature, called nucleus sampling, where the
596596
model considers the results of the tokens with top_p probability mass. So 0.1
@@ -875,9 +875,9 @@ async def create(
875875
tool. Use this to provide a list of functions the model may generate JSON inputs
876876
for.
877877
878-
top_logprobs: An integer between 0 and 5 specifying the number of most likely tokens to return
879-
at each token position, each with an associated log probability. `logprobs` must
880-
be set to `true` if this parameter is used.
878+
top_logprobs: An integer between 0 and 20 specifying the number of most likely tokens to
879+
return at each token position, each with an associated log probability.
880+
`logprobs` must be set to `true` if this parameter is used.
881881
882882
top_p: An alternative to sampling with temperature, called nucleus sampling, where the
883883
model considers the results of the tokens with top_p probability mass. So 0.1
@@ -1065,9 +1065,9 @@ async def create(
10651065
tool. Use this to provide a list of functions the model may generate JSON inputs
10661066
for.
10671067
1068-
top_logprobs: An integer between 0 and 5 specifying the number of most likely tokens to return
1069-
at each token position, each with an associated log probability. `logprobs` must
1070-
be set to `true` if this parameter is used.
1068+
top_logprobs: An integer between 0 and 20 specifying the number of most likely tokens to
1069+
return at each token position, each with an associated log probability.
1070+
`logprobs` must be set to `true` if this parameter is used.
10711071
10721072
top_p: An alternative to sampling with temperature, called nucleus sampling, where the
10731073
model considers the results of the tokens with top_p probability mass. So 0.1
@@ -1255,9 +1255,9 @@ async def create(
12551255
tool. Use this to provide a list of functions the model may generate JSON inputs
12561256
for.
12571257
1258-
top_logprobs: An integer between 0 and 5 specifying the number of most likely tokens to return
1259-
at each token position, each with an associated log probability. `logprobs` must
1260-
be set to `true` if this parameter is used.
1258+
top_logprobs: An integer between 0 and 20 specifying the number of most likely tokens to
1259+
return at each token position, each with an associated log probability.
1260+
`logprobs` must be set to `true` if this parameter is used.
12611261
12621262
top_p: An alternative to sampling with temperature, called nucleus sampling, where the
12631263
model considers the results of the tokens with top_p probability mass. So 0.1

Diff for: src/openai/resources/images.py

+12-6
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,8 @@ def create_variation(
7070
`n=1` is supported.
7171
7272
response_format: The format in which the generated images are returned. Must be one of `url` or
73-
`b64_json`.
73+
`b64_json`. URLs are only valid for 60 minutes after the image has been
74+
generated.
7475
7576
size: The size of the generated images. Must be one of `256x256`, `512x512`, or
7677
`1024x1024`.
@@ -151,7 +152,8 @@ def edit(
151152
n: The number of images to generate. Must be between 1 and 10.
152153
153154
response_format: The format in which the generated images are returned. Must be one of `url` or
154-
`b64_json`.
155+
`b64_json`. URLs are only valid for 60 minutes after the image has been
156+
generated.
155157
156158
size: The size of the generated images. Must be one of `256x256`, `512x512`, or
157159
`1024x1024`.
@@ -231,7 +233,8 @@ def generate(
231233
for `dall-e-3`.
232234
233235
response_format: The format in which the generated images are returned. Must be one of `url` or
234-
`b64_json`.
236+
`b64_json`. URLs are only valid for 60 minutes after the image has been
237+
generated.
235238
236239
size: The size of the generated images. Must be one of `256x256`, `512x512`, or
237240
`1024x1024` for `dall-e-2`. Must be one of `1024x1024`, `1792x1024`, or
@@ -315,7 +318,8 @@ async def create_variation(
315318
`n=1` is supported.
316319
317320
response_format: The format in which the generated images are returned. Must be one of `url` or
318-
`b64_json`.
321+
`b64_json`. URLs are only valid for 60 minutes after the image has been
322+
generated.
319323
320324
size: The size of the generated images. Must be one of `256x256`, `512x512`, or
321325
`1024x1024`.
@@ -396,7 +400,8 @@ async def edit(
396400
n: The number of images to generate. Must be between 1 and 10.
397401
398402
response_format: The format in which the generated images are returned. Must be one of `url` or
399-
`b64_json`.
403+
`b64_json`. URLs are only valid for 60 minutes after the image has been
404+
generated.
400405
401406
size: The size of the generated images. Must be one of `256x256`, `512x512`, or
402407
`1024x1024`.
@@ -476,7 +481,8 @@ async def generate(
476481
for `dall-e-3`.
477482
478483
response_format: The format in which the generated images are returned. Must be one of `url` or
479-
`b64_json`.
484+
`b64_json`. URLs are only valid for 60 minutes after the image has been
485+
generated.
480486
481487
size: The size of the generated images. Must be one of `256x256`, `512x512`, or
482488
`1024x1024` for `dall-e-2`. Must be one of `1024x1024`, `1792x1024`, or

Diff for: src/openai/resources/moderations.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def create(
4646
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
4747
) -> ModerationCreateResponse:
4848
"""
49-
Classifies if text violates OpenAI's Content Policy
49+
Classifies if text is potentially harmful.
5050
5151
Args:
5252
input: The input text to classify
@@ -106,7 +106,7 @@ async def create(
106106
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
107107
) -> ModerationCreateResponse:
108108
"""
109-
Classifies if text violates OpenAI's Content Policy
109+
Classifies if text is potentially harmful.
110110
111111
Args:
112112
input: The input text to classify

Diff for: src/openai/types/audio/speech_create_params.py

+3-6
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,10 @@ class SpeechCreateParams(TypedDict, total=False):
2626
[Text to speech guide](https://platform.openai.com/docs/guides/text-to-speech/voice-options).
2727
"""
2828

29-
response_format: Literal["mp3", "opus", "aac", "flac", "pcm", "wav"]
30-
"""The format to return audio in.
29+
response_format: Literal["mp3", "opus", "aac", "flac", "wav", "pcm"]
30+
"""The format to audio in.
3131
32-
Supported formats are `mp3`, `opus`, `aac`, `flac`, `pcm`, and `wav`.
33-
34-
The `pcm` audio format, similar to `wav` but without a header, utilizes a 24kHz
35-
sample rate, mono channel, and 16-bit depth in signed little-endian format.
32+
Supported formats are `mp3`, `opus`, `aac`, `flac`, `wav`, and `pcm`.
3633
"""
3734

3835
speed: float

Diff for: src/openai/types/audio/transcription.py

+1
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@
77

88
class Transcription(BaseModel):
99
text: str
10+
"""The transcribed text."""

Diff for: src/openai/types/audio/transcription_create_params.py

+9-4
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,11 @@ class TranscriptionCreateParams(TypedDict, total=False):
1818
"""
1919

2020
model: Required[Union[str, Literal["whisper-1"]]]
21-
"""ID of the model to use. Only `whisper-1` is currently available."""
21+
"""ID of the model to use.
22+
23+
Only `whisper-1` (which is powered by our open source Whisper V2 model) is
24+
currently available.
25+
"""
2226

2327
language: str
2428
"""The language of the input audio.
@@ -54,7 +58,8 @@ class TranscriptionCreateParams(TypedDict, total=False):
5458
timestamp_granularities: List[Literal["word", "segment"]]
5559
"""The timestamp granularities to populate for this transcription.
5660
57-
Any of these options: `word`, or `segment`. Note: There is no additional latency
58-
for segment timestamps, but generating word timestamps incurs additional
59-
latency.
61+
`response_format` must be set `verbose_json` to use timestamp granularities.
62+
Either or both of these options are supported: `word`, or `segment`. Note: There
63+
is no additional latency for segment timestamps, but generating word timestamps
64+
incurs additional latency.
6065
"""

Diff for: src/openai/types/audio/translation_create_params.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,11 @@ class TranslationCreateParams(TypedDict, total=False):
1818
"""
1919

2020
model: Required[Union[str, Literal["whisper-1"]]]
21-
"""ID of the model to use. Only `whisper-1` is currently available."""
21+
"""ID of the model to use.
22+
23+
Only `whisper-1` (which is powered by our open source Whisper V2 model) is
24+
currently available.
25+
"""
2226

2327
prompt: str
2428
"""An optional text to guide the model's style or continue a previous audio

Diff for: src/openai/types/beta/threads/run.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@
2222

2323

2424
class LastError(BaseModel):
25-
code: Literal["server_error", "rate_limit_exceeded"]
26-
"""One of `server_error` or `rate_limit_exceeded`."""
25+
code: Literal["server_error", "rate_limit_exceeded", "invalid_prompt"]
26+
"""One of `server_error`, `rate_limit_exceeded`, or `invalid_prompt`."""
2727

2828
message: str
2929
"""A human-readable description of the error."""

Diff for: src/openai/types/chat/chat_completion_token_logprob.py

+12-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,12 @@ class TopLogprob(BaseModel):
2020
"""
2121

2222
logprob: float
23-
"""The log probability of this token."""
23+
"""The log probability of this token, if it is within the top 20 most likely
24+
tokens.
25+
26+
Otherwise, the value `-9999.0` is used to signify that the token is very
27+
unlikely.
28+
"""
2429

2530

2631
class ChatCompletionTokenLogprob(BaseModel):
@@ -36,7 +41,12 @@ class ChatCompletionTokenLogprob(BaseModel):
3641
"""
3742

3843
logprob: float
39-
"""The log probability of this token."""
44+
"""The log probability of this token, if it is within the top 20 most likely
45+
tokens.
46+
47+
Otherwise, the value `-9999.0` is used to signify that the token is very
48+
unlikely.
49+
"""
4050

4151
top_logprobs: List[TopLogprob]
4252
"""List of the most likely tokens and their log probability, at this token

Diff for: src/openai/types/chat/completion_create_params.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -195,9 +195,9 @@ class CompletionCreateParamsBase(TypedDict, total=False):
195195

196196
top_logprobs: Optional[int]
197197
"""
198-
An integer between 0 and 5 specifying the number of most likely tokens to return
199-
at each token position, each with an associated log probability. `logprobs` must
200-
be set to `true` if this parameter is used.
198+
An integer between 0 and 20 specifying the number of most likely tokens to
199+
return at each token position, each with an associated log probability.
200+
`logprobs` must be set to `true` if this parameter is used.
201201
"""
202202

203203
top_p: Optional[float]

0 commit comments

Comments
 (0)