Assistant API

Assistants are AI-driven entities with assigned roles and instructions, allowing them to process messages, use tools, and maintain context within threads for structured and interactive responses. One Assistant can be used across multiple Threads and users.

This page provides API schemas for the following methods:

https://api.apilaplas.com/assistants

https://api.apilaplas.com/assistants/{assistantId}

https://api.apilaplas.com/assistants/{assistantId}

https://api.apilaplas.com/assistants/{assistantId}

After each API schema, you'll find a short example demonstrating how to correctly call the described method in code using the OpenAI SDK.

API Schemas

Create an Assistant

Create an Assistant with a model and instructions.

Python + OpenAI SDK Example:

from openai import OpenAI
client = OpenAI()

assistant = client.beta.assistants.create(
  name="Math Tutor",
  instructions="You are a personal math tutor. Write and run code to answer math questions.",
  tools=[{"type": "code_interpreter"}],
  model="gpt-4o",
)

Retrieve a list of Assistants along with their parameters

Python + OpenAI SDK Example:

from openai import OpenAI
client = OpenAI()

my_assistants = client.beta.assistants.list(
    order="desc",
    limit="20",
)
print(my_assistants.data)

Retrieve information about a specific Assistant by its ID

Python + OpenAI SDK Example:

from openai import OpenAI
client = OpenAI()

my_assistant = client.beta.assistants.retrieve("asst_abc123")
print(my_assistant)

Modify a specific Assistant by its ID

Python + OpenAI SDK Example:

from openai import OpenAI
client = OpenAI()

my_updated_assistant = client.beta.assistants.update(
  "asst_abc123",
  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.",
  name="HR Helper",
  tools=[{"type": "file_search"}],
  model="gpt-4o"
)

print(my_updated_assistant)

Delete a specific Assistant by its ID

Python + OpenAI SDK Example:

from openai import OpenAI
client = OpenAI()

response = client.beta.assistants.delete("asst_abc123")
print(response)

Last updated