Skip to content

Commit 7e7744f

Browse files
fix(api): add missing reasoning effort + model enums (#2096)
1 parent 9b4ca5c commit 7e7744f

File tree

11 files changed

+248
-26
lines changed

11 files changed

+248
-26
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-fc5dbc19505b0035f9e7f88868619f4fb519b048bde011f6154f3132d4be71fb.yml
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai-7c699d4503077d06a4a44f52c0c1f902d19a87c766b8be75b97c8dfd484ad4aa.yml

src/openai/resources/beta/assistants.py

Lines changed: 104 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ def create(
6161
instructions: Optional[str] | NotGiven = NOT_GIVEN,
6262
metadata: Optional[Metadata] | NotGiven = NOT_GIVEN,
6363
name: Optional[str] | NotGiven = NOT_GIVEN,
64+
reasoning_effort: Optional[Literal["low", "medium", "high"]] | NotGiven = NOT_GIVEN,
6465
response_format: Optional[AssistantResponseFormatOptionParam] | NotGiven = NOT_GIVEN,
6566
temperature: Optional[float] | NotGiven = NOT_GIVEN,
6667
tool_resources: Optional[assistant_create_params.ToolResources] | NotGiven = NOT_GIVEN,
@@ -97,6 +98,13 @@ def create(
9798
9899
name: The name of the assistant. The maximum length is 256 characters.
99100
101+
reasoning_effort: **o1 and o3-mini models only**
102+
103+
Constrains effort on reasoning for
104+
[reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently
105+
supported values are `low`, `medium`, and `high`. Reducing reasoning effort can
106+
result in faster responses and fewer tokens used on reasoning in a response.
107+
100108
response_format: Specifies the format that the model must output. Compatible with
101109
[GPT-4o](https://platform.openai.com/docs/models#gpt-4o),
102110
[GPT-4 Turbo](https://platform.openai.com/docs/models#gpt-4-turbo-and-gpt-4),
@@ -155,6 +163,7 @@ def create(
155163
"instructions": instructions,
156164
"metadata": metadata,
157165
"name": name,
166+
"reasoning_effort": reasoning_effort,
158167
"response_format": response_format,
159168
"temperature": temperature,
160169
"tool_resources": tool_resources,
@@ -210,8 +219,42 @@ def update(
210219
description: Optional[str] | NotGiven = NOT_GIVEN,
211220
instructions: Optional[str] | NotGiven = NOT_GIVEN,
212221
metadata: Optional[Metadata] | NotGiven = NOT_GIVEN,
213-
model: str | NotGiven = NOT_GIVEN,
222+
model: Union[
223+
str,
224+
Literal[
225+
"o3-mini",
226+
"o3-mini-2025-01-31",
227+
"o1",
228+
"o1-2024-12-17",
229+
"gpt-4o",
230+
"gpt-4o-2024-11-20",
231+
"gpt-4o-2024-08-06",
232+
"gpt-4o-2024-05-13",
233+
"gpt-4o-mini",
234+
"gpt-4o-mini-2024-07-18",
235+
"gpt-4-turbo",
236+
"gpt-4-turbo-2024-04-09",
237+
"gpt-4-0125-preview",
238+
"gpt-4-turbo-preview",
239+
"gpt-4-1106-preview",
240+
"gpt-4-vision-preview",
241+
"gpt-4",
242+
"gpt-4-0314",
243+
"gpt-4-0613",
244+
"gpt-4-32k",
245+
"gpt-4-32k-0314",
246+
"gpt-4-32k-0613",
247+
"gpt-3.5-turbo",
248+
"gpt-3.5-turbo-16k",
249+
"gpt-3.5-turbo-0613",
250+
"gpt-3.5-turbo-1106",
251+
"gpt-3.5-turbo-0125",
252+
"gpt-3.5-turbo-16k-0613",
253+
],
254+
]
255+
| NotGiven = NOT_GIVEN,
214256
name: Optional[str] | NotGiven = NOT_GIVEN,
257+
reasoning_effort: Optional[Literal["low", "medium", "high"]] | NotGiven = NOT_GIVEN,
215258
response_format: Optional[AssistantResponseFormatOptionParam] | NotGiven = NOT_GIVEN,
216259
temperature: Optional[float] | NotGiven = NOT_GIVEN,
217260
tool_resources: Optional[assistant_update_params.ToolResources] | NotGiven = NOT_GIVEN,
@@ -249,6 +292,13 @@ def update(
249292
250293
name: The name of the assistant. The maximum length is 256 characters.
251294
295+
reasoning_effort: **o1 and o3-mini models only**
296+
297+
Constrains effort on reasoning for
298+
[reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently
299+
supported values are `low`, `medium`, and `high`. Reducing reasoning effort can
300+
result in faster responses and fewer tokens used on reasoning in a response.
301+
252302
response_format: Specifies the format that the model must output. Compatible with
253303
[GPT-4o](https://platform.openai.com/docs/models#gpt-4o),
254304
[GPT-4 Turbo](https://platform.openai.com/docs/models#gpt-4-turbo-and-gpt-4),
@@ -309,6 +359,7 @@ def update(
309359
"metadata": metadata,
310360
"model": model,
311361
"name": name,
362+
"reasoning_effort": reasoning_effort,
312363
"response_format": response_format,
313364
"temperature": temperature,
314365
"tool_resources": tool_resources,
@@ -451,6 +502,7 @@ async def create(
451502
instructions: Optional[str] | NotGiven = NOT_GIVEN,
452503
metadata: Optional[Metadata] | NotGiven = NOT_GIVEN,
453504
name: Optional[str] | NotGiven = NOT_GIVEN,
505+
reasoning_effort: Optional[Literal["low", "medium", "high"]] | NotGiven = NOT_GIVEN,
454506
response_format: Optional[AssistantResponseFormatOptionParam] | NotGiven = NOT_GIVEN,
455507
temperature: Optional[float] | NotGiven = NOT_GIVEN,
456508
tool_resources: Optional[assistant_create_params.ToolResources] | NotGiven = NOT_GIVEN,
@@ -487,6 +539,13 @@ async def create(
487539
488540
name: The name of the assistant. The maximum length is 256 characters.
489541
542+
reasoning_effort: **o1 and o3-mini models only**
543+
544+
Constrains effort on reasoning for
545+
[reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently
546+
supported values are `low`, `medium`, and `high`. Reducing reasoning effort can
547+
result in faster responses and fewer tokens used on reasoning in a response.
548+
490549
response_format: Specifies the format that the model must output. Compatible with
491550
[GPT-4o](https://platform.openai.com/docs/models#gpt-4o),
492551
[GPT-4 Turbo](https://platform.openai.com/docs/models#gpt-4-turbo-and-gpt-4),
@@ -545,6 +604,7 @@ async def create(
545604
"instructions": instructions,
546605
"metadata": metadata,
547606
"name": name,
607+
"reasoning_effort": reasoning_effort,
548608
"response_format": response_format,
549609
"temperature": temperature,
550610
"tool_resources": tool_resources,
@@ -600,8 +660,42 @@ async def update(
600660
description: Optional[str] | NotGiven = NOT_GIVEN,
601661
instructions: Optional[str] | NotGiven = NOT_GIVEN,
602662
metadata: Optional[Metadata] | NotGiven = NOT_GIVEN,
603-
model: str | NotGiven = NOT_GIVEN,
663+
model: Union[
664+
str,
665+
Literal[
666+
"o3-mini",
667+
"o3-mini-2025-01-31",
668+
"o1",
669+
"o1-2024-12-17",
670+
"gpt-4o",
671+
"gpt-4o-2024-11-20",
672+
"gpt-4o-2024-08-06",
673+
"gpt-4o-2024-05-13",
674+
"gpt-4o-mini",
675+
"gpt-4o-mini-2024-07-18",
676+
"gpt-4-turbo",
677+
"gpt-4-turbo-2024-04-09",
678+
"gpt-4-0125-preview",
679+
"gpt-4-turbo-preview",
680+
"gpt-4-1106-preview",
681+
"gpt-4-vision-preview",
682+
"gpt-4",
683+
"gpt-4-0314",
684+
"gpt-4-0613",
685+
"gpt-4-32k",
686+
"gpt-4-32k-0314",
687+
"gpt-4-32k-0613",
688+
"gpt-3.5-turbo",
689+
"gpt-3.5-turbo-16k",
690+
"gpt-3.5-turbo-0613",
691+
"gpt-3.5-turbo-1106",
692+
"gpt-3.5-turbo-0125",
693+
"gpt-3.5-turbo-16k-0613",
694+
],
695+
]
696+
| NotGiven = NOT_GIVEN,
604697
name: Optional[str] | NotGiven = NOT_GIVEN,
698+
reasoning_effort: Optional[Literal["low", "medium", "high"]] | NotGiven = NOT_GIVEN,
605699
response_format: Optional[AssistantResponseFormatOptionParam] | NotGiven = NOT_GIVEN,
606700
temperature: Optional[float] | NotGiven = NOT_GIVEN,
607701
tool_resources: Optional[assistant_update_params.ToolResources] | NotGiven = NOT_GIVEN,
@@ -639,6 +733,13 @@ async def update(
639733
640734
name: The name of the assistant. The maximum length is 256 characters.
641735
736+
reasoning_effort: **o1 and o3-mini models only**
737+
738+
Constrains effort on reasoning for
739+
[reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently
740+
supported values are `low`, `medium`, and `high`. Reducing reasoning effort can
741+
result in faster responses and fewer tokens used on reasoning in a response.
742+
642743
response_format: Specifies the format that the model must output. Compatible with
643744
[GPT-4o](https://platform.openai.com/docs/models#gpt-4o),
644745
[GPT-4 Turbo](https://platform.openai.com/docs/models#gpt-4-turbo-and-gpt-4),
@@ -699,6 +800,7 @@ async def update(
699800
"metadata": metadata,
700801
"model": model,
701802
"name": name,
803+
"reasoning_effort": reasoning_effort,
702804
"response_format": response_format,
703805
"temperature": temperature,
704806
"tool_resources": tool_resources,

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

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ def create(
8585
metadata: Optional[Metadata] | NotGiven = NOT_GIVEN,
8686
model: Union[str, ChatModel, None] | NotGiven = NOT_GIVEN,
8787
parallel_tool_calls: bool | NotGiven = NOT_GIVEN,
88+
reasoning_effort: Optional[Literal["low", "medium", "high"]] | NotGiven = NOT_GIVEN,
8889
response_format: Optional[AssistantResponseFormatOptionParam] | NotGiven = NOT_GIVEN,
8990
stream: Optional[Literal[False]] | NotGiven = NOT_GIVEN,
9091
temperature: Optional[float] | NotGiven = NOT_GIVEN,
@@ -153,6 +154,13 @@ def create(
153154
[parallel function calling](https://platform.openai.com/docs/guides/function-calling#configuring-parallel-function-calling)
154155
during tool use.
155156
157+
reasoning_effort: **o1 and o3-mini models only**
158+
159+
Constrains effort on reasoning for
160+
[reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently
161+
supported values are `low`, `medium`, and `high`. Reducing reasoning effort can
162+
result in faster responses and fewer tokens used on reasoning in a response.
163+
156164
response_format: Specifies the format that the model must output. Compatible with
157165
[GPT-4o](https://platform.openai.com/docs/models#gpt-4o),
158166
[GPT-4 Turbo](https://platform.openai.com/docs/models#gpt-4-turbo-and-gpt-4),
@@ -228,6 +236,7 @@ def create(
228236
metadata: Optional[Metadata] | NotGiven = NOT_GIVEN,
229237
model: Union[str, ChatModel, None] | NotGiven = NOT_GIVEN,
230238
parallel_tool_calls: bool | NotGiven = NOT_GIVEN,
239+
reasoning_effort: Optional[Literal["low", "medium", "high"]] | NotGiven = NOT_GIVEN,
231240
response_format: Optional[AssistantResponseFormatOptionParam] | NotGiven = NOT_GIVEN,
232241
temperature: Optional[float] | NotGiven = NOT_GIVEN,
233242
tool_choice: Optional[AssistantToolChoiceOptionParam] | NotGiven = NOT_GIVEN,
@@ -299,6 +308,13 @@ def create(
299308
[parallel function calling](https://platform.openai.com/docs/guides/function-calling#configuring-parallel-function-calling)
300309
during tool use.
301310
311+
reasoning_effort: **o1 and o3-mini models only**
312+
313+
Constrains effort on reasoning for
314+
[reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently
315+
supported values are `low`, `medium`, and `high`. Reducing reasoning effort can
316+
result in faster responses and fewer tokens used on reasoning in a response.
317+
302318
response_format: Specifies the format that the model must output. Compatible with
303319
[GPT-4o](https://platform.openai.com/docs/models#gpt-4o),
304320
[GPT-4 Turbo](https://platform.openai.com/docs/models#gpt-4-turbo-and-gpt-4),
@@ -370,6 +386,7 @@ def create(
370386
metadata: Optional[Metadata] | NotGiven = NOT_GIVEN,
371387
model: Union[str, ChatModel, None] | NotGiven = NOT_GIVEN,
372388
parallel_tool_calls: bool | NotGiven = NOT_GIVEN,
389+
reasoning_effort: Optional[Literal["low", "medium", "high"]] | NotGiven = NOT_GIVEN,
373390
response_format: Optional[AssistantResponseFormatOptionParam] | NotGiven = NOT_GIVEN,
374391
temperature: Optional[float] | NotGiven = NOT_GIVEN,
375392
tool_choice: Optional[AssistantToolChoiceOptionParam] | NotGiven = NOT_GIVEN,
@@ -441,6 +458,13 @@ def create(
441458
[parallel function calling](https://platform.openai.com/docs/guides/function-calling#configuring-parallel-function-calling)
442459
during tool use.
443460
461+
reasoning_effort: **o1 and o3-mini models only**
462+
463+
Constrains effort on reasoning for
464+
[reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently
465+
supported values are `low`, `medium`, and `high`. Reducing reasoning effort can
466+
result in faster responses and fewer tokens used on reasoning in a response.
467+
444468
response_format: Specifies the format that the model must output. Compatible with
445469
[GPT-4o](https://platform.openai.com/docs/models#gpt-4o),
446470
[GPT-4 Turbo](https://platform.openai.com/docs/models#gpt-4-turbo-and-gpt-4),
@@ -511,6 +535,7 @@ def create(
511535
metadata: Optional[Metadata] | NotGiven = NOT_GIVEN,
512536
model: Union[str, ChatModel, None] | NotGiven = NOT_GIVEN,
513537
parallel_tool_calls: bool | NotGiven = NOT_GIVEN,
538+
reasoning_effort: Optional[Literal["low", "medium", "high"]] | NotGiven = NOT_GIVEN,
514539
response_format: Optional[AssistantResponseFormatOptionParam] | NotGiven = NOT_GIVEN,
515540
stream: Optional[Literal[False]] | Literal[True] | NotGiven = NOT_GIVEN,
516541
temperature: Optional[float] | NotGiven = NOT_GIVEN,
@@ -541,6 +566,7 @@ def create(
541566
"metadata": metadata,
542567
"model": model,
543568
"parallel_tool_calls": parallel_tool_calls,
569+
"reasoning_effort": reasoning_effort,
544570
"response_format": response_format,
545571
"stream": stream,
546572
"temperature": temperature,
@@ -941,6 +967,7 @@ async def create(
941967
metadata: Optional[Metadata] | NotGiven = NOT_GIVEN,
942968
model: Union[str, ChatModel, None] | NotGiven = NOT_GIVEN,
943969
parallel_tool_calls: bool | NotGiven = NOT_GIVEN,
970+
reasoning_effort: Optional[Literal["low", "medium", "high"]] | NotGiven = NOT_GIVEN,
944971
response_format: Optional[AssistantResponseFormatOptionParam] | NotGiven = NOT_GIVEN,
945972
stream: Optional[Literal[False]] | NotGiven = NOT_GIVEN,
946973
temperature: Optional[float] | NotGiven = NOT_GIVEN,
@@ -1009,6 +1036,13 @@ async def create(
10091036
[parallel function calling](https://platform.openai.com/docs/guides/function-calling#configuring-parallel-function-calling)
10101037
during tool use.
10111038
1039+
reasoning_effort: **o1 and o3-mini models only**
1040+
1041+
Constrains effort on reasoning for
1042+
[reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently
1043+
supported values are `low`, `medium`, and `high`. Reducing reasoning effort can
1044+
result in faster responses and fewer tokens used on reasoning in a response.
1045+
10121046
response_format: Specifies the format that the model must output. Compatible with
10131047
[GPT-4o](https://platform.openai.com/docs/models#gpt-4o),
10141048
[GPT-4 Turbo](https://platform.openai.com/docs/models#gpt-4-turbo-and-gpt-4),
@@ -1084,6 +1118,7 @@ async def create(
10841118
metadata: Optional[Metadata] | NotGiven = NOT_GIVEN,
10851119
model: Union[str, ChatModel, None] | NotGiven = NOT_GIVEN,
10861120
parallel_tool_calls: bool | NotGiven = NOT_GIVEN,
1121+
reasoning_effort: Optional[Literal["low", "medium", "high"]] | NotGiven = NOT_GIVEN,
10871122
response_format: Optional[AssistantResponseFormatOptionParam] | NotGiven = NOT_GIVEN,
10881123
temperature: Optional[float] | NotGiven = NOT_GIVEN,
10891124
tool_choice: Optional[AssistantToolChoiceOptionParam] | NotGiven = NOT_GIVEN,
@@ -1155,6 +1190,13 @@ async def create(
11551190
[parallel function calling](https://platform.openai.com/docs/guides/function-calling#configuring-parallel-function-calling)
11561191
during tool use.
11571192
1193+
reasoning_effort: **o1 and o3-mini models only**
1194+
1195+
Constrains effort on reasoning for
1196+
[reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently
1197+
supported values are `low`, `medium`, and `high`. Reducing reasoning effort can
1198+
result in faster responses and fewer tokens used on reasoning in a response.
1199+
11581200
response_format: Specifies the format that the model must output. Compatible with
11591201
[GPT-4o](https://platform.openai.com/docs/models#gpt-4o),
11601202
[GPT-4 Turbo](https://platform.openai.com/docs/models#gpt-4-turbo-and-gpt-4),
@@ -1226,6 +1268,7 @@ async def create(
12261268
metadata: Optional[Metadata] | NotGiven = NOT_GIVEN,
12271269
model: Union[str, ChatModel, None] | NotGiven = NOT_GIVEN,
12281270
parallel_tool_calls: bool | NotGiven = NOT_GIVEN,
1271+
reasoning_effort: Optional[Literal["low", "medium", "high"]] | NotGiven = NOT_GIVEN,
12291272
response_format: Optional[AssistantResponseFormatOptionParam] | NotGiven = NOT_GIVEN,
12301273
temperature: Optional[float] | NotGiven = NOT_GIVEN,
12311274
tool_choice: Optional[AssistantToolChoiceOptionParam] | NotGiven = NOT_GIVEN,
@@ -1297,6 +1340,13 @@ async def create(
12971340
[parallel function calling](https://platform.openai.com/docs/guides/function-calling#configuring-parallel-function-calling)
12981341
during tool use.
12991342
1343+
reasoning_effort: **o1 and o3-mini models only**
1344+
1345+
Constrains effort on reasoning for
1346+
[reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently
1347+
supported values are `low`, `medium`, and `high`. Reducing reasoning effort can
1348+
result in faster responses and fewer tokens used on reasoning in a response.
1349+
13001350
response_format: Specifies the format that the model must output. Compatible with
13011351
[GPT-4o](https://platform.openai.com/docs/models#gpt-4o),
13021352
[GPT-4 Turbo](https://platform.openai.com/docs/models#gpt-4-turbo-and-gpt-4),
@@ -1367,6 +1417,7 @@ async def create(
13671417
metadata: Optional[Metadata] | NotGiven = NOT_GIVEN,
13681418
model: Union[str, ChatModel, None] | NotGiven = NOT_GIVEN,
13691419
parallel_tool_calls: bool | NotGiven = NOT_GIVEN,
1420+
reasoning_effort: Optional[Literal["low", "medium", "high"]] | NotGiven = NOT_GIVEN,
13701421
response_format: Optional[AssistantResponseFormatOptionParam] | NotGiven = NOT_GIVEN,
13711422
stream: Optional[Literal[False]] | Literal[True] | NotGiven = NOT_GIVEN,
13721423
temperature: Optional[float] | NotGiven = NOT_GIVEN,
@@ -1397,6 +1448,7 @@ async def create(
13971448
"metadata": metadata,
13981449
"model": model,
13991450
"parallel_tool_calls": parallel_tool_calls,
1451+
"reasoning_effort": reasoning_effort,
14001452
"response_format": response_format,
14011453
"stream": stream,
14021454
"temperature": temperature,

0 commit comments

Comments
 (0)