Commit 8640fd83
Changed files (12)
src
openai
resources
beta
chat
tests
api_resources
beta
src/openai/resources/beta/chat/completions.py
@@ -83,7 +83,7 @@ class Completions(SyncAPIResource):
parallel_tool_calls: bool | NotGiven = NOT_GIVEN,
prediction: Optional[ChatCompletionPredictionContentParam] | NotGiven = NOT_GIVEN,
presence_penalty: Optional[float] | NotGiven = NOT_GIVEN,
- reasoning_effort: ChatCompletionReasoningEffort | NotGiven = NOT_GIVEN,
+ reasoning_effort: Optional[ChatCompletionReasoningEffort] | NotGiven = NOT_GIVEN,
seed: Optional[int] | NotGiven = NOT_GIVEN,
service_tier: Optional[Literal["auto", "default"]] | NotGiven = NOT_GIVEN,
stop: Union[Optional[str], List[str]] | NotGiven = NOT_GIVEN,
@@ -228,7 +228,7 @@ class Completions(SyncAPIResource):
parallel_tool_calls: bool | NotGiven = NOT_GIVEN,
prediction: Optional[ChatCompletionPredictionContentParam] | NotGiven = NOT_GIVEN,
presence_penalty: Optional[float] | NotGiven = NOT_GIVEN,
- reasoning_effort: ChatCompletionReasoningEffort | NotGiven = NOT_GIVEN,
+ reasoning_effort: Optional[ChatCompletionReasoningEffort] | NotGiven = NOT_GIVEN,
seed: Optional[int] | NotGiven = NOT_GIVEN,
service_tier: Optional[Literal["auto", "default"]] | NotGiven = NOT_GIVEN,
stop: Union[Optional[str], List[str]] | NotGiven = NOT_GIVEN,
@@ -358,7 +358,7 @@ class AsyncCompletions(AsyncAPIResource):
parallel_tool_calls: bool | NotGiven = NOT_GIVEN,
prediction: Optional[ChatCompletionPredictionContentParam] | NotGiven = NOT_GIVEN,
presence_penalty: Optional[float] | NotGiven = NOT_GIVEN,
- reasoning_effort: ChatCompletionReasoningEffort | NotGiven = NOT_GIVEN,
+ reasoning_effort: Optional[ChatCompletionReasoningEffort] | NotGiven = NOT_GIVEN,
seed: Optional[int] | NotGiven = NOT_GIVEN,
service_tier: Optional[Literal["auto", "default"]] | NotGiven = NOT_GIVEN,
stop: Union[Optional[str], List[str]] | NotGiven = NOT_GIVEN,
@@ -503,7 +503,7 @@ class AsyncCompletions(AsyncAPIResource):
parallel_tool_calls: bool | NotGiven = NOT_GIVEN,
prediction: Optional[ChatCompletionPredictionContentParam] | NotGiven = NOT_GIVEN,
presence_penalty: Optional[float] | NotGiven = NOT_GIVEN,
- reasoning_effort: ChatCompletionReasoningEffort | NotGiven = NOT_GIVEN,
+ reasoning_effort: Optional[ChatCompletionReasoningEffort] | NotGiven = NOT_GIVEN,
seed: Optional[int] | NotGiven = NOT_GIVEN,
service_tier: Optional[Literal["auto", "default"]] | NotGiven = NOT_GIVEN,
stop: Union[Optional[str], List[str]] | NotGiven = NOT_GIVEN,
src/openai/resources/beta/threads/runs/runs.py
@@ -96,6 +96,7 @@ class Runs(SyncAPIResource):
metadata: Optional[Metadata] | NotGiven = NOT_GIVEN,
model: Union[str, ChatModel, None] | NotGiven = NOT_GIVEN,
parallel_tool_calls: bool | NotGiven = NOT_GIVEN,
+ reasoning_effort: Optional[Literal["low", "medium", "high"]] | NotGiven = NOT_GIVEN,
response_format: Optional[AssistantResponseFormatOptionParam] | NotGiven = NOT_GIVEN,
stream: Optional[Literal[False]] | NotGiven = NOT_GIVEN,
temperature: Optional[float] | NotGiven = NOT_GIVEN,
@@ -164,6 +165,13 @@ class Runs(SyncAPIResource):
[parallel function calling](https://platform.openai.com/docs/guides/function-calling#configuring-parallel-function-calling)
during tool use.
+ reasoning_effort: **o1 and o3-mini models only**
+
+ Constrains effort on reasoning for
+ [reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently
+ supported values are `low`, `medium`, and `high`. Reducing reasoning effort can
+ result in faster responses and fewer tokens used on reasoning in a response.
+
response_format: Specifies the format that the model must output. Compatible with
[GPT-4o](https://platform.openai.com/docs/models#gpt-4o),
[GPT-4 Turbo](https://platform.openai.com/docs/models#gpt-4-turbo-and-gpt-4),
@@ -239,6 +247,7 @@ class Runs(SyncAPIResource):
metadata: Optional[Metadata] | NotGiven = NOT_GIVEN,
model: Union[str, ChatModel, None] | NotGiven = NOT_GIVEN,
parallel_tool_calls: bool | NotGiven = NOT_GIVEN,
+ reasoning_effort: Optional[Literal["low", "medium", "high"]] | NotGiven = NOT_GIVEN,
response_format: Optional[AssistantResponseFormatOptionParam] | NotGiven = NOT_GIVEN,
temperature: Optional[float] | NotGiven = NOT_GIVEN,
tool_choice: Optional[AssistantToolChoiceOptionParam] | NotGiven = NOT_GIVEN,
@@ -310,6 +319,13 @@ class Runs(SyncAPIResource):
[parallel function calling](https://platform.openai.com/docs/guides/function-calling#configuring-parallel-function-calling)
during tool use.
+ reasoning_effort: **o1 and o3-mini models only**
+
+ Constrains effort on reasoning for
+ [reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently
+ supported values are `low`, `medium`, and `high`. Reducing reasoning effort can
+ result in faster responses and fewer tokens used on reasoning in a response.
+
response_format: Specifies the format that the model must output. Compatible with
[GPT-4o](https://platform.openai.com/docs/models#gpt-4o),
[GPT-4 Turbo](https://platform.openai.com/docs/models#gpt-4-turbo-and-gpt-4),
@@ -381,6 +397,7 @@ class Runs(SyncAPIResource):
metadata: Optional[Metadata] | NotGiven = NOT_GIVEN,
model: Union[str, ChatModel, None] | NotGiven = NOT_GIVEN,
parallel_tool_calls: bool | NotGiven = NOT_GIVEN,
+ reasoning_effort: Optional[Literal["low", "medium", "high"]] | NotGiven = NOT_GIVEN,
response_format: Optional[AssistantResponseFormatOptionParam] | NotGiven = NOT_GIVEN,
temperature: Optional[float] | NotGiven = NOT_GIVEN,
tool_choice: Optional[AssistantToolChoiceOptionParam] | NotGiven = NOT_GIVEN,
@@ -452,6 +469,13 @@ class Runs(SyncAPIResource):
[parallel function calling](https://platform.openai.com/docs/guides/function-calling#configuring-parallel-function-calling)
during tool use.
+ reasoning_effort: **o1 and o3-mini models only**
+
+ Constrains effort on reasoning for
+ [reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently
+ supported values are `low`, `medium`, and `high`. Reducing reasoning effort can
+ result in faster responses and fewer tokens used on reasoning in a response.
+
response_format: Specifies the format that the model must output. Compatible with
[GPT-4o](https://platform.openai.com/docs/models#gpt-4o),
[GPT-4 Turbo](https://platform.openai.com/docs/models#gpt-4-turbo-and-gpt-4),
@@ -522,6 +546,7 @@ class Runs(SyncAPIResource):
metadata: Optional[Metadata] | NotGiven = NOT_GIVEN,
model: Union[str, ChatModel, None] | NotGiven = NOT_GIVEN,
parallel_tool_calls: bool | NotGiven = NOT_GIVEN,
+ reasoning_effort: Optional[Literal["low", "medium", "high"]] | NotGiven = NOT_GIVEN,
response_format: Optional[AssistantResponseFormatOptionParam] | NotGiven = NOT_GIVEN,
stream: Optional[Literal[False]] | Literal[True] | NotGiven = NOT_GIVEN,
temperature: Optional[float] | NotGiven = NOT_GIVEN,
@@ -552,6 +577,7 @@ class Runs(SyncAPIResource):
"metadata": metadata,
"model": model,
"parallel_tool_calls": parallel_tool_calls,
+ "reasoning_effort": reasoning_effort,
"response_format": response_format,
"stream": stream,
"temperature": temperature,
@@ -774,6 +800,7 @@ class Runs(SyncAPIResource):
metadata: Optional[Metadata] | NotGiven = NOT_GIVEN,
model: Union[str, ChatModel, None] | NotGiven = NOT_GIVEN,
parallel_tool_calls: bool | NotGiven = NOT_GIVEN,
+ reasoning_effort: Optional[Literal["low", "medium", "high"]] | NotGiven = NOT_GIVEN,
response_format: Optional[AssistantResponseFormatOptionParam] | NotGiven = NOT_GIVEN,
temperature: Optional[float] | NotGiven = NOT_GIVEN,
tool_choice: Optional[AssistantToolChoiceOptionParam] | NotGiven = NOT_GIVEN,
@@ -809,6 +836,7 @@ class Runs(SyncAPIResource):
temperature=temperature,
tool_choice=tool_choice,
parallel_tool_calls=parallel_tool_calls,
+ reasoning_effort=reasoning_effort,
# We assume we are not streaming when polling
stream=False,
tools=tools,
@@ -843,6 +871,7 @@ class Runs(SyncAPIResource):
metadata: Optional[Metadata] | NotGiven = NOT_GIVEN,
model: Union[str, ChatModel, None] | NotGiven = NOT_GIVEN,
parallel_tool_calls: bool | NotGiven = NOT_GIVEN,
+ reasoning_effort: Optional[Literal["low", "medium", "high"]] | NotGiven = NOT_GIVEN,
response_format: Optional[AssistantResponseFormatOptionParam] | NotGiven = NOT_GIVEN,
temperature: Optional[float] | NotGiven = NOT_GIVEN,
tool_choice: Optional[AssistantToolChoiceOptionParam] | NotGiven = NOT_GIVEN,
@@ -874,6 +903,7 @@ class Runs(SyncAPIResource):
metadata: Optional[Metadata] | NotGiven = NOT_GIVEN,
model: Union[str, ChatModel, None] | NotGiven = NOT_GIVEN,
parallel_tool_calls: bool | NotGiven = NOT_GIVEN,
+ reasoning_effort: Optional[Literal["low", "medium", "high"]] | NotGiven = NOT_GIVEN,
response_format: Optional[AssistantResponseFormatOptionParam] | NotGiven = NOT_GIVEN,
temperature: Optional[float] | NotGiven = NOT_GIVEN,
tool_choice: Optional[AssistantToolChoiceOptionParam] | NotGiven = NOT_GIVEN,
@@ -905,6 +935,7 @@ class Runs(SyncAPIResource):
metadata: Optional[Metadata] | NotGiven = NOT_GIVEN,
model: Union[str, ChatModel, None] | NotGiven = NOT_GIVEN,
parallel_tool_calls: bool | NotGiven = NOT_GIVEN,
+ reasoning_effort: Optional[Literal["low", "medium", "high"]] | NotGiven = NOT_GIVEN,
response_format: Optional[AssistantResponseFormatOptionParam] | NotGiven = NOT_GIVEN,
temperature: Optional[float] | NotGiven = NOT_GIVEN,
tool_choice: Optional[AssistantToolChoiceOptionParam] | NotGiven = NOT_GIVEN,
@@ -950,6 +981,7 @@ class Runs(SyncAPIResource):
"tools": tools,
"truncation_strategy": truncation_strategy,
"parallel_tool_calls": parallel_tool_calls,
+ "reasoning_effort": reasoning_effort,
"top_p": top_p,
},
run_create_params.RunCreateParams,
@@ -1022,6 +1054,7 @@ class Runs(SyncAPIResource):
metadata: Optional[Metadata] | NotGiven = NOT_GIVEN,
model: Union[str, ChatModel, None] | NotGiven = NOT_GIVEN,
parallel_tool_calls: bool | NotGiven = NOT_GIVEN,
+ reasoning_effort: Optional[Literal["low", "medium", "high"]] | NotGiven = NOT_GIVEN,
response_format: Optional[AssistantResponseFormatOptionParam] | NotGiven = NOT_GIVEN,
temperature: Optional[float] | NotGiven = NOT_GIVEN,
tool_choice: Optional[AssistantToolChoiceOptionParam] | NotGiven = NOT_GIVEN,
@@ -1053,6 +1086,7 @@ class Runs(SyncAPIResource):
metadata: Optional[Metadata] | NotGiven = NOT_GIVEN,
model: Union[str, ChatModel, None] | NotGiven = NOT_GIVEN,
parallel_tool_calls: bool | NotGiven = NOT_GIVEN,
+ reasoning_effort: Optional[Literal["low", "medium", "high"]] | NotGiven = NOT_GIVEN,
response_format: Optional[AssistantResponseFormatOptionParam] | NotGiven = NOT_GIVEN,
temperature: Optional[float] | NotGiven = NOT_GIVEN,
tool_choice: Optional[AssistantToolChoiceOptionParam] | NotGiven = NOT_GIVEN,
@@ -1084,6 +1118,7 @@ class Runs(SyncAPIResource):
metadata: Optional[Metadata] | NotGiven = NOT_GIVEN,
model: Union[str, ChatModel, None] | NotGiven = NOT_GIVEN,
parallel_tool_calls: bool | NotGiven = NOT_GIVEN,
+ reasoning_effort: Optional[Literal["low", "medium", "high"]] | NotGiven = NOT_GIVEN,
response_format: Optional[AssistantResponseFormatOptionParam] | NotGiven = NOT_GIVEN,
temperature: Optional[float] | NotGiven = NOT_GIVEN,
tool_choice: Optional[AssistantToolChoiceOptionParam] | NotGiven = NOT_GIVEN,
@@ -1128,6 +1163,7 @@ class Runs(SyncAPIResource):
"stream": True,
"tools": tools,
"parallel_tool_calls": parallel_tool_calls,
+ "reasoning_effort": reasoning_effort,
"truncation_strategy": truncation_strategy,
"top_p": top_p,
},
@@ -1469,6 +1505,7 @@ class AsyncRuns(AsyncAPIResource):
metadata: Optional[Metadata] | NotGiven = NOT_GIVEN,
model: Union[str, ChatModel, None] | NotGiven = NOT_GIVEN,
parallel_tool_calls: bool | NotGiven = NOT_GIVEN,
+ reasoning_effort: Optional[Literal["low", "medium", "high"]] | NotGiven = NOT_GIVEN,
response_format: Optional[AssistantResponseFormatOptionParam] | NotGiven = NOT_GIVEN,
stream: Optional[Literal[False]] | NotGiven = NOT_GIVEN,
temperature: Optional[float] | NotGiven = NOT_GIVEN,
@@ -1537,6 +1574,13 @@ class AsyncRuns(AsyncAPIResource):
[parallel function calling](https://platform.openai.com/docs/guides/function-calling#configuring-parallel-function-calling)
during tool use.
+ reasoning_effort: **o1 and o3-mini models only**
+
+ Constrains effort on reasoning for
+ [reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently
+ supported values are `low`, `medium`, and `high`. Reducing reasoning effort can
+ result in faster responses and fewer tokens used on reasoning in a response.
+
response_format: Specifies the format that the model must output. Compatible with
[GPT-4o](https://platform.openai.com/docs/models#gpt-4o),
[GPT-4 Turbo](https://platform.openai.com/docs/models#gpt-4-turbo-and-gpt-4),
@@ -1612,6 +1656,7 @@ class AsyncRuns(AsyncAPIResource):
metadata: Optional[Metadata] | NotGiven = NOT_GIVEN,
model: Union[str, ChatModel, None] | NotGiven = NOT_GIVEN,
parallel_tool_calls: bool | NotGiven = NOT_GIVEN,
+ reasoning_effort: Optional[Literal["low", "medium", "high"]] | NotGiven = NOT_GIVEN,
response_format: Optional[AssistantResponseFormatOptionParam] | NotGiven = NOT_GIVEN,
temperature: Optional[float] | NotGiven = NOT_GIVEN,
tool_choice: Optional[AssistantToolChoiceOptionParam] | NotGiven = NOT_GIVEN,
@@ -1683,6 +1728,13 @@ class AsyncRuns(AsyncAPIResource):
[parallel function calling](https://platform.openai.com/docs/guides/function-calling#configuring-parallel-function-calling)
during tool use.
+ reasoning_effort: **o1 and o3-mini models only**
+
+ Constrains effort on reasoning for
+ [reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently
+ supported values are `low`, `medium`, and `high`. Reducing reasoning effort can
+ result in faster responses and fewer tokens used on reasoning in a response.
+
response_format: Specifies the format that the model must output. Compatible with
[GPT-4o](https://platform.openai.com/docs/models#gpt-4o),
[GPT-4 Turbo](https://platform.openai.com/docs/models#gpt-4-turbo-and-gpt-4),
@@ -1754,6 +1806,7 @@ class AsyncRuns(AsyncAPIResource):
metadata: Optional[Metadata] | NotGiven = NOT_GIVEN,
model: Union[str, ChatModel, None] | NotGiven = NOT_GIVEN,
parallel_tool_calls: bool | NotGiven = NOT_GIVEN,
+ reasoning_effort: Optional[Literal["low", "medium", "high"]] | NotGiven = NOT_GIVEN,
response_format: Optional[AssistantResponseFormatOptionParam] | NotGiven = NOT_GIVEN,
temperature: Optional[float] | NotGiven = NOT_GIVEN,
tool_choice: Optional[AssistantToolChoiceOptionParam] | NotGiven = NOT_GIVEN,
@@ -1825,6 +1878,13 @@ class AsyncRuns(AsyncAPIResource):
[parallel function calling](https://platform.openai.com/docs/guides/function-calling#configuring-parallel-function-calling)
during tool use.
+ reasoning_effort: **o1 and o3-mini models only**
+
+ Constrains effort on reasoning for
+ [reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently
+ supported values are `low`, `medium`, and `high`. Reducing reasoning effort can
+ result in faster responses and fewer tokens used on reasoning in a response.
+
response_format: Specifies the format that the model must output. Compatible with
[GPT-4o](https://platform.openai.com/docs/models#gpt-4o),
[GPT-4 Turbo](https://platform.openai.com/docs/models#gpt-4-turbo-and-gpt-4),
@@ -1895,6 +1955,7 @@ class AsyncRuns(AsyncAPIResource):
metadata: Optional[Metadata] | NotGiven = NOT_GIVEN,
model: Union[str, ChatModel, None] | NotGiven = NOT_GIVEN,
parallel_tool_calls: bool | NotGiven = NOT_GIVEN,
+ reasoning_effort: Optional[Literal["low", "medium", "high"]] | NotGiven = NOT_GIVEN,
response_format: Optional[AssistantResponseFormatOptionParam] | NotGiven = NOT_GIVEN,
stream: Optional[Literal[False]] | Literal[True] | NotGiven = NOT_GIVEN,
temperature: Optional[float] | NotGiven = NOT_GIVEN,
@@ -1925,6 +1986,7 @@ class AsyncRuns(AsyncAPIResource):
"metadata": metadata,
"model": model,
"parallel_tool_calls": parallel_tool_calls,
+ "reasoning_effort": reasoning_effort,
"response_format": response_format,
"stream": stream,
"temperature": temperature,
@@ -2147,6 +2209,7 @@ class AsyncRuns(AsyncAPIResource):
metadata: Optional[Metadata] | NotGiven = NOT_GIVEN,
model: Union[str, ChatModel, None] | NotGiven = NOT_GIVEN,
parallel_tool_calls: bool | NotGiven = NOT_GIVEN,
+ reasoning_effort: Optional[Literal["low", "medium", "high"]] | NotGiven = NOT_GIVEN,
response_format: Optional[AssistantResponseFormatOptionParam] | NotGiven = NOT_GIVEN,
temperature: Optional[float] | NotGiven = NOT_GIVEN,
tool_choice: Optional[AssistantToolChoiceOptionParam] | NotGiven = NOT_GIVEN,
@@ -2182,6 +2245,7 @@ class AsyncRuns(AsyncAPIResource):
temperature=temperature,
tool_choice=tool_choice,
parallel_tool_calls=parallel_tool_calls,
+ reasoning_effort=reasoning_effort,
# We assume we are not streaming when polling
stream=False,
tools=tools,
@@ -2396,6 +2460,7 @@ class AsyncRuns(AsyncAPIResource):
metadata: Optional[Metadata] | NotGiven = NOT_GIVEN,
model: Union[str, ChatModel, None] | NotGiven = NOT_GIVEN,
parallel_tool_calls: bool | NotGiven = NOT_GIVEN,
+ reasoning_effort: Optional[Literal["low", "medium", "high"]] | NotGiven = NOT_GIVEN,
response_format: Optional[AssistantResponseFormatOptionParam] | NotGiven = NOT_GIVEN,
temperature: Optional[float] | NotGiven = NOT_GIVEN,
tool_choice: Optional[AssistantToolChoiceOptionParam] | NotGiven = NOT_GIVEN,
@@ -2427,6 +2492,7 @@ class AsyncRuns(AsyncAPIResource):
metadata: Optional[Metadata] | NotGiven = NOT_GIVEN,
model: Union[str, ChatModel, None] | NotGiven = NOT_GIVEN,
parallel_tool_calls: bool | NotGiven = NOT_GIVEN,
+ reasoning_effort: Optional[Literal["low", "medium", "high"]] | NotGiven = NOT_GIVEN,
response_format: Optional[AssistantResponseFormatOptionParam] | NotGiven = NOT_GIVEN,
temperature: Optional[float] | NotGiven = NOT_GIVEN,
tool_choice: Optional[AssistantToolChoiceOptionParam] | NotGiven = NOT_GIVEN,
@@ -2458,6 +2524,7 @@ class AsyncRuns(AsyncAPIResource):
metadata: Optional[Metadata] | NotGiven = NOT_GIVEN,
model: Union[str, ChatModel, None] | NotGiven = NOT_GIVEN,
parallel_tool_calls: bool | NotGiven = NOT_GIVEN,
+ reasoning_effort: Optional[Literal["low", "medium", "high"]] | NotGiven = NOT_GIVEN,
response_format: Optional[AssistantResponseFormatOptionParam] | NotGiven = NOT_GIVEN,
temperature: Optional[float] | NotGiven = NOT_GIVEN,
tool_choice: Optional[AssistantToolChoiceOptionParam] | NotGiven = NOT_GIVEN,
@@ -2504,6 +2571,7 @@ class AsyncRuns(AsyncAPIResource):
"stream": True,
"tools": tools,
"parallel_tool_calls": parallel_tool_calls,
+ "reasoning_effort": reasoning_effort,
"truncation_strategy": truncation_strategy,
"top_p": top_p,
},
src/openai/resources/beta/assistants.py
@@ -61,6 +61,7 @@ class Assistants(SyncAPIResource):
instructions: Optional[str] | NotGiven = NOT_GIVEN,
metadata: Optional[Metadata] | NotGiven = NOT_GIVEN,
name: Optional[str] | NotGiven = NOT_GIVEN,
+ reasoning_effort: Optional[Literal["low", "medium", "high"]] | NotGiven = NOT_GIVEN,
response_format: Optional[AssistantResponseFormatOptionParam] | NotGiven = NOT_GIVEN,
temperature: Optional[float] | NotGiven = NOT_GIVEN,
tool_resources: Optional[assistant_create_params.ToolResources] | NotGiven = NOT_GIVEN,
@@ -97,6 +98,13 @@ class Assistants(SyncAPIResource):
name: The name of the assistant. The maximum length is 256 characters.
+ reasoning_effort: **o1 and o3-mini models only**
+
+ Constrains effort on reasoning for
+ [reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently
+ supported values are `low`, `medium`, and `high`. Reducing reasoning effort can
+ result in faster responses and fewer tokens used on reasoning in a response.
+
response_format: Specifies the format that the model must output. Compatible with
[GPT-4o](https://platform.openai.com/docs/models#gpt-4o),
[GPT-4 Turbo](https://platform.openai.com/docs/models#gpt-4-turbo-and-gpt-4),
@@ -155,6 +163,7 @@ class Assistants(SyncAPIResource):
"instructions": instructions,
"metadata": metadata,
"name": name,
+ "reasoning_effort": reasoning_effort,
"response_format": response_format,
"temperature": temperature,
"tool_resources": tool_resources,
@@ -210,8 +219,42 @@ class Assistants(SyncAPIResource):
description: Optional[str] | NotGiven = NOT_GIVEN,
instructions: Optional[str] | NotGiven = NOT_GIVEN,
metadata: Optional[Metadata] | NotGiven = NOT_GIVEN,
- model: str | NotGiven = NOT_GIVEN,
+ model: Union[
+ str,
+ Literal[
+ "o3-mini",
+ "o3-mini-2025-01-31",
+ "o1",
+ "o1-2024-12-17",
+ "gpt-4o",
+ "gpt-4o-2024-11-20",
+ "gpt-4o-2024-08-06",
+ "gpt-4o-2024-05-13",
+ "gpt-4o-mini",
+ "gpt-4o-mini-2024-07-18",
+ "gpt-4-turbo",
+ "gpt-4-turbo-2024-04-09",
+ "gpt-4-0125-preview",
+ "gpt-4-turbo-preview",
+ "gpt-4-1106-preview",
+ "gpt-4-vision-preview",
+ "gpt-4",
+ "gpt-4-0314",
+ "gpt-4-0613",
+ "gpt-4-32k",
+ "gpt-4-32k-0314",
+ "gpt-4-32k-0613",
+ "gpt-3.5-turbo",
+ "gpt-3.5-turbo-16k",
+ "gpt-3.5-turbo-0613",
+ "gpt-3.5-turbo-1106",
+ "gpt-3.5-turbo-0125",
+ "gpt-3.5-turbo-16k-0613",
+ ],
+ ]
+ | NotGiven = NOT_GIVEN,
name: Optional[str] | NotGiven = NOT_GIVEN,
+ reasoning_effort: Optional[Literal["low", "medium", "high"]] | NotGiven = NOT_GIVEN,
response_format: Optional[AssistantResponseFormatOptionParam] | NotGiven = NOT_GIVEN,
temperature: Optional[float] | NotGiven = NOT_GIVEN,
tool_resources: Optional[assistant_update_params.ToolResources] | NotGiven = NOT_GIVEN,
@@ -249,6 +292,13 @@ class Assistants(SyncAPIResource):
name: The name of the assistant. The maximum length is 256 characters.
+ reasoning_effort: **o1 and o3-mini models only**
+
+ Constrains effort on reasoning for
+ [reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently
+ supported values are `low`, `medium`, and `high`. Reducing reasoning effort can
+ result in faster responses and fewer tokens used on reasoning in a response.
+
response_format: Specifies the format that the model must output. Compatible with
[GPT-4o](https://platform.openai.com/docs/models#gpt-4o),
[GPT-4 Turbo](https://platform.openai.com/docs/models#gpt-4-turbo-and-gpt-4),
@@ -309,6 +359,7 @@ class Assistants(SyncAPIResource):
"metadata": metadata,
"model": model,
"name": name,
+ "reasoning_effort": reasoning_effort,
"response_format": response_format,
"temperature": temperature,
"tool_resources": tool_resources,
@@ -451,6 +502,7 @@ class AsyncAssistants(AsyncAPIResource):
instructions: Optional[str] | NotGiven = NOT_GIVEN,
metadata: Optional[Metadata] | NotGiven = NOT_GIVEN,
name: Optional[str] | NotGiven = NOT_GIVEN,
+ reasoning_effort: Optional[Literal["low", "medium", "high"]] | NotGiven = NOT_GIVEN,
response_format: Optional[AssistantResponseFormatOptionParam] | NotGiven = NOT_GIVEN,
temperature: Optional[float] | NotGiven = NOT_GIVEN,
tool_resources: Optional[assistant_create_params.ToolResources] | NotGiven = NOT_GIVEN,
@@ -487,6 +539,13 @@ class AsyncAssistants(AsyncAPIResource):
name: The name of the assistant. The maximum length is 256 characters.
+ reasoning_effort: **o1 and o3-mini models only**
+
+ Constrains effort on reasoning for
+ [reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently
+ supported values are `low`, `medium`, and `high`. Reducing reasoning effort can
+ result in faster responses and fewer tokens used on reasoning in a response.
+
response_format: Specifies the format that the model must output. Compatible with
[GPT-4o](https://platform.openai.com/docs/models#gpt-4o),
[GPT-4 Turbo](https://platform.openai.com/docs/models#gpt-4-turbo-and-gpt-4),
@@ -545,6 +604,7 @@ class AsyncAssistants(AsyncAPIResource):
"instructions": instructions,
"metadata": metadata,
"name": name,
+ "reasoning_effort": reasoning_effort,
"response_format": response_format,
"temperature": temperature,
"tool_resources": tool_resources,
@@ -600,8 +660,42 @@ class AsyncAssistants(AsyncAPIResource):
description: Optional[str] | NotGiven = NOT_GIVEN,
instructions: Optional[str] | NotGiven = NOT_GIVEN,
metadata: Optional[Metadata] | NotGiven = NOT_GIVEN,
- model: str | NotGiven = NOT_GIVEN,
+ model: Union[
+ str,
+ Literal[
+ "o3-mini",
+ "o3-mini-2025-01-31",
+ "o1",
+ "o1-2024-12-17",
+ "gpt-4o",
+ "gpt-4o-2024-11-20",
+ "gpt-4o-2024-08-06",
+ "gpt-4o-2024-05-13",
+ "gpt-4o-mini",
+ "gpt-4o-mini-2024-07-18",
+ "gpt-4-turbo",
+ "gpt-4-turbo-2024-04-09",
+ "gpt-4-0125-preview",
+ "gpt-4-turbo-preview",
+ "gpt-4-1106-preview",
+ "gpt-4-vision-preview",
+ "gpt-4",
+ "gpt-4-0314",
+ "gpt-4-0613",
+ "gpt-4-32k",
+ "gpt-4-32k-0314",
+ "gpt-4-32k-0613",
+ "gpt-3.5-turbo",
+ "gpt-3.5-turbo-16k",
+ "gpt-3.5-turbo-0613",
+ "gpt-3.5-turbo-1106",
+ "gpt-3.5-turbo-0125",
+ "gpt-3.5-turbo-16k-0613",
+ ],
+ ]
+ | NotGiven = NOT_GIVEN,
name: Optional[str] | NotGiven = NOT_GIVEN,
+ reasoning_effort: Optional[Literal["low", "medium", "high"]] | NotGiven = NOT_GIVEN,
response_format: Optional[AssistantResponseFormatOptionParam] | NotGiven = NOT_GIVEN,
temperature: Optional[float] | NotGiven = NOT_GIVEN,
tool_resources: Optional[assistant_update_params.ToolResources] | NotGiven = NOT_GIVEN,
@@ -639,6 +733,13 @@ class AsyncAssistants(AsyncAPIResource):
name: The name of the assistant. The maximum length is 256 characters.
+ reasoning_effort: **o1 and o3-mini models only**
+
+ Constrains effort on reasoning for
+ [reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently
+ supported values are `low`, `medium`, and `high`. Reducing reasoning effort can
+ result in faster responses and fewer tokens used on reasoning in a response.
+
response_format: Specifies the format that the model must output. Compatible with
[GPT-4o](https://platform.openai.com/docs/models#gpt-4o),
[GPT-4 Turbo](https://platform.openai.com/docs/models#gpt-4-turbo-and-gpt-4),
@@ -699,6 +800,7 @@ class AsyncAssistants(AsyncAPIResource):
"metadata": metadata,
"model": model,
"name": name,
+ "reasoning_effort": reasoning_effort,
"response_format": response_format,
"temperature": temperature,
"tool_resources": tool_resources,
src/openai/resources/chat/completions.py
@@ -82,7 +82,7 @@ class Completions(SyncAPIResource):
parallel_tool_calls: bool | NotGiven = NOT_GIVEN,
prediction: Optional[ChatCompletionPredictionContentParam] | NotGiven = NOT_GIVEN,
presence_penalty: Optional[float] | NotGiven = NOT_GIVEN,
- reasoning_effort: ChatCompletionReasoningEffort | NotGiven = NOT_GIVEN,
+ reasoning_effort: Optional[ChatCompletionReasoningEffort] | NotGiven = NOT_GIVEN,
response_format: completion_create_params.ResponseFormat | NotGiven = NOT_GIVEN,
seed: Optional[int] | NotGiven = NOT_GIVEN,
service_tier: Optional[Literal["auto", "default"]] | NotGiven = NOT_GIVEN,
@@ -213,7 +213,7 @@ class Completions(SyncAPIResource):
whether they appear in the text so far, increasing the model's likelihood to
talk about new topics.
- reasoning_effort: **o1 models only**
+ reasoning_effort: **o1 and o3-mini models only**
Constrains effort on reasoning for
[reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently
@@ -335,7 +335,7 @@ class Completions(SyncAPIResource):
parallel_tool_calls: bool | NotGiven = NOT_GIVEN,
prediction: Optional[ChatCompletionPredictionContentParam] | NotGiven = NOT_GIVEN,
presence_penalty: Optional[float] | NotGiven = NOT_GIVEN,
- reasoning_effort: ChatCompletionReasoningEffort | NotGiven = NOT_GIVEN,
+ reasoning_effort: Optional[ChatCompletionReasoningEffort] | NotGiven = NOT_GIVEN,
response_format: completion_create_params.ResponseFormat | NotGiven = NOT_GIVEN,
seed: Optional[int] | NotGiven = NOT_GIVEN,
service_tier: Optional[Literal["auto", "default"]] | NotGiven = NOT_GIVEN,
@@ -472,7 +472,7 @@ class Completions(SyncAPIResource):
whether they appear in the text so far, increasing the model's likelihood to
talk about new topics.
- reasoning_effort: **o1 models only**
+ reasoning_effort: **o1 and o3-mini models only**
Constrains effort on reasoning for
[reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently
@@ -587,7 +587,7 @@ class Completions(SyncAPIResource):
parallel_tool_calls: bool | NotGiven = NOT_GIVEN,
prediction: Optional[ChatCompletionPredictionContentParam] | NotGiven = NOT_GIVEN,
presence_penalty: Optional[float] | NotGiven = NOT_GIVEN,
- reasoning_effort: ChatCompletionReasoningEffort | NotGiven = NOT_GIVEN,
+ reasoning_effort: Optional[ChatCompletionReasoningEffort] | NotGiven = NOT_GIVEN,
response_format: completion_create_params.ResponseFormat | NotGiven = NOT_GIVEN,
seed: Optional[int] | NotGiven = NOT_GIVEN,
service_tier: Optional[Literal["auto", "default"]] | NotGiven = NOT_GIVEN,
@@ -724,7 +724,7 @@ class Completions(SyncAPIResource):
whether they appear in the text so far, increasing the model's likelihood to
talk about new topics.
- reasoning_effort: **o1 models only**
+ reasoning_effort: **o1 and o3-mini models only**
Constrains effort on reasoning for
[reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently
@@ -838,7 +838,7 @@ class Completions(SyncAPIResource):
parallel_tool_calls: bool | NotGiven = NOT_GIVEN,
prediction: Optional[ChatCompletionPredictionContentParam] | NotGiven = NOT_GIVEN,
presence_penalty: Optional[float] | NotGiven = NOT_GIVEN,
- reasoning_effort: ChatCompletionReasoningEffort | NotGiven = NOT_GIVEN,
+ reasoning_effort: Optional[ChatCompletionReasoningEffort] | NotGiven = NOT_GIVEN,
response_format: completion_create_params.ResponseFormat | NotGiven = NOT_GIVEN,
seed: Optional[int] | NotGiven = NOT_GIVEN,
service_tier: Optional[Literal["auto", "default"]] | NotGiven = NOT_GIVEN,
@@ -946,7 +946,7 @@ class AsyncCompletions(AsyncAPIResource):
parallel_tool_calls: bool | NotGiven = NOT_GIVEN,
prediction: Optional[ChatCompletionPredictionContentParam] | NotGiven = NOT_GIVEN,
presence_penalty: Optional[float] | NotGiven = NOT_GIVEN,
- reasoning_effort: ChatCompletionReasoningEffort | NotGiven = NOT_GIVEN,
+ reasoning_effort: Optional[ChatCompletionReasoningEffort] | NotGiven = NOT_GIVEN,
response_format: completion_create_params.ResponseFormat | NotGiven = NOT_GIVEN,
seed: Optional[int] | NotGiven = NOT_GIVEN,
service_tier: Optional[Literal["auto", "default"]] | NotGiven = NOT_GIVEN,
@@ -1077,7 +1077,7 @@ class AsyncCompletions(AsyncAPIResource):
whether they appear in the text so far, increasing the model's likelihood to
talk about new topics.
- reasoning_effort: **o1 models only**
+ reasoning_effort: **o1 and o3-mini models only**
Constrains effort on reasoning for
[reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently
@@ -1199,7 +1199,7 @@ class AsyncCompletions(AsyncAPIResource):
parallel_tool_calls: bool | NotGiven = NOT_GIVEN,
prediction: Optional[ChatCompletionPredictionContentParam] | NotGiven = NOT_GIVEN,
presence_penalty: Optional[float] | NotGiven = NOT_GIVEN,
- reasoning_effort: ChatCompletionReasoningEffort | NotGiven = NOT_GIVEN,
+ reasoning_effort: Optional[ChatCompletionReasoningEffort] | NotGiven = NOT_GIVEN,
response_format: completion_create_params.ResponseFormat | NotGiven = NOT_GIVEN,
seed: Optional[int] | NotGiven = NOT_GIVEN,
service_tier: Optional[Literal["auto", "default"]] | NotGiven = NOT_GIVEN,
@@ -1336,7 +1336,7 @@ class AsyncCompletions(AsyncAPIResource):
whether they appear in the text so far, increasing the model's likelihood to
talk about new topics.
- reasoning_effort: **o1 models only**
+ reasoning_effort: **o1 and o3-mini models only**
Constrains effort on reasoning for
[reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently
@@ -1451,7 +1451,7 @@ class AsyncCompletions(AsyncAPIResource):
parallel_tool_calls: bool | NotGiven = NOT_GIVEN,
prediction: Optional[ChatCompletionPredictionContentParam] | NotGiven = NOT_GIVEN,
presence_penalty: Optional[float] | NotGiven = NOT_GIVEN,
- reasoning_effort: ChatCompletionReasoningEffort | NotGiven = NOT_GIVEN,
+ reasoning_effort: Optional[ChatCompletionReasoningEffort] | NotGiven = NOT_GIVEN,
response_format: completion_create_params.ResponseFormat | NotGiven = NOT_GIVEN,
seed: Optional[int] | NotGiven = NOT_GIVEN,
service_tier: Optional[Literal["auto", "default"]] | NotGiven = NOT_GIVEN,
@@ -1588,7 +1588,7 @@ class AsyncCompletions(AsyncAPIResource):
whether they appear in the text so far, increasing the model's likelihood to
talk about new topics.
- reasoning_effort: **o1 models only**
+ reasoning_effort: **o1 and o3-mini models only**
Constrains effort on reasoning for
[reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently
@@ -1702,7 +1702,7 @@ class AsyncCompletions(AsyncAPIResource):
parallel_tool_calls: bool | NotGiven = NOT_GIVEN,
prediction: Optional[ChatCompletionPredictionContentParam] | NotGiven = NOT_GIVEN,
presence_penalty: Optional[float] | NotGiven = NOT_GIVEN,
- reasoning_effort: ChatCompletionReasoningEffort | NotGiven = NOT_GIVEN,
+ reasoning_effort: Optional[ChatCompletionReasoningEffort] | NotGiven = NOT_GIVEN,
response_format: completion_create_params.ResponseFormat | NotGiven = NOT_GIVEN,
seed: Optional[int] | NotGiven = NOT_GIVEN,
service_tier: Optional[Literal["auto", "default"]] | NotGiven = NOT_GIVEN,
src/openai/types/beta/threads/run_create_params.py
@@ -106,6 +106,15 @@ class RunCreateParamsBase(TypedDict, total=False):
during tool use.
"""
+ reasoning_effort: Optional[Literal["low", "medium", "high"]]
+ """**o1 and o3-mini models only**
+
+ Constrains effort on reasoning for
+ [reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently
+ supported values are `low`, `medium`, and `high`. Reducing reasoning effort can
+ result in faster responses and fewer tokens used on reasoning in a response.
+ """
+
response_format: Optional[AssistantResponseFormatOptionParam]
"""Specifies the format that the model must output.
src/openai/types/beta/assistant_create_params.py
@@ -3,7 +3,7 @@
from __future__ import annotations
from typing import List, Union, Iterable, Optional
-from typing_extensions import Required, TypedDict
+from typing_extensions import Literal, Required, TypedDict
from ..chat_model import ChatModel
from .assistant_tool_param import AssistantToolParam
@@ -53,6 +53,15 @@ class AssistantCreateParams(TypedDict, total=False):
name: Optional[str]
"""The name of the assistant. The maximum length is 256 characters."""
+ reasoning_effort: Optional[Literal["low", "medium", "high"]]
+ """**o1 and o3-mini models only**
+
+ Constrains effort on reasoning for
+ [reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently
+ supported values are `low`, `medium`, and `high`. Reducing reasoning effort can
+ result in faster responses and fewer tokens used on reasoning in a response.
+ """
+
response_format: Optional[AssistantResponseFormatOptionParam]
"""Specifies the format that the model must output.
src/openai/types/beta/assistant_update_params.py
@@ -2,8 +2,8 @@
from __future__ import annotations
-from typing import List, Iterable, Optional
-from typing_extensions import TypedDict
+from typing import List, Union, Iterable, Optional
+from typing_extensions import Literal, TypedDict
from .assistant_tool_param import AssistantToolParam
from ..shared_params.metadata import Metadata
@@ -32,7 +32,39 @@ class AssistantUpdateParams(TypedDict, total=False):
a maximum length of 512 characters.
"""
- model: str
+ model: Union[
+ str,
+ Literal[
+ "o3-mini",
+ "o3-mini-2025-01-31",
+ "o1",
+ "o1-2024-12-17",
+ "gpt-4o",
+ "gpt-4o-2024-11-20",
+ "gpt-4o-2024-08-06",
+ "gpt-4o-2024-05-13",
+ "gpt-4o-mini",
+ "gpt-4o-mini-2024-07-18",
+ "gpt-4-turbo",
+ "gpt-4-turbo-2024-04-09",
+ "gpt-4-0125-preview",
+ "gpt-4-turbo-preview",
+ "gpt-4-1106-preview",
+ "gpt-4-vision-preview",
+ "gpt-4",
+ "gpt-4-0314",
+ "gpt-4-0613",
+ "gpt-4-32k",
+ "gpt-4-32k-0314",
+ "gpt-4-32k-0613",
+ "gpt-3.5-turbo",
+ "gpt-3.5-turbo-16k",
+ "gpt-3.5-turbo-0613",
+ "gpt-3.5-turbo-1106",
+ "gpt-3.5-turbo-0125",
+ "gpt-3.5-turbo-16k-0613",
+ ],
+ ]
"""ID of the model to use.
You can use the
@@ -45,6 +77,15 @@ class AssistantUpdateParams(TypedDict, total=False):
name: Optional[str]
"""The name of the assistant. The maximum length is 256 characters."""
+ reasoning_effort: Optional[Literal["low", "medium", "high"]]
+ """**o1 and o3-mini models only**
+
+ Constrains effort on reasoning for
+ [reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently
+ supported values are `low`, `medium`, and `high`. Reducing reasoning effort can
+ result in faster responses and fewer tokens used on reasoning in a response.
+ """
+
response_format: Optional[AssistantResponseFormatOptionParam]
"""Specifies the format that the model must output.
src/openai/types/chat/chat_completion_reasoning_effort.py
@@ -1,7 +1,8 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+from typing import Optional
from typing_extensions import Literal, TypeAlias
__all__ = ["ChatCompletionReasoningEffort"]
-ChatCompletionReasoningEffort: TypeAlias = Literal["low", "medium", "high"]
+ChatCompletionReasoningEffort: TypeAlias = Optional[Literal["low", "medium", "high"]]
src/openai/types/chat/completion_create_params.py
@@ -174,8 +174,8 @@ class CompletionCreateParamsBase(TypedDict, total=False):
far, increasing the model's likelihood to talk about new topics.
"""
- reasoning_effort: ChatCompletionReasoningEffort
- """**o1 models only**
+ reasoning_effort: Optional[ChatCompletionReasoningEffort]
+ """**o1 and o3-mini models only**
Constrains effort on reasoning for
[reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently
tests/api_resources/beta/threads/test_runs.py
@@ -56,6 +56,7 @@ class TestRuns:
metadata={"foo": "string"},
model="gpt-4o",
parallel_tool_calls=True,
+ reasoning_effort="low",
response_format="auto",
stream=False,
temperature=1,
@@ -139,6 +140,7 @@ class TestRuns:
metadata={"foo": "string"},
model="gpt-4o",
parallel_tool_calls=True,
+ reasoning_effort="low",
response_format="auto",
temperature=1,
tool_choice="none",
@@ -552,6 +554,7 @@ class TestAsyncRuns:
metadata={"foo": "string"},
model="gpt-4o",
parallel_tool_calls=True,
+ reasoning_effort="low",
response_format="auto",
stream=False,
temperature=1,
@@ -635,6 +638,7 @@ class TestAsyncRuns:
metadata={"foo": "string"},
model="gpt-4o",
parallel_tool_calls=True,
+ reasoning_effort="low",
response_format="auto",
temperature=1,
tool_choice="none",
tests/api_resources/beta/test_assistants.py
@@ -36,6 +36,7 @@ class TestAssistants:
instructions="instructions",
metadata={"foo": "string"},
name="name",
+ reasoning_effort="low",
response_format="auto",
temperature=1,
tool_resources={
@@ -132,8 +133,9 @@ class TestAssistants:
description="description",
instructions="instructions",
metadata={"foo": "string"},
- model="model",
+ model="string",
name="name",
+ reasoning_effort="low",
response_format="auto",
temperature=1,
tool_resources={
@@ -268,6 +270,7 @@ class TestAsyncAssistants:
instructions="instructions",
metadata={"foo": "string"},
name="name",
+ reasoning_effort="low",
response_format="auto",
temperature=1,
tool_resources={
@@ -364,8 +367,9 @@ class TestAsyncAssistants:
description="description",
instructions="instructions",
metadata={"foo": "string"},
- model="model",
+ model="string",
name="name",
+ reasoning_effort="low",
response_format="auto",
temperature=1,
tool_resources={
.stats.yml
@@ -1,2 +1,2 @@
configured_endpoints: 69
-openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai-fc5dbc19505b0035f9e7f88868619f4fb519b048bde011f6154f3132d4be71fb.yml
+openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai-7c699d4503077d06a4a44f52c0c1f902d19a87c766b8be75b97c8dfd484ad4aa.yml