mlverse / chattr

https://mlverse.github.io/chattr/
Other
191 stars 20 forks source link

Error when submitting a prompt to chatgpt #108

Open DeianGG opened 4 months ago

DeianGG commented 4 months ago

I run the app using this code library(chattr) Sys.setenv("OPENAI_API_KEY" = "sk-........fV3D") chattr_use("gpt4") chattr_app()

and whenever I submit a prompt from the Viewer window on the right side i get this error image

Listening on http://127.0.0.1:4438 Error: ! in callr subprocess. Caused by error in _**`abort(req_result)`: ! `message` must be a character vector, not a object.**_ --- Subprocess backtrace: 1. chattr::ch_submit(defaults = defaults, prompt = prompt, stream = stream, … 2. chattr:::ch_submit.ch_openai(defaults = defaults, prompt = prompt, stream = stream, … 3. chattr:::ch_openai_complete(prompt = prompt, defaults = defaults) 4. rlang::abort(req_result) 5. rlang:::validate_signal_args(message, class, call, .subclass, "abort") 6. rlang:::check_character(message, call = env) 7. rlang:::stop_input_type(x, "a character vector", ..., allow_na = FALSE, … 8. rlang::abort(message, ..., call = call, arg = arg) 9. \| rlang:::signal_abort(cnd, .file) 10. \| base::signalCondition(cnd) 11. global (function (e) … Warning: Error in observe: Streaming returned error 51: 50: signalCondition 49: signal_abort 48: abort 47: observe 46: 3: shiny::runApp 2: runGadget 1: chattr_app --   > | > >
edgararuiz commented 2 months ago

It looks like there could possibly be an empty message coming from OpenAI, can you try installing the dev version and trying again. There is an enhancement in the latest version that improves how it returns errors:

pak::pak("mlverse/chattr")