Skip to content

Commit 06bd42e

Browse files
Stainless BotRobertCraigie
Stainless Bot
authored andcommitted
feat(api): add o1 models (#1708)
See https://platform.openai.com/docs/guides/reasoning for details.
1 parent 80f02f9 commit 06bd42e

22 files changed

+253
-159
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-85a85e0c08de456441431c0ae4e9c078cc8f9748c29430b9a9058340db6389ee.yml
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai-501122aa32adaa2abb3d4487880ab9cdf2141addce2e6c3d1bd9bb6b44c318a8.yml

src/openai/resources/beta/assistants.py

+12-12
Original file line numberDiff line numberDiff line change
@@ -100,11 +100,11 @@ def create(
100100
and all GPT-3.5 Turbo models since `gpt-3.5-turbo-1106`.
101101
102102
Setting to `{ "type": "json_schema", "json_schema": {...} }` enables Structured
103-
Outputs which guarantees the model will match your supplied JSON schema. Learn
104-
more in the
103+
Outputs which ensures the model will match your supplied JSON schema. Learn more
104+
in the
105105
[Structured Outputs guide](https://platform.openai.com/docs/guides/structured-outputs).
106106
107-
Setting to `{ "type": "json_object" }` enables JSON mode, which guarantees the
107+
Setting to `{ "type": "json_object" }` enables JSON mode, which ensures the
108108
message the model generates is valid JSON.
109109
110110
**Important:** when using JSON mode, you **must** also instruct the model to
@@ -250,11 +250,11 @@ def update(
250250
and all GPT-3.5 Turbo models since `gpt-3.5-turbo-1106`.
251251
252252
Setting to `{ "type": "json_schema", "json_schema": {...} }` enables Structured
253-
Outputs which guarantees the model will match your supplied JSON schema. Learn
254-
more in the
253+
Outputs which ensures the model will match your supplied JSON schema. Learn more
254+
in the
255255
[Structured Outputs guide](https://platform.openai.com/docs/guides/structured-outputs).
256256
257-
Setting to `{ "type": "json_object" }` enables JSON mode, which guarantees the
257+
Setting to `{ "type": "json_object" }` enables JSON mode, which ensures the
258258
message the model generates is valid JSON.
259259
260260
**Important:** when using JSON mode, you **must** also instruct the model to
@@ -486,11 +486,11 @@ async def create(
486486
and all GPT-3.5 Turbo models since `gpt-3.5-turbo-1106`.
487487
488488
Setting to `{ "type": "json_schema", "json_schema": {...} }` enables Structured
489-
Outputs which guarantees the model will match your supplied JSON schema. Learn
490-
more in the
489+
Outputs which ensures the model will match your supplied JSON schema. Learn more
490+
in the
491491
[Structured Outputs guide](https://platform.openai.com/docs/guides/structured-outputs).
492492
493-
Setting to `{ "type": "json_object" }` enables JSON mode, which guarantees the
493+
Setting to `{ "type": "json_object" }` enables JSON mode, which ensures the
494494
message the model generates is valid JSON.
495495
496496
**Important:** when using JSON mode, you **must** also instruct the model to
@@ -636,11 +636,11 @@ async def update(
636636
and all GPT-3.5 Turbo models since `gpt-3.5-turbo-1106`.
637637
638638
Setting to `{ "type": "json_schema", "json_schema": {...} }` enables Structured
639-
Outputs which guarantees the model will match your supplied JSON schema. Learn
640-
more in the
639+
Outputs which ensures the model will match your supplied JSON schema. Learn more
640+
in the
641641
[Structured Outputs guide](https://platform.openai.com/docs/guides/structured-outputs).
642642
643-
Setting to `{ "type": "json_object" }` enables JSON mode, which guarantees the
643+
Setting to `{ "type": "json_object" }` enables JSON mode, which ensures the
644644
message the model generates is valid JSON.
645645
646646
**Important:** when using JSON mode, you **must** also instruct the model to

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

+8
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ def parse(
4242
functions: Iterable[completion_create_params.Function] | NotGiven = NOT_GIVEN,
4343
logit_bias: Optional[Dict[str, int]] | NotGiven = NOT_GIVEN,
4444
logprobs: Optional[bool] | NotGiven = NOT_GIVEN,
45+
max_completion_tokens: Optional[int] | NotGiven = NOT_GIVEN,
4546
max_tokens: Optional[int] | NotGiven = NOT_GIVEN,
4647
n: Optional[int] | NotGiven = NOT_GIVEN,
4748
parallel_tool_calls: bool | NotGiven = NOT_GIVEN,
@@ -121,6 +122,7 @@ class MathResponse(BaseModel):
121122
functions=functions,
122123
logit_bias=logit_bias,
123124
logprobs=logprobs,
125+
max_completion_tokens=max_completion_tokens,
124126
max_tokens=max_tokens,
125127
n=n,
126128
parallel_tool_calls=parallel_tool_calls,
@@ -157,6 +159,7 @@ def stream(
157159
functions: Iterable[completion_create_params.Function] | NotGiven = NOT_GIVEN,
158160
logit_bias: Optional[Dict[str, int]] | NotGiven = NOT_GIVEN,
159161
logprobs: Optional[bool] | NotGiven = NOT_GIVEN,
162+
max_completion_tokens: Optional[int] | NotGiven = NOT_GIVEN,
160163
max_tokens: Optional[int] | NotGiven = NOT_GIVEN,
161164
n: Optional[int] | NotGiven = NOT_GIVEN,
162165
parallel_tool_calls: bool | NotGiven = NOT_GIVEN,
@@ -216,6 +219,7 @@ def stream(
216219
functions=functions,
217220
logit_bias=logit_bias,
218221
logprobs=logprobs,
222+
max_completion_tokens=max_completion_tokens,
219223
max_tokens=max_tokens,
220224
n=n,
221225
parallel_tool_calls=parallel_tool_calls,
@@ -254,6 +258,7 @@ async def parse(
254258
functions: Iterable[completion_create_params.Function] | NotGiven = NOT_GIVEN,
255259
logit_bias: Optional[Dict[str, int]] | NotGiven = NOT_GIVEN,
256260
logprobs: Optional[bool] | NotGiven = NOT_GIVEN,
261+
max_completion_tokens: Optional[int] | NotGiven = NOT_GIVEN,
257262
max_tokens: Optional[int] | NotGiven = NOT_GIVEN,
258263
n: Optional[int] | NotGiven = NOT_GIVEN,
259264
parallel_tool_calls: bool | NotGiven = NOT_GIVEN,
@@ -333,6 +338,7 @@ class MathResponse(BaseModel):
333338
functions=functions,
334339
logit_bias=logit_bias,
335340
logprobs=logprobs,
341+
max_completion_tokens=max_completion_tokens,
336342
max_tokens=max_tokens,
337343
n=n,
338344
parallel_tool_calls=parallel_tool_calls,
@@ -369,6 +375,7 @@ def stream(
369375
functions: Iterable[completion_create_params.Function] | NotGiven = NOT_GIVEN,
370376
logit_bias: Optional[Dict[str, int]] | NotGiven = NOT_GIVEN,
371377
logprobs: Optional[bool] | NotGiven = NOT_GIVEN,
378+
max_completion_tokens: Optional[int] | NotGiven = NOT_GIVEN,
372379
max_tokens: Optional[int] | NotGiven = NOT_GIVEN,
373380
n: Optional[int] | NotGiven = NOT_GIVEN,
374381
parallel_tool_calls: bool | NotGiven = NOT_GIVEN,
@@ -429,6 +436,7 @@ def stream(
429436
functions=functions,
430437
logit_bias=logit_bias,
431438
logprobs=logprobs,
439+
max_completion_tokens=max_completion_tokens,
432440
max_tokens=max_tokens,
433441
n=n,
434442
parallel_tool_calls=parallel_tool_calls,

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

+18-18
Original file line numberDiff line numberDiff line change
@@ -167,11 +167,11 @@ def create(
167167
and all GPT-3.5 Turbo models since `gpt-3.5-turbo-1106`.
168168
169169
Setting to `{ "type": "json_schema", "json_schema": {...} }` enables Structured
170-
Outputs which guarantees the model will match your supplied JSON schema. Learn
171-
more in the
170+
Outputs which ensures the model will match your supplied JSON schema. Learn more
171+
in the
172172
[Structured Outputs guide](https://platform.openai.com/docs/guides/structured-outputs).
173173
174-
Setting to `{ "type": "json_object" }` enables JSON mode, which guarantees the
174+
Setting to `{ "type": "json_object" }` enables JSON mode, which ensures the
175175
message the model generates is valid JSON.
176176
177177
**Important:** when using JSON mode, you **must** also instruct the model to
@@ -311,11 +311,11 @@ def create(
311311
and all GPT-3.5 Turbo models since `gpt-3.5-turbo-1106`.
312312
313313
Setting to `{ "type": "json_schema", "json_schema": {...} }` enables Structured
314-
Outputs which guarantees the model will match your supplied JSON schema. Learn
315-
more in the
314+
Outputs which ensures the model will match your supplied JSON schema. Learn more
315+
in the
316316
[Structured Outputs guide](https://platform.openai.com/docs/guides/structured-outputs).
317317
318-
Setting to `{ "type": "json_object" }` enables JSON mode, which guarantees the
318+
Setting to `{ "type": "json_object" }` enables JSON mode, which ensures the
319319
message the model generates is valid JSON.
320320
321321
**Important:** when using JSON mode, you **must** also instruct the model to
@@ -451,11 +451,11 @@ def create(
451451
and all GPT-3.5 Turbo models since `gpt-3.5-turbo-1106`.
452452
453453
Setting to `{ "type": "json_schema", "json_schema": {...} }` enables Structured
454-
Outputs which guarantees the model will match your supplied JSON schema. Learn
455-
more in the
454+
Outputs which ensures the model will match your supplied JSON schema. Learn more
455+
in the
456456
[Structured Outputs guide](https://platform.openai.com/docs/guides/structured-outputs).
457457
458-
Setting to `{ "type": "json_object" }` enables JSON mode, which guarantees the
458+
Setting to `{ "type": "json_object" }` enables JSON mode, which ensures the
459459
message the model generates is valid JSON.
460460
461461
**Important:** when using JSON mode, you **must** also instruct the model to
@@ -1529,11 +1529,11 @@ async def create(
15291529
and all GPT-3.5 Turbo models since `gpt-3.5-turbo-1106`.
15301530
15311531
Setting to `{ "type": "json_schema", "json_schema": {...} }` enables Structured
1532-
Outputs which guarantees the model will match your supplied JSON schema. Learn
1533-
more in the
1532+
Outputs which ensures the model will match your supplied JSON schema. Learn more
1533+
in the
15341534
[Structured Outputs guide](https://platform.openai.com/docs/guides/structured-outputs).
15351535
1536-
Setting to `{ "type": "json_object" }` enables JSON mode, which guarantees the
1536+
Setting to `{ "type": "json_object" }` enables JSON mode, which ensures the
15371537
message the model generates is valid JSON.
15381538
15391539
**Important:** when using JSON mode, you **must** also instruct the model to
@@ -1673,11 +1673,11 @@ async def create(
16731673
and all GPT-3.5 Turbo models since `gpt-3.5-turbo-1106`.
16741674
16751675
Setting to `{ "type": "json_schema", "json_schema": {...} }` enables Structured
1676-
Outputs which guarantees the model will match your supplied JSON schema. Learn
1677-
more in the
1676+
Outputs which ensures the model will match your supplied JSON schema. Learn more
1677+
in the
16781678
[Structured Outputs guide](https://platform.openai.com/docs/guides/structured-outputs).
16791679
1680-
Setting to `{ "type": "json_object" }` enables JSON mode, which guarantees the
1680+
Setting to `{ "type": "json_object" }` enables JSON mode, which ensures the
16811681
message the model generates is valid JSON.
16821682
16831683
**Important:** when using JSON mode, you **must** also instruct the model to
@@ -1813,11 +1813,11 @@ async def create(
18131813
and all GPT-3.5 Turbo models since `gpt-3.5-turbo-1106`.
18141814
18151815
Setting to `{ "type": "json_schema", "json_schema": {...} }` enables Structured
1816-
Outputs which guarantees the model will match your supplied JSON schema. Learn
1817-
more in the
1816+
Outputs which ensures the model will match your supplied JSON schema. Learn more
1817+
in the
18181818
[Structured Outputs guide](https://platform.openai.com/docs/guides/structured-outputs).
18191819
1820-
Setting to `{ "type": "json_object" }` enables JSON mode, which guarantees the
1820+
Setting to `{ "type": "json_object" }` enables JSON mode, which ensures the
18211821
message the model generates is valid JSON.
18221822
18231823
**Important:** when using JSON mode, you **must** also instruct the model to

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

+18-18
Original file line numberDiff line numberDiff line change
@@ -335,11 +335,11 @@ def create_and_run(
335335
and all GPT-3.5 Turbo models since `gpt-3.5-turbo-1106`.
336336
337337
Setting to `{ "type": "json_schema", "json_schema": {...} }` enables Structured
338-
Outputs which guarantees the model will match your supplied JSON schema. Learn
339-
more in the
338+
Outputs which ensures the model will match your supplied JSON schema. Learn more
339+
in the
340340
[Structured Outputs guide](https://platform.openai.com/docs/guides/structured-outputs).
341341
342-
Setting to `{ "type": "json_object" }` enables JSON mode, which guarantees the
342+
Setting to `{ "type": "json_object" }` enables JSON mode, which ensures the
343343
message the model generates is valid JSON.
344344
345345
**Important:** when using JSON mode, you **must** also instruct the model to
@@ -469,11 +469,11 @@ def create_and_run(
469469
and all GPT-3.5 Turbo models since `gpt-3.5-turbo-1106`.
470470
471471
Setting to `{ "type": "json_schema", "json_schema": {...} }` enables Structured
472-
Outputs which guarantees the model will match your supplied JSON schema. Learn
473-
more in the
472+
Outputs which ensures the model will match your supplied JSON schema. Learn more
473+
in the
474474
[Structured Outputs guide](https://platform.openai.com/docs/guides/structured-outputs).
475475
476-
Setting to `{ "type": "json_object" }` enables JSON mode, which guarantees the
476+
Setting to `{ "type": "json_object" }` enables JSON mode, which ensures the
477477
message the model generates is valid JSON.
478478
479479
**Important:** when using JSON mode, you **must** also instruct the model to
@@ -599,11 +599,11 @@ def create_and_run(
599599
and all GPT-3.5 Turbo models since `gpt-3.5-turbo-1106`.
600600
601601
Setting to `{ "type": "json_schema", "json_schema": {...} }` enables Structured
602-
Outputs which guarantees the model will match your supplied JSON schema. Learn
603-
more in the
602+
Outputs which ensures the model will match your supplied JSON schema. Learn more
603+
in the
604604
[Structured Outputs guide](https://platform.openai.com/docs/guides/structured-outputs).
605605
606-
Setting to `{ "type": "json_object" }` enables JSON mode, which guarantees the
606+
Setting to `{ "type": "json_object" }` enables JSON mode, which ensures the
607607
message the model generates is valid JSON.
608608
609609
**Important:** when using JSON mode, you **must** also instruct the model to
@@ -1169,11 +1169,11 @@ async def create_and_run(
11691169
and all GPT-3.5 Turbo models since `gpt-3.5-turbo-1106`.
11701170
11711171
Setting to `{ "type": "json_schema", "json_schema": {...} }` enables Structured
1172-
Outputs which guarantees the model will match your supplied JSON schema. Learn
1173-
more in the
1172+
Outputs which ensures the model will match your supplied JSON schema. Learn more
1173+
in the
11741174
[Structured Outputs guide](https://platform.openai.com/docs/guides/structured-outputs).
11751175
1176-
Setting to `{ "type": "json_object" }` enables JSON mode, which guarantees the
1176+
Setting to `{ "type": "json_object" }` enables JSON mode, which ensures the
11771177
message the model generates is valid JSON.
11781178
11791179
**Important:** when using JSON mode, you **must** also instruct the model to
@@ -1303,11 +1303,11 @@ async def create_and_run(
13031303
and all GPT-3.5 Turbo models since `gpt-3.5-turbo-1106`.
13041304
13051305
Setting to `{ "type": "json_schema", "json_schema": {...} }` enables Structured
1306-
Outputs which guarantees the model will match your supplied JSON schema. Learn
1307-
more in the
1306+
Outputs which ensures the model will match your supplied JSON schema. Learn more
1307+
in the
13081308
[Structured Outputs guide](https://platform.openai.com/docs/guides/structured-outputs).
13091309
1310-
Setting to `{ "type": "json_object" }` enables JSON mode, which guarantees the
1310+
Setting to `{ "type": "json_object" }` enables JSON mode, which ensures the
13111311
message the model generates is valid JSON.
13121312
13131313
**Important:** when using JSON mode, you **must** also instruct the model to
@@ -1433,11 +1433,11 @@ async def create_and_run(
14331433
and all GPT-3.5 Turbo models since `gpt-3.5-turbo-1106`.
14341434
14351435
Setting to `{ "type": "json_schema", "json_schema": {...} }` enables Structured
1436-
Outputs which guarantees the model will match your supplied JSON schema. Learn
1437-
more in the
1436+
Outputs which ensures the model will match your supplied JSON schema. Learn more
1437+
in the
14381438
[Structured Outputs guide](https://platform.openai.com/docs/guides/structured-outputs).
14391439
1440-
Setting to `{ "type": "json_object" }` enables JSON mode, which guarantees the
1440+
Setting to `{ "type": "json_object" }` enables JSON mode, which ensures the
14411441
message the model generates is valid JSON.
14421442
14431443
**Important:** when using JSON mode, you **must** also instruct the model to

0 commit comments

Comments
 (0)