Skip to content

Commit f394685

Browse files
feat(api): add o3-mini (#2067)
fix(types): correct metadata type + other fixes
1 parent 01c5ec6 commit f394685

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+695
-353
lines changed

.stats.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
configured_endpoints: 69
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai-3904ef6b29a89c98f93a9b7da19879695f3c440564be6384db7af1b734611ede.yml
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai-6204952a29973265b9c0d66fc67ffaf53c6a90ae4d75cdacf9d147676f5274c9.yml

api.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ from openai.types import (
55
ErrorObject,
66
FunctionDefinition,
77
FunctionParameters,
8+
Metadata,
89
ResponseFormatJSONObject,
910
ResponseFormatJSONSchema,
1011
ResponseFormatText,

src/openai/resources/audio/transcriptions.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,8 @@ def create(
7777
Whisper V2 model) is currently available.
7878
7979
language: The language of the input audio. Supplying the input language in
80-
[ISO-639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) format will
81-
improve accuracy and latency.
80+
[ISO-639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) (e.g. `en`)
81+
format will improve accuracy and latency.
8282
8383
prompt: An optional text to guide the model's style or continue a previous audio
8484
segment. The
@@ -189,8 +189,8 @@ async def create(
189189
Whisper V2 model) is currently available.
190190
191191
language: The language of the input audio. Supplying the input language in
192-
[ISO-639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) format will
193-
improve accuracy and latency.
192+
[ISO-639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) (e.g. `en`)
193+
format will improve accuracy and latency.
194194
195195
prompt: An optional text to guide the model's style or continue a previous audio
196196
segment. The

src/openai/resources/batches.py

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from __future__ import annotations
44

5-
from typing import Dict, Optional
5+
from typing import Optional
66
from typing_extensions import Literal
77

88
import httpx
@@ -20,6 +20,7 @@
2020
from ..pagination import SyncCursorPage, AsyncCursorPage
2121
from ..types.batch import Batch
2222
from .._base_client import AsyncPaginator, make_request_options
23+
from ..types.shared_params.metadata import Metadata
2324

2425
__all__ = ["Batches", "AsyncBatches"]
2526

@@ -50,7 +51,7 @@ def create(
5051
completion_window: Literal["24h"],
5152
endpoint: Literal["/v1/chat/completions", "/v1/embeddings", "/v1/completions"],
5253
input_file_id: str,
53-
metadata: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN,
54+
metadata: Optional[Metadata] | NotGiven = NOT_GIVEN,
5455
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
5556
# The extra values given here take precedence over values defined on the client or passed to this method.
5657
extra_headers: Headers | None = None,
@@ -80,7 +81,12 @@ def create(
8081
and must be uploaded with the purpose `batch`. The file can contain up to 50,000
8182
requests, and can be up to 200 MB in size.
8283
83-
metadata: Optional custom metadata for the batch.
84+
metadata: Set of 16 key-value pairs that can be attached to an object. This can be useful
85+
for storing additional information about the object in a structured format, and
86+
querying for objects via API or the dashboard.
87+
88+
Keys are strings with a maximum length of 64 characters. Values are strings with
89+
a maximum length of 512 characters.
8490
8591
extra_headers: Send extra headers
8692
@@ -255,7 +261,7 @@ async def create(
255261
completion_window: Literal["24h"],
256262
endpoint: Literal["/v1/chat/completions", "/v1/embeddings", "/v1/completions"],
257263
input_file_id: str,
258-
metadata: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN,
264+
metadata: Optional[Metadata] | NotGiven = NOT_GIVEN,
259265
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
260266
# The extra values given here take precedence over values defined on the client or passed to this method.
261267
extra_headers: Headers | None = None,
@@ -285,7 +291,12 @@ async def create(
285291
and must be uploaded with the purpose `batch`. The file can contain up to 50,000
286292
requests, and can be up to 200 MB in size.
287293
288-
metadata: Optional custom metadata for the batch.
294+
metadata: Set of 16 key-value pairs that can be attached to an object. This can be useful
295+
for storing additional information about the object in a structured format, and
296+
querying for objects via API or the dashboard.
297+
298+
Keys are strings with a maximum length of 64 characters. Values are strings with
299+
a maximum length of 512 characters.
289300
290301
extra_headers: Send extra headers
291302

src/openai/resources/beta/assistants.py

Lines changed: 25 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
from ...types.chat_model import ChatModel
2727
from ...types.beta.assistant import Assistant
2828
from ...types.beta.assistant_deleted import AssistantDeleted
29+
from ...types.shared_params.metadata import Metadata
2930
from ...types.beta.assistant_tool_param import AssistantToolParam
3031
from ...types.beta.assistant_response_format_option_param import AssistantResponseFormatOptionParam
3132

@@ -58,7 +59,7 @@ def create(
5859
model: Union[str, ChatModel],
5960
description: Optional[str] | NotGiven = NOT_GIVEN,
6061
instructions: Optional[str] | NotGiven = NOT_GIVEN,
61-
metadata: Optional[object] | NotGiven = NOT_GIVEN,
62+
metadata: Optional[Metadata] | NotGiven = NOT_GIVEN,
6263
name: Optional[str] | NotGiven = NOT_GIVEN,
6364
response_format: Optional[AssistantResponseFormatOptionParam] | NotGiven = NOT_GIVEN,
6465
temperature: Optional[float] | NotGiven = NOT_GIVEN,
@@ -88,9 +89,11 @@ def create(
8889
characters.
8990
9091
metadata: Set of 16 key-value pairs that can be attached to an object. This can be useful
91-
for storing additional information about the object in a structured format. Keys
92-
can be a maximum of 64 characters long and values can be a maximum of 512
93-
characters long.
92+
for storing additional information about the object in a structured format, and
93+
querying for objects via API or the dashboard.
94+
95+
Keys are strings with a maximum length of 64 characters. Values are strings with
96+
a maximum length of 512 characters.
9497
9598
name: The name of the assistant. The maximum length is 256 characters.
9699
@@ -206,7 +209,7 @@ def update(
206209
*,
207210
description: Optional[str] | NotGiven = NOT_GIVEN,
208211
instructions: Optional[str] | NotGiven = NOT_GIVEN,
209-
metadata: Optional[object] | NotGiven = NOT_GIVEN,
212+
metadata: Optional[Metadata] | NotGiven = NOT_GIVEN,
210213
model: str | NotGiven = NOT_GIVEN,
211214
name: Optional[str] | NotGiven = NOT_GIVEN,
212215
response_format: Optional[AssistantResponseFormatOptionParam] | NotGiven = NOT_GIVEN,
@@ -232,9 +235,11 @@ def update(
232235
characters.
233236
234237
metadata: Set of 16 key-value pairs that can be attached to an object. This can be useful
235-
for storing additional information about the object in a structured format. Keys
236-
can be a maximum of 64 characters long and values can be a maximum of 512
237-
characters long.
238+
for storing additional information about the object in a structured format, and
239+
querying for objects via API or the dashboard.
240+
241+
Keys are strings with a maximum length of 64 characters. Values are strings with
242+
a maximum length of 512 characters.
238243
239244
model: ID of the model to use. You can use the
240245
[List models](https://platform.openai.com/docs/api-reference/models/list) API to
@@ -444,7 +449,7 @@ async def create(
444449
model: Union[str, ChatModel],
445450
description: Optional[str] | NotGiven = NOT_GIVEN,
446451
instructions: Optional[str] | NotGiven = NOT_GIVEN,
447-
metadata: Optional[object] | NotGiven = NOT_GIVEN,
452+
metadata: Optional[Metadata] | NotGiven = NOT_GIVEN,
448453
name: Optional[str] | NotGiven = NOT_GIVEN,
449454
response_format: Optional[AssistantResponseFormatOptionParam] | NotGiven = NOT_GIVEN,
450455
temperature: Optional[float] | NotGiven = NOT_GIVEN,
@@ -474,9 +479,11 @@ async def create(
474479
characters.
475480
476481
metadata: Set of 16 key-value pairs that can be attached to an object. This can be useful
477-
for storing additional information about the object in a structured format. Keys
478-
can be a maximum of 64 characters long and values can be a maximum of 512
479-
characters long.
482+
for storing additional information about the object in a structured format, and
483+
querying for objects via API or the dashboard.
484+
485+
Keys are strings with a maximum length of 64 characters. Values are strings with
486+
a maximum length of 512 characters.
480487
481488
name: The name of the assistant. The maximum length is 256 characters.
482489
@@ -592,7 +599,7 @@ async def update(
592599
*,
593600
description: Optional[str] | NotGiven = NOT_GIVEN,
594601
instructions: Optional[str] | NotGiven = NOT_GIVEN,
595-
metadata: Optional[object] | NotGiven = NOT_GIVEN,
602+
metadata: Optional[Metadata] | NotGiven = NOT_GIVEN,
596603
model: str | NotGiven = NOT_GIVEN,
597604
name: Optional[str] | NotGiven = NOT_GIVEN,
598605
response_format: Optional[AssistantResponseFormatOptionParam] | NotGiven = NOT_GIVEN,
@@ -618,9 +625,11 @@ async def update(
618625
characters.
619626
620627
metadata: Set of 16 key-value pairs that can be attached to an object. This can be useful
621-
for storing additional information about the object in a structured format. Keys
622-
can be a maximum of 64 characters long and values can be a maximum of 512
623-
characters long.
628+
for storing additional information about the object in a structured format, and
629+
querying for objects via API or the dashboard.
630+
631+
Keys are strings with a maximum length of 64 characters. Values are strings with
632+
a maximum length of 512 characters.
624633
625634
model: ID of the model to use. You can use the
626635
[List models](https://platform.openai.com/docs/api-reference/models/list) API to

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

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,11 @@ def create(
8989
input_audio_transcription: Configuration for input audio transcription, defaults to off and can be set to
9090
`null` to turn off once on. Input audio transcription is not native to the
9191
model, since the model consumes audio directly. Transcription runs
92-
asynchronously through Whisper and should be treated as rough guidance rather
93-
than the representation understood by the model.
92+
asynchronously through
93+
[OpenAI Whisper transcription](https://platform.openai.com/docs/api-reference/audio/createTranscription)
94+
and should be treated as rough guidance rather than the representation
95+
understood by the model. The client can optionally set the language and prompt
96+
for transcription, these fields will be passed to the Whisper API.
9497
9598
instructions: The default system instructions (i.e. system message) prepended to model calls.
9699
This field allows the client to guide the model on desired responses. The model
@@ -232,8 +235,11 @@ async def create(
232235
input_audio_transcription: Configuration for input audio transcription, defaults to off and can be set to
233236
`null` to turn off once on. Input audio transcription is not native to the
234237
model, since the model consumes audio directly. Transcription runs
235-
asynchronously through Whisper and should be treated as rough guidance rather
236-
than the representation understood by the model.
238+
asynchronously through
239+
[OpenAI Whisper transcription](https://platform.openai.com/docs/api-reference/audio/createTranscription)
240+
and should be treated as rough guidance rather than the representation
241+
understood by the model. The client can optionally set the language and prompt
242+
for transcription, these fields will be passed to the Whisper API.
237243
238244
instructions: The default system instructions (i.e. system message) prepended to model calls.
239245
This field allows the client to guide the model on desired responses. The model

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

Lines changed: 25 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
from ...._base_client import AsyncPaginator, make_request_options
2121
from ....types.beta.threads import message_list_params, message_create_params, message_update_params
2222
from ....types.beta.threads.message import Message
23+
from ....types.shared_params.metadata import Metadata
2324
from ....types.beta.threads.message_deleted import MessageDeleted
2425
from ....types.beta.threads.message_content_part_param import MessageContentPartParam
2526

@@ -53,7 +54,7 @@ def create(
5354
content: Union[str, Iterable[MessageContentPartParam]],
5455
role: Literal["user", "assistant"],
5556
attachments: Optional[Iterable[message_create_params.Attachment]] | NotGiven = NOT_GIVEN,
56-
metadata: Optional[object] | NotGiven = NOT_GIVEN,
57+
metadata: Optional[Metadata] | NotGiven = NOT_GIVEN,
5758
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
5859
# The extra values given here take precedence over values defined on the client or passed to this method.
5960
extra_headers: Headers | None = None,
@@ -78,9 +79,11 @@ def create(
7879
attachments: A list of files attached to the message, and the tools they should be added to.
7980
8081
metadata: Set of 16 key-value pairs that can be attached to an object. This can be useful
81-
for storing additional information about the object in a structured format. Keys
82-
can be a maximum of 64 characters long and values can be a maximum of 512
83-
characters long.
82+
for storing additional information about the object in a structured format, and
83+
querying for objects via API or the dashboard.
84+
85+
Keys are strings with a maximum length of 64 characters. Values are strings with
86+
a maximum length of 512 characters.
8487
8588
extra_headers: Send extra headers
8689
@@ -152,7 +155,7 @@ def update(
152155
message_id: str,
153156
*,
154157
thread_id: str,
155-
metadata: Optional[object] | NotGiven = NOT_GIVEN,
158+
metadata: Optional[Metadata] | NotGiven = NOT_GIVEN,
156159
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
157160
# The extra values given here take precedence over values defined on the client or passed to this method.
158161
extra_headers: Headers | None = None,
@@ -165,9 +168,11 @@ def update(
165168
166169
Args:
167170
metadata: Set of 16 key-value pairs that can be attached to an object. This can be useful
168-
for storing additional information about the object in a structured format. Keys
169-
can be a maximum of 64 characters long and values can be a maximum of 512
170-
characters long.
171+
for storing additional information about the object in a structured format, and
172+
querying for objects via API or the dashboard.
173+
174+
Keys are strings with a maximum length of 64 characters. Values are strings with
175+
a maximum length of 512 characters.
171176
172177
extra_headers: Send extra headers
173178
@@ -327,7 +332,7 @@ async def create(
327332
content: Union[str, Iterable[MessageContentPartParam]],
328333
role: Literal["user", "assistant"],
329334
attachments: Optional[Iterable[message_create_params.Attachment]] | NotGiven = NOT_GIVEN,
330-
metadata: Optional[object] | NotGiven = NOT_GIVEN,
335+
metadata: Optional[Metadata] | NotGiven = NOT_GIVEN,
331336
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
332337
# The extra values given here take precedence over values defined on the client or passed to this method.
333338
extra_headers: Headers | None = None,
@@ -352,9 +357,11 @@ async def create(
352357
attachments: A list of files attached to the message, and the tools they should be added to.
353358
354359
metadata: Set of 16 key-value pairs that can be attached to an object. This can be useful
355-
for storing additional information about the object in a structured format. Keys
356-
can be a maximum of 64 characters long and values can be a maximum of 512
357-
characters long.
360+
for storing additional information about the object in a structured format, and
361+
querying for objects via API or the dashboard.
362+
363+
Keys are strings with a maximum length of 64 characters. Values are strings with
364+
a maximum length of 512 characters.
358365
359366
extra_headers: Send extra headers
360367
@@ -426,7 +433,7 @@ async def update(
426433
message_id: str,
427434
*,
428435
thread_id: str,
429-
metadata: Optional[object] | NotGiven = NOT_GIVEN,
436+
metadata: Optional[Metadata] | NotGiven = NOT_GIVEN,
430437
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
431438
# The extra values given here take precedence over values defined on the client or passed to this method.
432439
extra_headers: Headers | None = None,
@@ -439,9 +446,11 @@ async def update(
439446
440447
Args:
441448
metadata: Set of 16 key-value pairs that can be attached to an object. This can be useful
442-
for storing additional information about the object in a structured format. Keys
443-
can be a maximum of 64 characters long and values can be a maximum of 512
444-
characters long.
449+
for storing additional information about the object in a structured format, and
450+
querying for objects via API or the dashboard.
451+
452+
Keys are strings with a maximum length of 64 characters. Values are strings with
453+
a maximum length of 512 characters.
445454
446455
extra_headers: Send extra headers
447456

0 commit comments

Comments
 (0)