アシスタントを作ります
POST
https://api.openai.com/v1/assistants
Request
Authorization
Provide your bearer token in the
Authorization
header when making requests to protected resources.Example:
Authorization: Bearer ********************
Body Params application/json
model
string
required
name
string
optional
description
string
optional
instructions
string
optional
tools
array [object {1}]
optional
code_interpreter
、retrieval
、 或function
。type
string
optional
file_ids
array[string]
optional
metadata
object
optional
Example
{
"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"
}
Request samples
Shell
JavaScript
Java
Swift
Go
PHP
Python
HTTP
C
C#
Objective-C
Ruby
OCaml
Dart
R
Request Request Example
Shell
JavaScript
Java
Swift
curl --location --request POST 'https://api.openai.com/v1/assistants' \
--header 'Content-Type: application/json' \
--data-raw '{
"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"
}'
Responses
🟢200成功
application/json
Body
id
string
required
object
string
required
created_at
integer
required
name
string
required
description
null
required
model
string
required
instructions
string
required
tools
array [object {1}]
required
type
string
optional
file_ids
array[string]
required
metadata
object
required
Example
{
"id": "asst_abc123",
"object": "assistant",
"created_at": 1698984975,
"name": "Math Tutor",
"description": null,
"model": "gpt-4",
"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": {}
}
Modified at 2024-12-17 03:36:16