Learn R Programming

openaiRtools (version 0.2.2)

retrieve_file: Retrieve File Metadata (Convenience Function)

Description

Shortcut that creates an OpenAI client from the OPENAI_API_KEY environment variable and retrieves metadata for a specific file.

Usage

retrieve_file(file_id)

Value

A file object with $id, $filename, $bytes, $purpose, $status, and $created_at.

Arguments

file_id

Character. Required. The file ID (e.g. "file-abc123").

Examples

Run this code
if (FALSE) {
Sys.setenv(OPENAI_API_KEY = "sk-xxxxxx")

info <- retrieve_file("file-abc123")
cat("Filename:", info$filename)
cat("Status:", info$status) # "processed"
}

Run the code above in your browser using DataLab