added error handling to embeddings
diff --git a/R/gpt3_single_completion.R b/R/gpt3_single_completion.R
index 1f7dcee..abe6bfb 100644
--- a/R/gpt3_single_completion.R
+++ b/R/gpt3_single_completion.R
@@ -99,7 +99,6 @@
, encode = "json")
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
diff --git a/R/gpt3_single_embedding.R b/R/gpt3_single_embedding.R
index 1e475c0..5f4dec0 100644
--- a/R/gpt3_single_embedding.R
+++ b/R/gpt3_single_embedding.R
@@ -40,6 +40,10 @@
, httr::add_headers(Authorization = paste("Bearer", api_key))
, encode = "json")
+ if(request_base$status_code != 200){
+ warning(paste0("Request completed with error. Code: ", request_base$status_code
+ , ", message: ", request_content$error$message))
+ }
output_base = httr::content(request_base)