asa-api / Tests /example_API_call.R
cjerzak's picture
add files
f23dbdb
raw
history blame contribute delete
413 Bytes
library(httr2)
library(jsonlite)
base_url <- "http://localhost:7860"
resp <- request(paste0(base_url, "/v1/run")) |>
req_headers(
`Content-Type` = "application/json",
Authorization = "Bearer 999"
) |>
req_body_json(list(prompt = "Return the single word OK."), auto_unbox = TRUE) |>
req_perform()
result <- resp_body_json(resp, simplifyVector = TRUE)
print(result$status)
print(result$message)