add error handling
If response code isn't 200, show warning message
diff --git a/R/gpt3_single_completion.R b/R/gpt3_single_completion.R
index f8df93a..1f7dcee 100644
--- a/R/gpt3_single_completion.R
+++ b/R/gpt3_single_completion.R
@@ -101,6 +101,11 @@
request_content = httr::content(request_base)
# request_content = httr::content(request_base, encoding = "Latin-ASCII")
+ if(request_base$status_code != 200){
+ warning(paste0("Request completed with error. Code: ", request_base$status_code
+ , ", message: ", request_content$error$message))
+ }
+
if(n == 1){
core_output = data.table::data.table('n' = 1
, 'prompt' = prompt_input