Create an assistant with a model and instructions.
POST /assistants
Authorizations
Request Body required
object
The name of the assistant. The maximum length is 256 characters.
The description of the assistant. The maximum length is 512 characters.
The system instructions that the assistant uses. The maximum length is 256,000 characters.
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
, or function
.
object
The type of tool being defined: code_interpreter
object
The type of tool being defined: file_search
Overrides for the file search tool.
object
The maximum number of results the file search tool should output. The default is 20 for gpt-4*
models and 5 for gpt-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.
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.
object
The ranker to use for the file search. If not specified will use the auto
ranker.
The score threshold for the file search. All values must be a floating point number between 0 and 1.
object
The type of tool being defined: function
object
A description of what the function does, used by the model to choose when and how to call the function.
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.
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.
object
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 when strict
is true
. Learn more about Structured Outputs in the function calling guide.
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 the file_search
tool requires a list of vector store IDs.
object
object
A list of file IDs made available to the code_interpreter
tool. There can be a maximum of 20 files associated with the tool.
object
The vector store attached to this assistant. There can be a maximum of 1 vector store attached to the assistant.
A helper to create a vector store with file_ids and attach it to this assistant. There can be a maximum of 1 vector store attached to the assistant.
object
A list of file IDs to add to the vector store. There can be a maximum of 10000 files in a vector store.
The default strategy. This strategy currently uses a max_chunk_size_tokens
of 800
and chunk_overlap_tokens
of 400
.
object
Always auto
.
object
Always static
.
object
The maximum number of tokens in each chunk. The default value is 800
. The minimum value is 100
and the maximum value is 4096
.
The number of tokens that overlap between chunks. The default value is 400
.
Note that the overlap must not exceed half of max_chunk_size_tokens
.
Set of 16 key-value pairs that can be attached to a vector store. This can be useful for storing additional information about the vector store in a structured format. Keys can be a maximum of 64 characters long and values can be a maximum of 512 characters long.
object
object
The vector store attached to this assistant. There can be a maximum of 1 vector store attached to the assistant.
A helper to create a vector store with file_ids and attach it to this assistant. There can be a maximum of 1 vector store attached to the assistant.
object
A list of file IDs to add to the vector store. There can be a maximum of 10000 files in a vector store.
The default strategy. This strategy currently uses a max_chunk_size_tokens
of 800
and chunk_overlap_tokens
of 400
.
object
Always auto
.
object
Always static
.
object
The maximum number of tokens in each chunk. The default value is 800
. The minimum value is 100
and the maximum value is 4096
.
The number of tokens that overlap between chunks. The default value is 400
.
Note that the overlap must not exceed half of max_chunk_size_tokens
.
Set of 16 key-value pairs that can be attached to a vector store. This can be useful for storing additional information about the vector store in a structured format. Keys can be a maximum of 64 characters long and values can be a maximum of 512 characters long.
object
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. Keys can be a maximum of 64 characters long and values can be a maximum of 512 characters long.
object
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.
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.
auto
is the default value
object
The type of response format being defined: text
object
The type of response format being defined: json_object
object
The type of response format being defined: json_schema
object
A description of what the response format is for, used by the model to determine how to respond in the format.
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.
The schema for the response format, described as a JSON Schema object.
object
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 when strict
is true
. To learn more, read the Structured Outputs guide.
Responses
200
OK
Represents an assistant
that can call the model and use tools.
object
The identifier, which can be referenced in API endpoints.
The object type, which is always assistant
.
The Unix timestamp (in seconds) for when the assistant was created.
The name of the assistant. The maximum length is 256 characters.
The description of the assistant. The maximum length is 512 characters.
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.
The system instructions that the assistant uses. The maximum length is 256,000 characters.
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
, or function
.
object
The type of tool being defined: code_interpreter
object
The type of tool being defined: file_search
Overrides for the file search tool.
object
The maximum number of results the file search tool should output. The default is 20 for gpt-4*
models and 5 for gpt-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.
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.
object
The ranker to use for the file search. If not specified will use the auto
ranker.
The score threshold for the file search. All values must be a floating point number between 0 and 1.
object
The type of tool being defined: function
object
A description of what the function does, used by the model to choose when and how to call the function.
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.
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.
object
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 when strict
is true
. Learn more about Structured Outputs in the function calling guide.
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 the file_search
tool requires a list of vector store IDs.
object
object
A list of file IDs made available to the `code_interpreter“ tool. There can be a maximum of 20 files associated with the tool.
object
The ID of the vector store attached to this assistant. There can be a maximum of 1 vector store attached to the assistant.
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. Keys can be a maximum of 64 characters long and values can be a maximum of 512 characters long.
object
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.
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.
auto
is the default value
object
The type of response format being defined: text
object
The type of response format being defined: json_object
object
The type of response format being defined: json_schema
object
A description of what the response format is for, used by the model to determine how to respond in the format.
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.
The schema for the response format, described as a JSON Schema object.
object
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 when strict
is true
. To learn more, read the Structured Outputs guide.