Create assistant
Deprecated
client.beta.assistants.create(AssistantCreateParams { model, description, instructions, 8 more } body, RequestOptionsoptions?): Assistant { id, created_at, description, 10 more }
POST/assistants
Create assistant
import OpenAI from "openai";
const openai = new OpenAI();
async function main() {
const myAssistant = await openai.beta.assistants.create({
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-4o",
});
console.log(myAssistant);
}
main();{
"id": "asst_abc123",
"object": "assistant",
"created_at": 1698984975,
"name": "Math Tutor",
"description": null,
"model": "gpt-4o",
"instructions": "You are a personal math tutor. When asked a question, write and run Python code to answer the question.",
"tools": [
{
"type": "code_interpreter"
}
],
"metadata": {},
"top_p": 1.0,
"temperature": 1.0,
"response_format": "auto"
}
Create assistant
import OpenAI from "openai";
const openai = new OpenAI();
async function main() {
const myAssistant = await openai.beta.assistants.create({
instructions:
"You are an HR bot, and you have access to files to answer employee questions about company policies.",
name: "HR Helper",
tools: [{ type: "file_search" }],
tool_resources: {
file_search: {
vector_store_ids: ["vs_123"]
}
},
model: "gpt-4o"
});
console.log(myAssistant);
}
main();{
"id": "asst_abc123",
"object": "assistant",
"created_at": 1699009403,
"name": "HR Helper",
"description": null,
"model": "gpt-4o",
"instructions": "You are an HR bot, and you have access to files to answer employee questions about company policies.",
"tools": [
{
"type": "file_search"
}
],
"tool_resources": {
"file_search": {
"vector_store_ids": ["vs_123"]
}
},
"metadata": {},
"top_p": 1.0,
"temperature": 1.0,
"response_format": "auto"
}
Returns Examples
{
"id": "id",
"created_at": 0,
"description": "description",
"instructions": "instructions",
"metadata": {
"foo": "string"
},
"model": "model",
"name": "name",
"object": "assistant",
"tools": [
{}
],
"response_format": "auto",
"temperature": 1,
"tool_resources": {
"code_interpreter": {
"file_ids": [
"string"
]
},
"file_search": {
"vector_store_ids": [
"string"
]
}
},
"top_p": 1
}