A Thread stores the message history of a conversation with an Assistant. Threads are persistent: they accumulate messages over multiple runs and can be retrieved at any time.
$runsRunsClient — Create and manage runs on threads
$messagesMessagesClient — Add and read thread messages
Create a thread: client$threads$create()
Add user message: client$threads$messages$create(thread_id, "user", "...")
Create a run: client$threads$runs$create(thread_id, assistant_id)
Poll run until $status == "completed"
Read response: client$threads$messages$list(thread_id)
new()ThreadsClient$new(parent)
create()ThreadsClient$create(messages = NULL, tool_resources = NULL, metadata = NULL)
retrieve()ThreadsClient$retrieve(thread_id)
update()ThreadsClient$update(thread_id, ...)
delete()ThreadsClient$delete(thread_id)
create_and_run()ThreadsClient$create_and_run(
assistant_id,
thread = NULL,
model = NULL,
instructions = NULL,
tools = NULL,
tool_resources = NULL,
metadata = NULL,
stream = NULL,
callback = NULL
)
clone()The objects of this class are cloneable with this method.
ThreadsClient$clone(deep = FALSE)deepWhether to make a deep clone.
Client for the OpenAI Threads API v2 (Beta).
Threads are persistent conversation containers for Assistants.
Access via client$threads.