Learn R Programming

openaiRtools (version 0.2.2)

retrieve_thread: Retrieve a Thread (Convenience Function)

Description

Shortcut that creates an OpenAI client from the OPENAI_API_KEY environment variable and retrieves a thread.

Usage

retrieve_thread(thread_id)

Value

A thread object with $id, $created_at, and $metadata.

Arguments

thread_id

Character. Required. The thread ID to retrieve.

Examples

Run this code
if (FALSE) {
Sys.setenv(OPENAI_API_KEY = "sk-xxxxxx")
thread <- retrieve_thread("thread_abc123")
cat("Created at:", thread$created_at)
}

Run the code above in your browser using DataLab