Learn R Programming

openaiRtools (version 0.2.2)

cancel_run: Cancel a Run (Convenience Function)

Description

Shortcut that creates an OpenAI client from the OPENAI_API_KEY environment variable and cancels a running or queued run.

Usage

cancel_run(thread_id, run_id)

Value

A run object with $status = "cancelling".

Arguments

thread_id

Character. Required. The thread ID.

run_id

Character. Required. The run ID to cancel.

Examples

Run this code
if (FALSE) {
Sys.setenv(OPENAI_API_KEY = "sk-xxxxxx")
cancel_run("thread_abc123", "run_abc123")
}

Run the code above in your browser using DataLab