mlverse / chattr

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

No response after prompt in the shiny app #121

Closed fredsteamboat closed 2 months ago

fredsteamboat commented 2 months ago

I have installed the chattr package and add my api secret but each time I enter a promtp I get no response.

I'm on an Intel Mac using MacOS 14.6.1

I'm using the latest version of R and RStudio

image
edgararuiz commented 2 months ago

Hi, what does chattr_test() returns?

fredsteamboat commented 2 months ago

nothing

fredsteamboat commented 2 months ago

I restarted R and tested the code again and got this error:

Error in UseMethod("ch_test") : no applicable method for 'chtest' applied to an object of class "c('ch', 'ch_model')"

edgararuiz commented 2 months ago

Ok, can you run this code in your console and let me know what it returns?

library(httr2)
Sys.setenv("OPENAI_API_KEY" = "sk-...")
request("https://api.openai.com/v1/models") %>%
  req_auth_bearer_token(Sys.getenv("OPENAI_API_KEY")) %>% 
  req_perform()
fredsteamboat commented 2 months ago

should I insert my API key or just copy and paste your code?

fredsteamboat commented 2 months ago

library(httr2) Sys.setenv("OPENAI_API_KEY" = "sk-n......") request("https://api.openai.com/v1/models") %>%

  • req_auth_bearer_token(Sys.getenv("OPENAI_API_KEY")) %>%
  • req_perform() GET https://api.openai.com/v1/models Status: 200 OK Content-Type: application/json Body: In memory (2572 bytes)
edgararuiz commented 2 months ago

Ok, this means that it is an issue with calling the 4o model itself, I will have to look at that. But I won't be able until tomorrow. I will follow up with I have a fix for that

fredsteamboat commented 2 months ago

ok, thanks!

edgararuiz commented 2 months ago

Morning, I figured it out. Before calling chattr_app(), the token needs to be set like you did here:

Sys.setenv("OPENAI_API_KEY" = "sk-n......")

You have to see 3 Open AI models in the selection prompt, not just one (4o).

edgararuiz commented 2 months ago

Related bug fix: df2c38c238f9c38cfd3ee0846ab498e1921b2175 gpt4o should not show up in the menu selection

fredsteamboat commented 2 months ago

Thanks

On Mon, Sep 2, 2024, 10:23 AM Edgar Ruiz @.***> wrote:

Related bug fix: df2c38c https://github.com/mlverse/chattr/commit/df2c38c238f9c38cfd3ee0846ab498e1921b2175 gpt4o should not show up in the menu selection

— Reply to this email directly, view it on GitHub https://github.com/mlverse/chattr/issues/121#issuecomment-2324871246, or unsubscribe https://github.com/notifications/unsubscribe-auth/A2FPD7Q7UCHBPWZOLTGXIWDZURYFTAVCNFSM6AAAAABNPO4DG6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMRUHA3TCMRUGY . You are receiving this because you authored the thread.Message ID: @.***>

fredsteamboat commented 2 months ago

@edgararuiz I found that it was likely an issue with my API key. I don't know if others experienced the same issue, but the API key would not work until I added a payment method in OpenAPI. Once I added my CC#, I created a new key and it worked.

edgararuiz commented 2 months ago

Great to hear!

RayMeadows commented 2 months ago

I had the same issue but cc did not solve it.