File size: 413 Bytes
f9e7b9c
 
 
 
a59174a
f9e7b9c
 
f23dbdb
 
 
 
f9e7b9c
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18

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)