Modify assistant
Modifies an assistant.
Path parameters
assistant_id
string
Required
The ID of the assistant to modify.
Request body
model
string
ID of the model to use. You can use the List models API to see all of your available models, or see our Model overview for descriptions of them.
model
string
model
string
gpt-4.1
string
gpt-4.1-mini
string
gpt-4.1-nano
string
gpt-4.1-2025-04-14
string
gpt-4.1-mini-2025-04-14
string
gpt-4.1-nano-2025-04-14
string
o3-mini
string
o3-mini-2025-01-31
string
o1
string
o1-2024-12-17
string
gpt-4o
string
gpt-4o-2024-11-20
string
gpt-4o-2024-08-06
string
gpt-4o-2024-05-13
string
gpt-4o-mini
string
gpt-4o-mini-2024-07-18
string
gpt-4.5-preview
string
gpt-4.5-preview-2025-02-27
string
gpt-4-turbo
string
gpt-4-turbo-2024-04-09
string
gpt-4-0125-preview
string
gpt-4-turbo-preview
string
gpt-4-1106-preview
string
gpt-4-vision-preview
string
gpt-4
string
gpt-4-0314
string
gpt-4-0613
string
gpt-4-32k
string
gpt-4-32k-0314
string
gpt-4-32k-0613
string
gpt-3.5-turbo
string
gpt-3.5-turbo-16k
string
gpt-3.5-turbo-0613
string
gpt-3.5-turbo-1106
string
gpt-3.5-turbo-0125
string
gpt-3.5-turbo-16k-0613
string
reasoning_effort
string or null
Defaults: medium
o-series models only
Constrains effort on reasoning for reasoning models. Currently supported values are
low
,medium
, andhigh
. Reducing reasoning effort can result in faster responses and fewer tokens used on reasoning in a response.low
string
medium
string
high
string
name
string or null
The name of the assistant. The maximum length is 256 characters.description
string or null
The description of the assistant. The maximum length is 512 characters.instructions
string or null
The system instructions that the assistant uses. The maximum length is 256,000 characters.tools
array
Defaults:
A list of tool enabled on the assistant. There can be a maximum of 128 tools per assistant. Tools can be of types
code_interpreter
,file_search
, orfunction
.Code interpreter tool
object
type
string
Required
The type of tool being defined:
code_interpreter
code_interpreter
string
FileSearch tool
object
type
string
Required
The type of tool being defined:
file_search
file_search
string
file_search
object
Overrides for the file search tool.max_num_results
integer
The maximum number of results the file search tool should output. The default is 20 for
gpt-4*
models and 5 forgpt-3.5-turbo
. This number should be between 1 and 50 inclusive.Note that the file search tool may output fewer than
max_num_results
results. See the file search tool documentation for more information.ranking_options
object
The ranking options for the file search. If not specified, the file search tool will use the
auto
ranker and a score_threshold of 0.See the file search tool documentation for more information.
ranker
string
The ranker to use for the file search. If not specified will use the
auto
ranker.auto
string
default_2024_08_21
string
score_threshold
number
Required
The score threshold for the file search. All values must be a floating point number between 0 and 1.
Function tool
object
type
string
Required
The type of tool being defined:
function
function
string
function
object
Required
description
string
A description of what the function does, used by the model to choose when and how to call the function.name
string
Required
The name of the function to be called. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64.parameters
object
The parameters the functions accepts, described as a JSON Schema object. See the guide for examples, and the JSON Schema reference for documentation about the format.
Omitting
parameters
defines a function with an empty parameter list.strict
boolean or null
Defaults: false
Whether to enable strict schema adherence when generating the function call. If set to true, the model will follow the exact schema defined in the
parameters
field. Only a subset of JSON Schema is supported whenstrict
istrue
. Learn more about Structured Outputs in the .
tool_resources
object or null
A set of resources that are used by the assistant's tools. The resources are specific to the type of tool. For example, the
code_interpreter
tool requires a list of file IDs, while thefile_search
tool requires a list of vector store IDs.code_interpreter
object
file_ids
array
Defaults:
Overrides the list of file IDs made available to the
code_interpreter
tool. There can be a maximum of 20 files associated with the tool.items
string
file_search
object
vector_store_ids
array
Overrides the vector store attached to this assistant. There can be a maximum of 1 vector store attached to the assistant.
items
string
metadata
object or null
Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format, and querying for objects via API or the dashboard. Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters.temperature
number or null
Defaults: 1
What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.top_p
number or null
Defaults: 1
An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered. We generally recommend altering this or temperature but not both.response_format
string or object
Specifies the format that the model must output. Compatible with GPT-4o, GPT-4 Turbo, and all GPT-3.5 Turbo models since
gpt-3.5-turbo-1106
.Setting to
enables Structured Outputs which ensures the model will match your supplied JSON schema. Learn more in the Structured Outputs guide.
Setting to
enables JSON mode, which ensures the message the model generates is valid JSON.
Important: when using JSON mode, you must also instruct the model to produce JSON yourself via a system or user message. Without this, the model may generate an unending stream of whitespace until the generation reaches the token limit, resulting in a long-running and seemingly "stuck" request. Also note that the message content may be partially cut off if
finish_reason="length"
, which indicates the generation exceededmax_tokens
or the conversation exceeded the max context length.response_format
string
auto
is the default valueauto
string
Text
object
Default response format. Used to generate text responses.type
string
Required
The type of response format being defined. Always
text
.text
string
JSON object
object
JSON object response format. An older method of generating JSON responses. Using
json_schema
is recommended for models that support it. Note that the model will not generate JSON without a system or user message instructing it to do so.type
string
Required
The type of response format being defined. Always
json_object
.json_object
string
JSON schema
object
JSON Schema response format. Used to generate structured JSON responses. Learn more about Structured Outputs.
type
string
Required
The type of response format being defined. Always
json_schema
.json_schema
string
json_schema
object
Required
Structured Outputs configuration options, including a JSON Schema.description
string
A description of what the response format is for, used by the model to determine how to respond in the format.name
string
Required
The name of the response format. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64.schema
object
The schema for the response format, described as a JSON Schema object. Learn how to build JSON schemas here.
strict
boolean or null
Defaults: false
Whether to enable strict schema adherence when generating the output. If set to true, the model will always follow the exact schema defined in the
schema
field. Only a subset of JSON Schema is supported whenstrict
istrue
. To learn more, read the Structured Outputs guide.
Response
The modified assistant object.
1 curl https://api.openai.com/v1/assistants/asst_abc123 \2 -H "Content-Type: application/json" \3 -H "Authorization: Bearer $OPENAI_API_KEY" \4 -H "OpenAI-Beta: assistants=v2" \5 -d '{6 "instructions": "You are an HR bot, and you have access to files to answer employee questions about company policies. Always response with info from either of the files.",7 "tools": [{"type": "file_search"}],8 "model": "gpt-4o"9 }'
1 {2 "id": "asst_123",3 "object": "assistant",4 "created_at": 1699009709,5 "name": "HR Helper",6 "description": null,7 "model": "gpt-4o",8 "instructions": "You are an HR bot, and you have access to files to answer employee questions about company policies. Always response with info from either of the files.",9 "tools": [10 {11 "type": "file_search"12 }13 ],14 "tool_resources": {15 "file_search": {16 "vector_store_ids": []17 }18 },19 "metadata": {},20 "top_p": 1.0,21 "temperature": 1.0,22 "response_format": "auto"23 }