Skip to content

Commit 5047206

Browse files
docs(api): enhance method descriptions across audio, chat, realtime, skills, uploads, videos
1 parent 3e0c05b commit 5047206

16 files changed

Lines changed: 184 additions & 62 deletions

File tree

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 148
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-0db5326a0fb6a30ffad9242c72872c3388ef927e8a4549ddd20aec3420541209.yml
3-
openapi_spec_hash: 9523fe30739802e15c88f4e7aac44e7f
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-c20486f46004d6be2d280d7792c64d47fcea3e5b7fbbb50d3ffc6241aba653df.yml
3+
openapi_spec_hash: bf1dbabc5a923d897309273183525c02
44
config_hash: 948733484caf41e71093c6582dbc319c

src/openai/resources/audio/speech.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@ def create(
6767
"""
6868
Generates audio from the input text.
6969
70+
Returns the audio file content, or a stream of audio events.
71+
7072
Args:
7173
input: The text to generate audio for. The maximum length is 4096 characters.
7274
@@ -164,6 +166,8 @@ async def create(
164166
"""
165167
Generates audio from the input text.
166168
169+
Returns the audio file content, or a stream of audio events.
170+
167171
Args:
168172
input: The text to generate audio for. The maximum length is 4096 characters.
169173

src/openai/resources/audio/transcriptions.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,9 @@ def create(
8585
"""
8686
Transcribes audio into the input language.
8787
88+
Returns a transcription object in `json`, `diarized_json`, or `verbose_json`
89+
format, or a stream of transcript events.
90+
8891
Args:
8992
file:
9093
The audio file object (not file name) to transcribe, in one of these formats:
@@ -235,6 +238,9 @@ def create(
235238
"""
236239
Transcribes audio into the input language.
237240
241+
Returns a transcription object in `json`, `diarized_json`, or `verbose_json`
242+
format, or a stream of transcript events.
243+
238244
Args:
239245
file:
240246
The audio file object (not file name) to transcribe, in one of these formats:
@@ -343,6 +349,9 @@ def create(
343349
"""
344350
Transcribes audio into the input language.
345351
352+
Returns a transcription object in `json`, `diarized_json`, or `verbose_json`
353+
format, or a stream of transcript events.
354+
346355
Args:
347356
file:
348357
The audio file object (not file name) to transcribe, in one of these formats:
@@ -533,6 +542,9 @@ async def create(
533542
"""
534543
Transcribes audio into the input language.
535544
545+
Returns a transcription object in `json`, `diarized_json`, or `verbose_json`
546+
format, or a stream of transcript events.
547+
536548
Args:
537549
file:
538550
The audio file object (not file name) to transcribe, in one of these formats:
@@ -678,6 +690,9 @@ async def create(
678690
"""
679691
Transcribes audio into the input language.
680692
693+
Returns a transcription object in `json`, `diarized_json`, or `verbose_json`
694+
format, or a stream of transcript events.
695+
681696
Args:
682697
file:
683698
The audio file object (not file name) to transcribe, in one of these formats:
@@ -786,6 +801,9 @@ async def create(
786801
"""
787802
Transcribes audio into the input language.
788803
804+
Returns a transcription object in `json`, `diarized_json`, or `verbose_json`
805+
format, or a stream of transcript events.
806+
789807
Args:
790808
file:
791809
The audio file object (not file name) to transcribe, in one of these formats:

src/openai/resources/beta/chatkit/sessions.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ def create(
6363
timeout: float | httpx.Timeout | None | NotGiven = not_given,
6464
) -> ChatSession:
6565
"""
66-
Create a ChatKit session
66+
Create a ChatKit session.
6767
6868
Args:
6969
user: A free-form string that identifies your end user; ensures this Session can
@@ -117,7 +117,9 @@ def cancel(
117117
timeout: float | httpx.Timeout | None | NotGiven = not_given,
118118
) -> ChatSession:
119119
"""
120-
Cancel a ChatKit session
120+
Cancel an active ChatKit session and return its most recent metadata.
121+
122+
Cancelling prevents new requests from using the issued client secret.
121123
122124
Args:
123125
extra_headers: Send extra headers
@@ -176,7 +178,7 @@ async def create(
176178
timeout: float | httpx.Timeout | None | NotGiven = not_given,
177179
) -> ChatSession:
178180
"""
179-
Create a ChatKit session
181+
Create a ChatKit session.
180182
181183
Args:
182184
user: A free-form string that identifies your end user; ensures this Session can
@@ -230,7 +232,9 @@ async def cancel(
230232
timeout: float | httpx.Timeout | None | NotGiven = not_given,
231233
) -> ChatSession:
232234
"""
233-
Cancel a ChatKit session
235+
Cancel an active ChatKit session and return its most recent metadata.
236+
237+
Cancelling prevents new requests from using the issued client secret.
234238
235239
Args:
236240
extra_headers: Send extra headers

src/openai/resources/beta/chatkit/threads.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def retrieve(
5555
timeout: float | httpx.Timeout | None | NotGiven = not_given,
5656
) -> ChatKitThread:
5757
"""
58-
Retrieve a ChatKit thread
58+
Retrieve a ChatKit thread by its identifier.
5959
6060
Args:
6161
extra_headers: Send extra headers
@@ -93,7 +93,7 @@ def list(
9393
timeout: float | httpx.Timeout | None | NotGiven = not_given,
9494
) -> SyncConversationCursorPage[ChatKitThread]:
9595
"""
96-
List ChatKit threads
96+
List ChatKit threads with optional pagination and user filters.
9797
9898
Args:
9999
after: List items created after this thread item ID. Defaults to null for the first
@@ -152,7 +152,7 @@ def delete(
152152
timeout: float | httpx.Timeout | None | NotGiven = not_given,
153153
) -> ThreadDeleteResponse:
154154
"""
155-
Delete a ChatKit thread
155+
Delete a ChatKit thread along with its items and stored attachments.
156156
157157
Args:
158158
extra_headers: Send extra headers
@@ -190,7 +190,7 @@ def list_items(
190190
timeout: float | httpx.Timeout | None | NotGiven = not_given,
191191
) -> SyncConversationCursorPage[Data]:
192192
"""
193-
List ChatKit thread items
193+
List items that belong to a ChatKit thread.
194194
195195
Args:
196196
after: List items created after this thread item ID. Defaults to null for the first
@@ -268,7 +268,7 @@ async def retrieve(
268268
timeout: float | httpx.Timeout | None | NotGiven = not_given,
269269
) -> ChatKitThread:
270270
"""
271-
Retrieve a ChatKit thread
271+
Retrieve a ChatKit thread by its identifier.
272272
273273
Args:
274274
extra_headers: Send extra headers
@@ -306,7 +306,7 @@ def list(
306306
timeout: float | httpx.Timeout | None | NotGiven = not_given,
307307
) -> AsyncPaginator[ChatKitThread, AsyncConversationCursorPage[ChatKitThread]]:
308308
"""
309-
List ChatKit threads
309+
List ChatKit threads with optional pagination and user filters.
310310
311311
Args:
312312
after: List items created after this thread item ID. Defaults to null for the first
@@ -365,7 +365,7 @@ async def delete(
365365
timeout: float | httpx.Timeout | None | NotGiven = not_given,
366366
) -> ThreadDeleteResponse:
367367
"""
368-
Delete a ChatKit thread
368+
Delete a ChatKit thread along with its items and stored attachments.
369369
370370
Args:
371371
extra_headers: Send extra headers
@@ -403,7 +403,7 @@ def list_items(
403403
timeout: float | httpx.Timeout | None | NotGiven = not_given,
404404
) -> AsyncPaginator[Data, AsyncConversationCursorPage[Data]]:
405405
"""
406-
List ChatKit thread items
406+
List items that belong to a ChatKit thread.
407407
408408
Args:
409409
after: List items created after this thread item ID. Defaults to null for the first

src/openai/resources/chat/completions/completions.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,9 @@ def create(
301301
unsupported parameters in reasoning models,
302302
[refer to the reasoning guide](https://platform.openai.com/docs/guides/reasoning).
303303
304+
Returns a chat completion object, or a streamed sequence of chat completion
305+
chunk objects if the request is streamed.
306+
304307
Args:
305308
messages: A list of messages comprising the conversation so far. Depending on the
306309
[model](https://platform.openai.com/docs/models) you use, different message
@@ -603,6 +606,9 @@ def create(
603606
unsupported parameters in reasoning models,
604607
[refer to the reasoning guide](https://platform.openai.com/docs/guides/reasoning).
605608
609+
Returns a chat completion object, or a streamed sequence of chat completion
610+
chunk objects if the request is streamed.
611+
606612
Args:
607613
messages: A list of messages comprising the conversation so far. Depending on the
608614
[model](https://platform.openai.com/docs/models) you use, different message
@@ -905,6 +911,9 @@ def create(
905911
unsupported parameters in reasoning models,
906912
[refer to the reasoning guide](https://platform.openai.com/docs/guides/reasoning).
907913
914+
Returns a chat completion object, or a streamed sequence of chat completion
915+
chunk objects if the request is streamed.
916+
908917
Args:
909918
messages: A list of messages comprising the conversation so far. Depending on the
910919
[model](https://platform.openai.com/docs/models) you use, different message
@@ -1785,6 +1794,9 @@ async def create(
17851794
unsupported parameters in reasoning models,
17861795
[refer to the reasoning guide](https://platform.openai.com/docs/guides/reasoning).
17871796
1797+
Returns a chat completion object, or a streamed sequence of chat completion
1798+
chunk objects if the request is streamed.
1799+
17881800
Args:
17891801
messages: A list of messages comprising the conversation so far. Depending on the
17901802
[model](https://platform.openai.com/docs/models) you use, different message
@@ -2087,6 +2099,9 @@ async def create(
20872099
unsupported parameters in reasoning models,
20882100
[refer to the reasoning guide](https://platform.openai.com/docs/guides/reasoning).
20892101
2102+
Returns a chat completion object, or a streamed sequence of chat completion
2103+
chunk objects if the request is streamed.
2104+
20902105
Args:
20912106
messages: A list of messages comprising the conversation so far. Depending on the
20922107
[model](https://platform.openai.com/docs/models) you use, different message
@@ -2389,6 +2404,9 @@ async def create(
23892404
unsupported parameters in reasoning models,
23902405
[refer to the reasoning guide](https://platform.openai.com/docs/guides/reasoning).
23912406
2407+
Returns a chat completion object, or a streamed sequence of chat completion
2408+
chunk objects if the request is streamed.
2409+
23922410
Args:
23932411
messages: A list of messages comprising the conversation so far. Depending on the
23942412
[model](https://platform.openai.com/docs/models) you use, different message

src/openai/resources/completions.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,9 @@ def create(
7676
"""
7777
Creates a completion for the provided prompt and parameters.
7878
79+
Returns a completion object, or a sequence of completion objects if the request
80+
is streamed.
81+
7982
Args:
8083
model: ID of the model to use. You can use the
8184
[List models](https://platform.openai.com/docs/api-reference/models/list) API to
@@ -231,6 +234,9 @@ def create(
231234
"""
232235
Creates a completion for the provided prompt and parameters.
233236
237+
Returns a completion object, or a sequence of completion objects if the request
238+
is streamed.
239+
234240
Args:
235241
model: ID of the model to use. You can use the
236242
[List models](https://platform.openai.com/docs/api-reference/models/list) API to
@@ -386,6 +392,9 @@ def create(
386392
"""
387393
Creates a completion for the provided prompt and parameters.
388394
395+
Returns a completion object, or a sequence of completion objects if the request
396+
is streamed.
397+
389398
Args:
390399
model: ID of the model to use. You can use the
391400
[List models](https://platform.openai.com/docs/api-reference/models/list) API to
@@ -626,6 +635,9 @@ async def create(
626635
"""
627636
Creates a completion for the provided prompt and parameters.
628637
638+
Returns a completion object, or a sequence of completion objects if the request
639+
is streamed.
640+
629641
Args:
630642
model: ID of the model to use. You can use the
631643
[List models](https://platform.openai.com/docs/api-reference/models/list) API to
@@ -781,6 +793,9 @@ async def create(
781793
"""
782794
Creates a completion for the provided prompt and parameters.
783795
796+
Returns a completion object, or a sequence of completion objects if the request
797+
is streamed.
798+
784799
Args:
785800
model: ID of the model to use. You can use the
786801
[List models](https://platform.openai.com/docs/api-reference/models/list) API to
@@ -936,6 +951,9 @@ async def create(
936951
"""
937952
Creates a completion for the provided prompt and parameters.
938953
954+
Returns a completion object, or a sequence of completion objects if the request
955+
is streamed.
956+
939957
Args:
940958
model: ID of the model to use. You can use the
941959
[List models](https://platform.openai.com/docs/api-reference/models/list) API to

src/openai/resources/realtime/client_secrets.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,20 @@ def create(
5252
"""
5353
Create a Realtime client secret with an associated session configuration.
5454
55+
Client secrets are short-lived tokens that can be passed to a client app, such
56+
as a web frontend or mobile client, which grants access to the Realtime API
57+
without leaking your main API key. You can configure a custom TTL for each
58+
client secret.
59+
60+
You can also attach session configuration options to the client secret, which
61+
will be applied to any sessions created using that client secret, but these can
62+
also be overridden by the client connection.
63+
64+
[Learn more about authentication with client secrets over WebRTC](https://platform.openai.com/docs/guides/realtime-webrtc).
65+
66+
Returns the created client secret and the effective session object. The client
67+
secret is a string that looks like `ek_1234`.
68+
5569
Args:
5670
expires_after: Configuration for the client secret expiration. Expiration refers to the time
5771
after which a client secret will no longer be valid for creating sessions. The
@@ -120,6 +134,20 @@ async def create(
120134
"""
121135
Create a Realtime client secret with an associated session configuration.
122136
137+
Client secrets are short-lived tokens that can be passed to a client app, such
138+
as a web frontend or mobile client, which grants access to the Realtime API
139+
without leaking your main API key. You can configure a custom TTL for each
140+
client secret.
141+
142+
You can also attach session configuration options to the client secret, which
143+
will be applied to any sessions created using that client secret, but these can
144+
also be overridden by the client connection.
145+
146+
[Learn more about authentication with client secrets over WebRTC](https://platform.openai.com/docs/guides/realtime-webrtc).
147+
148+
Returns the created client secret and the effective session object. The client
149+
secret is a string that looks like `ek_1234`.
150+
123151
Args:
124152
expires_after: Configuration for the client secret expiration. Expiration refers to the time
125153
after which a client secret will no longer be valid for creating sessions. The

src/openai/resources/responses/input_tokens.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,10 @@ def count(
6565
timeout: float | httpx.Timeout | None | NotGiven = not_given,
6666
) -> InputTokenCountResponse:
6767
"""
68-
Get input token counts
68+
Returns input token counts of the request.
69+
70+
Returns an object with `object` set to `response.input_tokens` and an
71+
`input_tokens` count.
6972
7073
Args:
7174
conversation: The conversation that this response belongs to. Items from this conversation are
@@ -188,7 +191,10 @@ async def count(
188191
timeout: float | httpx.Timeout | None | NotGiven = not_given,
189192
) -> InputTokenCountResponse:
190193
"""
191-
Get input token counts
194+
Returns input token counts of the request.
195+
196+
Returns an object with `object` set to `response.input_tokens` and an
197+
`input_tokens` count.
192198
193199
Args:
194200
conversation: The conversation that this response belongs to. Items from this conversation are

0 commit comments

Comments
 (0)