Skip to content

Commit fdd5247

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

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

+710
-371
lines changed

.stats.yml

+1-1
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

+1
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

+4-4
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,8 @@ def create(
138138
Whisper V2 model) is currently available.
139139
140140
language: The language of the input audio. Supplying the input language in
141-
[ISO-639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) format will
142-
improve accuracy and latency.
141+
[ISO-639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) (e.g. `en`)
142+
format will improve accuracy and latency.
143143
144144
prompt: An optional text to guide the model's style or continue a previous audio
145145
segment. The
@@ -302,8 +302,8 @@ async def create(
302302
Whisper V2 model) is currently available.
303303
304304
language: The language of the input audio. Supplying the input language in
305-
[ISO-639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) format will
306-
improve accuracy and latency.
305+
[ISO-639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) (e.g. `en`)
306+
format will improve accuracy and latency.
307307
308308
prompt: An optional text to guide the model's style or continue a previous audio
309309
segment. The

src/openai/resources/batches.py

+17-9
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
@@ -19,10 +19,8 @@
1919
from .._response import to_streamed_response_wrapper, async_to_streamed_response_wrapper
2020
from ..pagination import SyncCursorPage, AsyncCursorPage
2121
from ..types.batch import Batch
22-
from .._base_client import (
23-
AsyncPaginator,
24-
make_request_options,
25-
)
22+
from .._base_client import AsyncPaginator, make_request_options
23+
from ..types.shared_params.metadata import Metadata
2624

2725
__all__ = ["Batches", "AsyncBatches"]
2826

@@ -53,7 +51,7 @@ def create(
5351
completion_window: Literal["24h"],
5452
endpoint: Literal["/v1/chat/completions", "/v1/embeddings", "/v1/completions"],
5553
input_file_id: str,
56-
metadata: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN,
54+
metadata: Optional[Metadata] | NotGiven = NOT_GIVEN,
5755
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
5856
# The extra values given here take precedence over values defined on the client or passed to this method.
5957
extra_headers: Headers | None = None,
@@ -83,7 +81,12 @@ def create(
8381
and must be uploaded with the purpose `batch`. The file can contain up to 50,000
8482
requests, and can be up to 200 MB in size.
8583
86-
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.
8790
8891
extra_headers: Send extra headers
8992
@@ -258,7 +261,7 @@ async def create(
258261
completion_window: Literal["24h"],
259262
endpoint: Literal["/v1/chat/completions", "/v1/embeddings", "/v1/completions"],
260263
input_file_id: str,
261-
metadata: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN,
264+
metadata: Optional[Metadata] | NotGiven = NOT_GIVEN,
262265
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
263266
# The extra values given here take precedence over values defined on the client or passed to this method.
264267
extra_headers: Headers | None = None,
@@ -288,7 +291,12 @@ async def create(
288291
and must be uploaded with the purpose `batch`. The file can contain up to 50,000
289292
requests, and can be up to 200 MB in size.
290293
291-
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.
292300
293301
extra_headers: Send extra headers
294302

src/openai/resources/beta/assistants.py

+25-16
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

+10-4
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

+25-16
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
)
2424
from ....types.beta.threads import message_list_params, message_create_params, message_update_params
2525
from ....types.beta.threads.message import Message
26+
from ....types.shared_params.metadata import Metadata
2627
from ....types.beta.threads.message_deleted import MessageDeleted
2728
from ....types.beta.threads.message_content_part_param import MessageContentPartParam
2829

@@ -56,7 +57,7 @@ def create(
5657
content: Union[str, Iterable[MessageContentPartParam]],
5758
role: Literal["user", "assistant"],
5859
attachments: Optional[Iterable[message_create_params.Attachment]] | NotGiven = NOT_GIVEN,
59-
metadata: Optional[object] | NotGiven = NOT_GIVEN,
60+
metadata: Optional[Metadata] | NotGiven = NOT_GIVEN,
6061
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
6162
# The extra values given here take precedence over values defined on the client or passed to this method.
6263
extra_headers: Headers | None = None,
@@ -81,9 +82,11 @@ def create(
8182
attachments: A list of files attached to the message, and the tools they should be added to.
8283
8384
metadata: Set of 16 key-value pairs that can be attached to an object. This can be useful
84-
for storing additional information about the object in a structured format. Keys
85-
can be a maximum of 64 characters long and values can be a maximum of 512
86-
characters long.
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.
8790
8891
extra_headers: Send extra headers
8992
@@ -155,7 +158,7 @@ def update(
155158
message_id: str,
156159
*,
157160
thread_id: str,
158-
metadata: Optional[object] | NotGiven = NOT_GIVEN,
161+
metadata: Optional[Metadata] | NotGiven = NOT_GIVEN,
159162
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
160163
# The extra values given here take precedence over values defined on the client or passed to this method.
161164
extra_headers: Headers | None = None,
@@ -168,9 +171,11 @@ def update(
168171
169172
Args:
170173
metadata: Set of 16 key-value pairs that can be attached to an object. This can be useful
171-
for storing additional information about the object in a structured format. Keys
172-
can be a maximum of 64 characters long and values can be a maximum of 512
173-
characters long.
174+
for storing additional information about the object in a structured format, and
175+
querying for objects via API or the dashboard.
176+
177+
Keys are strings with a maximum length of 64 characters. Values are strings with
178+
a maximum length of 512 characters.
174179
175180
extra_headers: Send extra headers
176181
@@ -330,7 +335,7 @@ async def create(
330335
content: Union[str, Iterable[MessageContentPartParam]],
331336
role: Literal["user", "assistant"],
332337
attachments: Optional[Iterable[message_create_params.Attachment]] | NotGiven = NOT_GIVEN,
333-
metadata: Optional[object] | NotGiven = NOT_GIVEN,
338+
metadata: Optional[Metadata] | NotGiven = NOT_GIVEN,
334339
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
335340
# The extra values given here take precedence over values defined on the client or passed to this method.
336341
extra_headers: Headers | None = None,
@@ -355,9 +360,11 @@ async def create(
355360
attachments: A list of files attached to the message, and the tools they should be added to.
356361
357362
metadata: Set of 16 key-value pairs that can be attached to an object. This can be useful
358-
for storing additional information about the object in a structured format. Keys
359-
can be a maximum of 64 characters long and values can be a maximum of 512
360-
characters long.
363+
for storing additional information about the object in a structured format, and
364+
querying for objects via API or the dashboard.
365+
366+
Keys are strings with a maximum length of 64 characters. Values are strings with
367+
a maximum length of 512 characters.
361368
362369
extra_headers: Send extra headers
363370
@@ -429,7 +436,7 @@ async def update(
429436
message_id: str,
430437
*,
431438
thread_id: str,
432-
metadata: Optional[object] | NotGiven = NOT_GIVEN,
439+
metadata: Optional[Metadata] | NotGiven = NOT_GIVEN,
433440
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
434441
# The extra values given here take precedence over values defined on the client or passed to this method.
435442
extra_headers: Headers | None = None,
@@ -442,9 +449,11 @@ async def update(
442449
443450
Args:
444451
metadata: Set of 16 key-value pairs that can be attached to an object. This can be useful
445-
for storing additional information about the object in a structured format. Keys
446-
can be a maximum of 64 characters long and values can be a maximum of 512
447-
characters long.
452+
for storing additional information about the object in a structured format, and
453+
querying for objects via API or the dashboard.
454+
455+
Keys are strings with a maximum length of 64 characters. Values are strings with
456+
a maximum length of 512 characters.
448457
449458
extra_headers: Send extra headers
450459

0 commit comments

Comments
 (0)