Skip to content

Commit 9c600b0

Browse files
feat(api): updates (#1608)
- This commit removes the `AssistantResponseFormat` type
1 parent e279088 commit 9c600b0

Some content is hidden

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

56 files changed

+524
-154
lines changed

.stats.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
configured_endpoints: 68
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai-b04761ffd2adad3cc19a6dc6fc696ac445878219972f891881a967340fa9a6b0.yml
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai-4097c2f86beb3f3bb021775cd1dfa240e960caf842aeefc2e08da4dc0851ea79.yml

api.md

+11-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
11
# Shared Types
22

33
```python
4-
from openai.types import ErrorObject, FunctionDefinition, FunctionParameters
4+
from openai.types import (
5+
ErrorObject,
6+
FunctionDefinition,
7+
FunctionParameters,
8+
ResponseFormatJSONObject,
9+
ResponseFormatJSONSchema,
10+
ResponseFormatText,
11+
)
512
```
613

714
# Completions
@@ -35,6 +42,7 @@ from openai.types.chat import (
3542
ChatCompletionChunk,
3643
ChatCompletionContentPart,
3744
ChatCompletionContentPartImage,
45+
ChatCompletionContentPartRefusal,
3846
ChatCompletionContentPartText,
3947
ChatCompletionFunctionCallOption,
4048
ChatCompletionFunctionMessageParam,
@@ -288,7 +296,6 @@ Types:
288296

289297
```python
290298
from openai.types.beta import (
291-
AssistantResponseFormat,
292299
AssistantResponseFormatOption,
293300
AssistantToolChoice,
294301
AssistantToolChoiceFunction,
@@ -381,6 +388,8 @@ from openai.types.beta.threads import (
381388
MessageDeleted,
382389
MessageDelta,
383390
MessageDeltaEvent,
391+
RefusalContentBlock,
392+
RefusalDeltaBlock,
384393
Text,
385394
TextContentBlock,
386395
TextContentBlockParam,

src/openai/_client.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ def __init__(
151151
@property
152152
@override
153153
def qs(self) -> Querystring:
154-
return Querystring(array_format="comma")
154+
return Querystring(array_format="brackets")
155155

156156
@property
157157
@override
@@ -365,7 +365,7 @@ def __init__(
365365
@property
366366
@override
367367
def qs(self) -> Querystring:
368-
return Querystring(array_format="comma")
368+
return Querystring(array_format="brackets")
369369

370370
@property
371371
@override

src/openai/resources/beta/assistants.py

+20
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,11 @@ def create(
8888
[GPT-4 Turbo](https://platform.openai.com/docs/models/gpt-4-turbo-and-gpt-4),
8989
and all GPT-3.5 Turbo models since `gpt-3.5-turbo-1106`.
9090
91+
Setting to `{ "type": "json_schema", "json_schema": {...} }` enables Structured
92+
Outputs which guarantees the model will match your supplied JSON schema. Learn
93+
more in the
94+
[Structured Outputs guide](https://platform.openai.com/docs/guides/structured-outputs).
95+
9196
Setting to `{ "type": "json_object" }` enables JSON mode, which guarantees the
9297
message the model generates is valid JSON.
9398
@@ -233,6 +238,11 @@ def update(
233238
[GPT-4 Turbo](https://platform.openai.com/docs/models/gpt-4-turbo-and-gpt-4),
234239
and all GPT-3.5 Turbo models since `gpt-3.5-turbo-1106`.
235240
241+
Setting to `{ "type": "json_schema", "json_schema": {...} }` enables Structured
242+
Outputs which guarantees the model will match your supplied JSON schema. Learn
243+
more in the
244+
[Structured Outputs guide](https://platform.openai.com/docs/guides/structured-outputs).
245+
236246
Setting to `{ "type": "json_object" }` enables JSON mode, which guarantees the
237247
message the model generates is valid JSON.
238248
@@ -453,6 +463,11 @@ async def create(
453463
[GPT-4 Turbo](https://platform.openai.com/docs/models/gpt-4-turbo-and-gpt-4),
454464
and all GPT-3.5 Turbo models since `gpt-3.5-turbo-1106`.
455465
466+
Setting to `{ "type": "json_schema", "json_schema": {...} }` enables Structured
467+
Outputs which guarantees the model will match your supplied JSON schema. Learn
468+
more in the
469+
[Structured Outputs guide](https://platform.openai.com/docs/guides/structured-outputs).
470+
456471
Setting to `{ "type": "json_object" }` enables JSON mode, which guarantees the
457472
message the model generates is valid JSON.
458473
@@ -598,6 +613,11 @@ async def update(
598613
[GPT-4 Turbo](https://platform.openai.com/docs/models/gpt-4-turbo-and-gpt-4),
599614
and all GPT-3.5 Turbo models since `gpt-3.5-turbo-1106`.
600615
616+
Setting to `{ "type": "json_schema", "json_schema": {...} }` enables Structured
617+
Outputs which guarantees the model will match your supplied JSON schema. Learn
618+
more in the
619+
[Structured Outputs guide](https://platform.openai.com/docs/guides/structured-outputs).
620+
601621
Setting to `{ "type": "json_object" }` enables JSON mode, which guarantees the
602622
message the model generates is valid JSON.
603623

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

+30
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,11 @@ def create(
134134
[GPT-4 Turbo](https://platform.openai.com/docs/models/gpt-4-turbo-and-gpt-4),
135135
and all GPT-3.5 Turbo models since `gpt-3.5-turbo-1106`.
136136
137+
Setting to `{ "type": "json_schema", "json_schema": {...} }` enables Structured
138+
Outputs which guarantees the model will match your supplied JSON schema. Learn
139+
more in the
140+
[Structured Outputs guide](https://platform.openai.com/docs/guides/structured-outputs).
141+
137142
Setting to `{ "type": "json_object" }` enables JSON mode, which guarantees the
138143
message the model generates is valid JSON.
139144
@@ -264,6 +269,11 @@ def create(
264269
[GPT-4 Turbo](https://platform.openai.com/docs/models/gpt-4-turbo-and-gpt-4),
265270
and all GPT-3.5 Turbo models since `gpt-3.5-turbo-1106`.
266271
272+
Setting to `{ "type": "json_schema", "json_schema": {...} }` enables Structured
273+
Outputs which guarantees the model will match your supplied JSON schema. Learn
274+
more in the
275+
[Structured Outputs guide](https://platform.openai.com/docs/guides/structured-outputs).
276+
267277
Setting to `{ "type": "json_object" }` enables JSON mode, which guarantees the
268278
message the model generates is valid JSON.
269279
@@ -390,6 +400,11 @@ def create(
390400
[GPT-4 Turbo](https://platform.openai.com/docs/models/gpt-4-turbo-and-gpt-4),
391401
and all GPT-3.5 Turbo models since `gpt-3.5-turbo-1106`.
392402
403+
Setting to `{ "type": "json_schema", "json_schema": {...} }` enables Structured
404+
Outputs which guarantees the model will match your supplied JSON schema. Learn
405+
more in the
406+
[Structured Outputs guide](https://platform.openai.com/docs/guides/structured-outputs).
407+
393408
Setting to `{ "type": "json_object" }` enables JSON mode, which guarantees the
394409
message the model generates is valid JSON.
395410
@@ -924,6 +939,11 @@ async def create(
924939
[GPT-4 Turbo](https://platform.openai.com/docs/models/gpt-4-turbo-and-gpt-4),
925940
and all GPT-3.5 Turbo models since `gpt-3.5-turbo-1106`.
926941
942+
Setting to `{ "type": "json_schema", "json_schema": {...} }` enables Structured
943+
Outputs which guarantees the model will match your supplied JSON schema. Learn
944+
more in the
945+
[Structured Outputs guide](https://platform.openai.com/docs/guides/structured-outputs).
946+
927947
Setting to `{ "type": "json_object" }` enables JSON mode, which guarantees the
928948
message the model generates is valid JSON.
929949
@@ -1054,6 +1074,11 @@ async def create(
10541074
[GPT-4 Turbo](https://platform.openai.com/docs/models/gpt-4-turbo-and-gpt-4),
10551075
and all GPT-3.5 Turbo models since `gpt-3.5-turbo-1106`.
10561076
1077+
Setting to `{ "type": "json_schema", "json_schema": {...} }` enables Structured
1078+
Outputs which guarantees the model will match your supplied JSON schema. Learn
1079+
more in the
1080+
[Structured Outputs guide](https://platform.openai.com/docs/guides/structured-outputs).
1081+
10571082
Setting to `{ "type": "json_object" }` enables JSON mode, which guarantees the
10581083
message the model generates is valid JSON.
10591084
@@ -1180,6 +1205,11 @@ async def create(
11801205
[GPT-4 Turbo](https://platform.openai.com/docs/models/gpt-4-turbo-and-gpt-4),
11811206
and all GPT-3.5 Turbo models since `gpt-3.5-turbo-1106`.
11821207
1208+
Setting to `{ "type": "json_schema", "json_schema": {...} }` enables Structured
1209+
Outputs which guarantees the model will match your supplied JSON schema. Learn
1210+
more in the
1211+
[Structured Outputs guide](https://platform.openai.com/docs/guides/structured-outputs).
1212+
11831213
Setting to `{ "type": "json_object" }` enables JSON mode, which guarantees the
11841214
message the model generates is valid JSON.
11851215

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

+30
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,11 @@ def create_and_run(
314314
[GPT-4 Turbo](https://platform.openai.com/docs/models/gpt-4-turbo-and-gpt-4),
315315
and all GPT-3.5 Turbo models since `gpt-3.5-turbo-1106`.
316316
317+
Setting to `{ "type": "json_schema", "json_schema": {...} }` enables Structured
318+
Outputs which guarantees the model will match your supplied JSON schema. Learn
319+
more in the
320+
[Structured Outputs guide](https://platform.openai.com/docs/guides/structured-outputs).
321+
317322
Setting to `{ "type": "json_object" }` enables JSON mode, which guarantees the
318323
message the model generates is valid JSON.
319324
@@ -443,6 +448,11 @@ def create_and_run(
443448
[GPT-4 Turbo](https://platform.openai.com/docs/models/gpt-4-turbo-and-gpt-4),
444449
and all GPT-3.5 Turbo models since `gpt-3.5-turbo-1106`.
445450
451+
Setting to `{ "type": "json_schema", "json_schema": {...} }` enables Structured
452+
Outputs which guarantees the model will match your supplied JSON schema. Learn
453+
more in the
454+
[Structured Outputs guide](https://platform.openai.com/docs/guides/structured-outputs).
455+
446456
Setting to `{ "type": "json_object" }` enables JSON mode, which guarantees the
447457
message the model generates is valid JSON.
448458
@@ -568,6 +578,11 @@ def create_and_run(
568578
[GPT-4 Turbo](https://platform.openai.com/docs/models/gpt-4-turbo-and-gpt-4),
569579
and all GPT-3.5 Turbo models since `gpt-3.5-turbo-1106`.
570580
581+
Setting to `{ "type": "json_schema", "json_schema": {...} }` enables Structured
582+
Outputs which guarantees the model will match your supplied JSON schema. Learn
583+
more in the
584+
[Structured Outputs guide](https://platform.openai.com/docs/guides/structured-outputs).
585+
571586
Setting to `{ "type": "json_object" }` enables JSON mode, which guarantees the
572587
message the model generates is valid JSON.
573588
@@ -942,6 +957,11 @@ async def create_and_run(
942957
[GPT-4 Turbo](https://platform.openai.com/docs/models/gpt-4-turbo-and-gpt-4),
943958
and all GPT-3.5 Turbo models since `gpt-3.5-turbo-1106`.
944959
960+
Setting to `{ "type": "json_schema", "json_schema": {...} }` enables Structured
961+
Outputs which guarantees the model will match your supplied JSON schema. Learn
962+
more in the
963+
[Structured Outputs guide](https://platform.openai.com/docs/guides/structured-outputs).
964+
945965
Setting to `{ "type": "json_object" }` enables JSON mode, which guarantees the
946966
message the model generates is valid JSON.
947967
@@ -1071,6 +1091,11 @@ async def create_and_run(
10711091
[GPT-4 Turbo](https://platform.openai.com/docs/models/gpt-4-turbo-and-gpt-4),
10721092
and all GPT-3.5 Turbo models since `gpt-3.5-turbo-1106`.
10731093
1094+
Setting to `{ "type": "json_schema", "json_schema": {...} }` enables Structured
1095+
Outputs which guarantees the model will match your supplied JSON schema. Learn
1096+
more in the
1097+
[Structured Outputs guide](https://platform.openai.com/docs/guides/structured-outputs).
1098+
10741099
Setting to `{ "type": "json_object" }` enables JSON mode, which guarantees the
10751100
message the model generates is valid JSON.
10761101
@@ -1196,6 +1221,11 @@ async def create_and_run(
11961221
[GPT-4 Turbo](https://platform.openai.com/docs/models/gpt-4-turbo-and-gpt-4),
11971222
and all GPT-3.5 Turbo models since `gpt-3.5-turbo-1106`.
11981223
1224+
Setting to `{ "type": "json_schema", "json_schema": {...} }` enables Structured
1225+
Outputs which guarantees the model will match your supplied JSON schema. Learn
1226+
more in the
1227+
[Structured Outputs guide](https://platform.openai.com/docs/guides/structured-outputs).
1228+
11991229
Setting to `{ "type": "json_object" }` enables JSON mode, which guarantees the
12001230
message the model generates is valid JSON.
12011231

src/openai/resources/chat/completions.py

+12
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,8 @@ def create(
142142
[See more information about frequency and presence penalties.](https://platform.openai.com/docs/guides/text-generation/parameter-details)
143143
144144
response_format: An object specifying the format that the model must output. Compatible with
145+
[GPT-4o](https://platform.openai.com/docs/models/gpt-4o),
146+
[GPT-4o mini](https://platform.openai.com/docs/models/gpt-4o-mini),
145147
[GPT-4 Turbo](https://platform.openai.com/docs/models/gpt-4-and-gpt-4-turbo) and
146148
all GPT-3.5 Turbo models newer than `gpt-3.5-turbo-1106`.
147149
@@ -338,6 +340,8 @@ def create(
338340
[See more information about frequency and presence penalties.](https://platform.openai.com/docs/guides/text-generation/parameter-details)
339341
340342
response_format: An object specifying the format that the model must output. Compatible with
343+
[GPT-4o](https://platform.openai.com/docs/models/gpt-4o),
344+
[GPT-4o mini](https://platform.openai.com/docs/models/gpt-4o-mini),
341345
[GPT-4 Turbo](https://platform.openai.com/docs/models/gpt-4-and-gpt-4-turbo) and
342346
all GPT-3.5 Turbo models newer than `gpt-3.5-turbo-1106`.
343347
@@ -527,6 +531,8 @@ def create(
527531
[See more information about frequency and presence penalties.](https://platform.openai.com/docs/guides/text-generation/parameter-details)
528532
529533
response_format: An object specifying the format that the model must output. Compatible with
534+
[GPT-4o](https://platform.openai.com/docs/models/gpt-4o),
535+
[GPT-4o mini](https://platform.openai.com/docs/models/gpt-4o-mini),
530536
[GPT-4 Turbo](https://platform.openai.com/docs/models/gpt-4-and-gpt-4-turbo) and
531537
all GPT-3.5 Turbo models newer than `gpt-3.5-turbo-1106`.
532538
@@ -791,6 +797,8 @@ async def create(
791797
[See more information about frequency and presence penalties.](https://platform.openai.com/docs/guides/text-generation/parameter-details)
792798
793799
response_format: An object specifying the format that the model must output. Compatible with
800+
[GPT-4o](https://platform.openai.com/docs/models/gpt-4o),
801+
[GPT-4o mini](https://platform.openai.com/docs/models/gpt-4o-mini),
794802
[GPT-4 Turbo](https://platform.openai.com/docs/models/gpt-4-and-gpt-4-turbo) and
795803
all GPT-3.5 Turbo models newer than `gpt-3.5-turbo-1106`.
796804
@@ -987,6 +995,8 @@ async def create(
987995
[See more information about frequency and presence penalties.](https://platform.openai.com/docs/guides/text-generation/parameter-details)
988996
989997
response_format: An object specifying the format that the model must output. Compatible with
998+
[GPT-4o](https://platform.openai.com/docs/models/gpt-4o),
999+
[GPT-4o mini](https://platform.openai.com/docs/models/gpt-4o-mini),
9901000
[GPT-4 Turbo](https://platform.openai.com/docs/models/gpt-4-and-gpt-4-turbo) and
9911001
all GPT-3.5 Turbo models newer than `gpt-3.5-turbo-1106`.
9921002
@@ -1176,6 +1186,8 @@ async def create(
11761186
[See more information about frequency and presence penalties.](https://platform.openai.com/docs/guides/text-generation/parameter-details)
11771187
11781188
response_format: An object specifying the format that the model must output. Compatible with
1189+
[GPT-4o](https://platform.openai.com/docs/models/gpt-4o),
1190+
[GPT-4o mini](https://platform.openai.com/docs/models/gpt-4o-mini),
11791191
[GPT-4 Turbo](https://platform.openai.com/docs/models/gpt-4-and-gpt-4-turbo) and
11801192
all GPT-3.5 Turbo models newer than `gpt-3.5-turbo-1106`.
11811193

src/openai/resources/fine_tuning/jobs/jobs.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def with_streaming_response(self) -> JobsWithStreamingResponse:
4949
def create(
5050
self,
5151
*,
52-
model: Union[str, Literal["babbage-002", "davinci-002", "gpt-3.5-turbo"]],
52+
model: Union[str, Literal["babbage-002", "davinci-002", "gpt-3.5-turbo", "gpt-4o-mini"]],
5353
training_file: str,
5454
hyperparameters: job_create_params.Hyperparameters | NotGiven = NOT_GIVEN,
5555
integrations: Optional[Iterable[job_create_params.Integration]] | NotGiven = NOT_GIVEN,
@@ -74,7 +74,7 @@ def create(
7474
7575
Args:
7676
model: The name of the model to fine-tune. You can select one of the
77-
[supported models](https://platform.openai.com/docs/guides/fine-tuning/what-models-can-be-fine-tuned).
77+
[supported models](https://platform.openai.com/docs/guides/fine-tuning/which-models-can-be-fine-tuned).
7878
7979
training_file: The ID of an uploaded file that contains training data.
8080
@@ -104,7 +104,7 @@ def create(
104104
name.
105105
106106
For example, a `suffix` of "custom-model-name" would produce a model name like
107-
`ft:gpt-3.5-turbo:openai:custom-model-name:7p4lURel`.
107+
`ft:gpt-4o-mini:openai:custom-model-name:7p4lURel`.
108108
109109
validation_file: The ID of an uploaded file that contains validation data.
110110
@@ -329,7 +329,7 @@ def with_streaming_response(self) -> AsyncJobsWithStreamingResponse:
329329
async def create(
330330
self,
331331
*,
332-
model: Union[str, Literal["babbage-002", "davinci-002", "gpt-3.5-turbo"]],
332+
model: Union[str, Literal["babbage-002", "davinci-002", "gpt-3.5-turbo", "gpt-4o-mini"]],
333333
training_file: str,
334334
hyperparameters: job_create_params.Hyperparameters | NotGiven = NOT_GIVEN,
335335
integrations: Optional[Iterable[job_create_params.Integration]] | NotGiven = NOT_GIVEN,
@@ -354,7 +354,7 @@ async def create(
354354
355355
Args:
356356
model: The name of the model to fine-tune. You can select one of the
357-
[supported models](https://platform.openai.com/docs/guides/fine-tuning/what-models-can-be-fine-tuned).
357+
[supported models](https://platform.openai.com/docs/guides/fine-tuning/which-models-can-be-fine-tuned).
358358
359359
training_file: The ID of an uploaded file that contains training data.
360360
@@ -384,7 +384,7 @@ async def create(
384384
name.
385385
386386
For example, a `suffix` of "custom-model-name" would produce a model name like
387-
`ft:gpt-3.5-turbo:openai:custom-model-name:7p4lURel`.
387+
`ft:gpt-4o-mini:openai:custom-model-name:7p4lURel`.
388388
389389
validation_file: The ID of an uploaded file that contains validation data.
390390

src/openai/types/__init__.py

+3
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
ErrorObject as ErrorObject,
1010
FunctionDefinition as FunctionDefinition,
1111
FunctionParameters as FunctionParameters,
12+
ResponseFormatText as ResponseFormatText,
13+
ResponseFormatJSONObject as ResponseFormatJSONObject,
14+
ResponseFormatJSONSchema as ResponseFormatJSONSchema,
1215
)
1316
from .upload import Upload as Upload
1417
from .embedding import Embedding as Embedding

0 commit comments

Comments
 (0)