亮色模式
Create assistant (v1)
POST
https://api.openai.com/v1/assistantsCreate an assistant with a model and instructions.
Request
Header 参数
Content-Type
string
必需
示例值:
application/json
Authorization
string
必需
示例值:
Bearer $OPENAI_API_KEY
OpenAI-Beta
string
必需
示例值:
assistants=v1
Body 参数application/json
instructions
string
必需
The system instructions that the assistant uses. The maximum length is 256,000 characters.
name
string
必需
The name of the assistant. The maximum length is 256 characters.
tools
array [object {1}]
必需
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
, retrieval
, or function
.
type
string
可选
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. type: string
示例
{
"instructions": "You are a personal math tutor. When asked a question, write and run Python code to answer the question.",
"name": "Math Tutor",
"tools": [
{
"type": "code_interpreter"
}
],
"model": "gpt-4-turbo"
}
Request samples
返回响应
Success(200)
HTTP Code: 200
Content Type : JSONapplication/json
数据结构
id
string
必需
object
string
必需
created_at
integer
必需
name
string
必需
description
null
必需
model
string
必需
instructions
string
必需
tools
array [object {1}]
必需
type
string
可选
file_ids
array[string]
必需
metadata
object
必需
top_p
integer
必需
temperature
integer
必需
response_format
string
必需
示例
{
"id": "asst_abc123",
"object": "assistant",
"created_at": 1698984975,
"name": "Math Tutor",
"description": null,
"model": "gpt-4-turbo",
"instructions": "You are a personal math tutor. When asked a question, write and run Python code to answer the question.",
"tools": [
{
"type": "code_interpreter"
}
],
"file_ids": [],
"metadata": {},
"top_p": 1,
"temperature": 1,
"response_format": "auto"
}
最后修改时间: 10 天前