103 Helper to extract the content of the first choice

extract_caption <- function(res) { if (length(res\(choices) > 0) { out <- res\)choices[[1]]\(message\)content # Clean whitespace str_trim(out) } else { NA_character_ } }