mlverse / chattr

https://mlverse.github.io/chattr/
Other
185 stars 19 forks source link

Warning: Error in map: In index: 2. Caused by error in `split_ch[2:(length(split_ch) - 1)]` #89

Closed CNUlichao closed 3 months ago

CNUlichao commented 4 months ago

when I run chattr_app() in RStudio,the gpt window in Viewer disappears and the error appears

chattr_1

my code:

library(chattr)
chattr_use("gpt35")
Sys.setenv("OPEN_API_KEY"='sk-CIg****************aYq6')
chattr_test()
chattr_app()
edgararuiz commented 4 months ago

Hi @CNUlichao , can you confirm that you're using the latest version of chattr? It should be 0.0.9012

CNUlichao commented 4 months ago

Yes, my chattr version is 0.0.9012.

And when I run chattr_test(), it appears the Error in if (nchar(out) > 0) { : the condition has length > 1 like this issue

https://github.com/mlverse/chattr/issues/68

chattr() function is no problem.

CNUlichao commented 4 months ago

chattr_New

chattr_V2

edgararuiz commented 3 months ago

What happens when you run this?

library(httr2)
request("https://api.openai.com/v1/models") %>%
  req_auth_bearer_token(Sys.getenv("OPENAI_API_KEY")) %>% 
  req_perform()
CNUlichao commented 3 months ago

when I run the code, it returns the response status is ok. And the chattr version is 0.1.0

library(httr2)
request("https://api.openai.com/v1/models") %>%
  req_auth_bearer_token(Sys.getenv("OPENAI_API_KEY")) %>% 
  req_perform()

image

edgararuiz commented 3 months ago

Hi @CNUlichao , would you mind trying again with the dev version? This should also return any errors from the API that could have been previously not displayed:

pak::pak("mlverse/chattr")
CNUlichao commented 3 months ago

Hi @CNUlichao , would you mind trying again with the dev version? This should also return any errors from the API that could have been previously not displayed:

pak::pak("mlverse/chattr")

It seems ok now, and the version of chattr is 0.1.0.9001.

edgararuiz commented 3 months ago

Great! Thanks for letting me know @CNUlichao . I'll go ahead and close the issue.