Can not switch to gpt-4
bidcrt opened this issue · 1 comments
bidcrt commented
Greeting,
I have tried to use usethis::edit_r_environ() and add OPENAI_MODEL="gpt-4," but it does not work for me to switch to gpt-4. Am I right on that?
Thanks.
RStudio-2023.12.1-402
R-4.3.3 for Windows
jcrodriguez1989 commented
Hi @bidcrt , I am not sure how setting env vars is managed by usethis
.
To change the used model I would simply put this at the very first of my scripts: Sys.setenv(OPENAI_MODEL = "gpt-4")
.
Or I would add OPENAI_MODEL="gpt-4"
at my ~/.Renviron
file.
To test that the env var is correctly set, you can try if it errors on non existing models:
Sys.setenv(OPENAI_MODEL = "FAKE_MODEL")
> chatgpt::ask_chatgpt("In 4 words describe the R language.")
Error in gpt_get_completions(question, messages = chat_session_messages) :
list(message = "The model `FAKE_MODEL` does not exist or you do not have access to it.", type = "invalid_request_error", param = NULL, code = "model_not_found")
> Sys.setenv(OPENAI_MODEL = "gpt-4")
> chatgpt::ask_chatgpt("In 4 words describe the R language.")
[1] "Statistical computing and graphics software."