Skip to contents

Retrieve file information

Usage

file_info(file_id)

Arguments

file_id

(chr) The id of the file to retrieve.

Value

(tibble) information about the file

See also

Examples

 sys_prompt <- compose_sys_prompt("You are a funny assistant.")
 usr_prompt <- compose_usr_prompt(
   "Tell me a joke ending in:"
 )
 prompter <- create_usr_data_prompter(usr_prompt = usr_prompt)
 text <-  c(
   "deadly boring!",
   "A bit boring, but interesting",
   "How nice, I loved it!"
 )

 jsonl_text <- text |>
   purrr::map(
     \(x) {
       compose_prompt_api(
         sys_prompt = sys_prompt,
         usr_prompt = prompter(x)
       )
     }
   ) |>
   create_jsonl_records()
 out_jsonl_path <- write_jsonl_files(jsonl_text, tempdir())

uploaded_file_info <- file_upload(out_jsonl_path)
#> Error: API request failed [401]:
#> 
#> Invalid authorization header
files <- file_list()
#> Error: API request failed [401]:
#> 
#> Invalid authorization header
file_info(files[["id"]][[1]])
#> Error: Failed to evaluate glue component {file_id}
#> Caused by error:
#> ! object 'files' not found
file_delete(uploaded_file_info[["id"]])
#> Error: Failed to evaluate glue component {file_id}
#> Caused by error:
#> ! object 'uploaded_file_info' not found