fix to encoding issue; no forcing fill=T for error handling
diff --git a/R/gpt3_completions.R b/R/gpt3_completions.R
index c0338ea..7414e35 100644
--- a/R/gpt3_completions.R
+++ b/R/gpt3_completions.R
@@ -115,8 +115,15 @@
}
- bunch_core_output = data.table::rbindlist(empty_list)
- bunch_meta_output = data.table::rbindlist(meta_list)
+
+ bunch_core_output = try(data.table::rbindlist(empty_list), silent = T)
+ if("try-error" %in% class(bunch_core_output)){
+ bunch_core_output = data.table::rbindlist(empty_list, fill = T)
+ }
+ bunch_meta_output = try(data.table::rbindlist(meta_list), silent = T)
+ if("try-error" %in% class(bunch_meta_output)){
+ bunch_meta_output = data.table::rbindlist(meta_list, fill = T)
+ }
if(param_output_type == 'complete'){
output = list(bunch_core_output
diff --git a/R/gpt3_single_completion.R b/R/gpt3_single_completion.R
index bbf5495..f8df93a 100644
--- a/R/gpt3_single_completion.R
+++ b/R/gpt3_single_completion.R
@@ -99,6 +99,7 @@
, encode = "json")
request_content = httr::content(request_base)
+ # request_content = httr::content(request_base, encoding = "Latin-ASCII")
if(n == 1){
core_output = data.table::data.table('n' = 1
diff --git a/README.md b/README.md
index cd99ddc..9b35226 100644
--- a/README.md
+++ b/README.md
@@ -175,6 +175,7 @@
## Changelog/updates
- [update] 29 Nov 2022: the just released [davinci-003 model](https://beta.openai.com/docs/models/gpt-3) for text completions is now the default model for the text completion functions.
+- [minor fix] 3 Dec 2022: included handling for encoding issues so that `rbindlist` uses `fill=T` (in `gpt3_completions(...)`)
## Citation
diff --git a/rgpt3_0.3.pdf b/rgpt3_0.3.pdf
index 3afadb6..8006a72 100644
--- a/rgpt3_0.3.pdf
+++ b/rgpt3_0.3.pdf
Binary files differ