Skip to contents

Process httr2 response object

Usage

resp_process(
  resp,
  output = c("df", "jsonlist", "raw", "resp", "text", "tools")
)

Arguments

resp

A httr2 response object.

output

The output format. Default is "df". Other options are "jsonlist", "raw", "resp" (httr2 response object), "text", "tools" (tool_calls), "structured" (structured output).

Value

A data frame, json list, raw or httr2 response object.

Examples

if (FALSE) { # test_connection(logical = TRUE)
resp <- list_models("resp")
resp_process(resp, "df") # parse response to dataframe/tibble
resp_process(resp, "jsonlist") # parse response to list
resp_process(resp, "raw") # parse response to raw string
resp_process(resp, "text") # return text/character vector
resp_process(resp, "tools") # return tool_calls
}