MichelNivard / gptstudio

GPT RStudio addins that enable GPT assisted coding, writing & analysis
https://michelnivard.github.io/gptstudio/
Other
906 stars 109 forks source link

[Bug]: Error in `req_perform()`:T... ! HTTP 404 Not Found. #206

Closed TommyH-Tran closed 6 months ago

TommyH-Tran commented 6 months ago

Confirm setup

What happened?

I just installed it and was trying to do a test run on some text, and when I clicked for it to improve spelling and grammar, I found the following problem: It seems like it is having a problem connecting?

Relevant log output

Improve spelling and grammar of the text: I had to change to script format to work in Linux Ubuntu
Error in `req_perform()`:T...
! HTTP 404 Not Found.
Run `rlang::last_trace()` to see where the error occurred.
✖ Sending query to ChatGPT... [171ms]
✖ Sending query to ChatGPT ... failed
> rlang::last_trace()
<error/httr2_http_404>
Error in `req_perform()`:
! HTTP 404 Not Found.
---
Backtrace:
     ▆
  1. ├─gptstudio (local) `<fn>`()
  2. │ └─gptstudio:::gptstudio_chat_in_source(task = "Improve spelling and grammar of the text")
  3. │   └─... %>% gptstudio_request_perform()
  4. ├─gptstudio::gptstudio_request_perform(.)
  5. ├─gptstudio:::gptstudio_request_perform.gptstudio_request_openai(.)
  6. │ └─request %>% req_perform() %>% resp_body_json()
  7. ├─httr2::resp_body_json(.)
  8. │ └─httr2:::check_response(resp)
  9. │   └─httr2:::is_response(resp)
 10. └─httr2::req_perform(.)
Run rlang::last_trace(drop = FALSE) to see 3 hidden frames.
> rlang::last_trace(drop = FALSE)
<error/httr2_http_404>
Error in `req_perform()`:
! HTTP 404 Not Found.
---

Session info

r
gptstudio::gptstudio_sitrep()
#> 
#> ── Configuration for gptstudio ─────────────────────────────────────────────────
#> Using user configuration file at
#> 'C:\Users\tommy\AppData\Roaming/R/config/R/gptstudio/config.yml'
#> 
#> 
#> ── Current Settings ──
#> 
#> 
#> 
#> - Model: gpt-4-turbo-preview
#> 
#> - Task: coding
#> 
#> - Language: en
#> 
#> - Service: openai
#> 
#> - Custom prompt:
#> 
#> - Stream: TRUE
#> 
#> - Code style: tidyverse
#> 
#> - Skill: advanced
#> 
#> 
#> 
#> ── Checking API connections ──
#> 
#> 
#> 
#> ── Checking OpenAI API connection 
#> 
#> ✖ Failed to connect to the OpenAI API service.
#> 
#> 
#> 
#> ── Checking HuggingFace API connection 
#> 
#> ✖ API key is not set or invalid for HuggingFace service.
#> 
#> 
#> 
#> ── Checking Anthropic API connection 
#> 
#> ✖ API key is not set or invalid for Anthropic service.
#> 
#> 
#> 
#> ── Checking Google AI Studio API connection 
#> 
#> ✖ API key is not set or invalid for Google AI Studio service.
#> 
#> 
#> 
#> ── Checking Azure OpenAI API connection 
#> 
#> ✖ API key is not set or invalid for Azure OpenAI service.
#> 
#> 
#> 
#> ── Checking Perplexity API connection 
#> 
#> ✖ API key is not set or invalid for Perplexity service.
#> 
#> 
#> 
#> ── Checking Cohere API connection 
#> 
#> ✖ API key is not set or invalid for Cohere service.
#> 
#> 
#> 
#> ── Check Ollama for Local API connection 
#> 
#> ✖ Couldn't connect to Ollama in <http://localhost:11434>. Is it running there?
#> 
#> 
#> 
#> ── Getting help ──
#> 
#> 
#> 
#> See the gptstudio homepage (<https://michelnivard.github.io/gptstudio/>) for
#> getting started guides and package documentation. File an issue or contribute
#> to the package at the GitHub repo
#> (<https://github.com/MichelNivard/gptstudio>).
#> ── End of gptstudio configuration ──────────────────────────────────────────────

Created on 2024-05-13 with reprex v2.1.0

Session info ``` r sessioninfo::session_info() #> ─ Session info ─────────────────────────────────────────────────────────────── #> setting value #> version R version 4.4.0 (2024-04-24 ucrt) #> os Windows 10 x64 (build 19045) #> system x86_64, mingw32 #> ui RTerm #> language (EN) #> collate English_United States.utf8 #> ctype English_United States.utf8 #> tz America/Chicago #> date 2024-05-13 #> pandoc 3.1.11 @ C:/Program Files/RStudio/resources/app/bin/quarto/bin/tools/ (via rmarkdown) #> #> ─ Packages ─────────────────────────────────────────────────────────────────── #> package * version date (UTC) lib source #> assertthat 0.2.1 2019-03-21 [1] CRAN (R 4.4.0) #> cli 3.6.2 2023-12-11 [1] CRAN (R 4.4.0) #> curl 5.2.1 2024-03-01 [1] CRAN (R 4.4.0) #> digest 0.6.35 2024-03-11 [1] CRAN (R 4.4.0) #> evaluate 0.23 2023-11-01 [1] CRAN (R 4.4.0) #> fansi 1.0.6 2023-12-08 [1] CRAN (R 4.4.0) #> fastmap 1.1.1 2023-02-24 [1] CRAN (R 4.4.0) #> fs 1.6.4 2024-04-25 [1] CRAN (R 4.4.0) #> glue 1.7.0 2024-01-09 [1] CRAN (R 4.4.0) #> gptstudio 0.3.1.9009 2024-05-13 [1] Github (MichelNivard/gptstudio@9169c62) #> htmltools 0.5.8.1 2024-04-04 [1] CRAN (R 4.4.0) #> htmlwidgets 1.6.4 2023-12-06 [1] CRAN (R 4.4.0) #> httpuv 1.6.15 2024-03-26 [1] CRAN (R 4.4.0) #> httr2 1.0.1 2024-04-01 [1] CRAN (R 4.4.0) #> jsonlite 1.8.8 2023-12-04 [1] CRAN (R 4.4.0) #> knitr 1.46 2024-04-06 [1] CRAN (R 4.4.0) #> later 1.3.2 2023-12-06 [1] CRAN (R 4.4.0) #> lifecycle 1.0.4 2023-11-07 [1] CRAN (R 4.4.0) #> magrittr 2.0.3 2022-03-30 [1] CRAN (R 4.4.0) #> mime 0.12 2021-09-28 [1] CRAN (R 4.4.0) #> pillar 1.9.0 2023-03-22 [1] CRAN (R 4.4.0) #> promises 1.3.0 2024-04-05 [1] CRAN (R 4.4.0) #> R6 2.5.1 2021-08-19 [1] CRAN (R 4.4.0) #> rappdirs 0.3.3 2021-01-31 [1] CRAN (R 4.4.0) #> Rcpp 1.0.12 2024-01-09 [1] CRAN (R 4.4.0) #> reprex 2.1.0 2024-01-11 [1] CRAN (R 4.4.0) #> rlang 1.1.3 2024-01-10 [1] CRAN (R 4.4.0) #> rmarkdown 2.26 2024-03-05 [1] CRAN (R 4.4.0) #> rstudioapi 0.16.0 2024-03-24 [1] CRAN (R 4.4.0) #> sessioninfo 1.2.2 2021-12-06 [1] CRAN (R 4.4.0) #> shiny 1.8.1.1 2024-04-02 [1] CRAN (R 4.4.0) #> utf8 1.2.4 2023-10-22 [1] CRAN (R 4.4.0) #> vctrs 0.6.5 2023-12-01 [1] CRAN (R 4.4.0) #> withr 3.0.0 2024-01-16 [1] CRAN (R 4.4.0) #> xfun 0.43 2024-03-25 [1] CRAN (R 4.4.0) #> xtable 1.8-4 2019-04-21 [1] CRAN (R 4.4.0) #> yaml 2.3.8 2023-12-11 [1] CRAN (R 4.4.0) #> #> [1] C:/Users/tommy/AppData/Local/R/win-library/4.4 #> [2] C:/Program Files/R/R-4.4.0/library #> #> ────────────────────────────────────────────────────────────────────────────── ```


### Code of Conduct

- [X] I agree to follow this project's Code of Conduct
calderonsamuel commented 6 months ago

Yes, it looks that you are not able to connect to the OpenAI API. Check the output of your situation report:

> ── Checking OpenAI API connection

>

> ✖ Failed to connect to the OpenAI API service.

I can think of three possible causes:

  1. You might not have a valid OpenAI API KEY
  2. You might not have credits in your OpenAI account
  3. You might not be able to connect to the API for network issues, such as firewalls or proxy setup

Please check if you have any of these issues and let us know

TommyH-Tran commented 6 months ago

I have a valid OpenAi. Do I need credits to use this? I thought I would be free with a certain modeling like 3.5 turbo?

calderonsamuel commented 6 months ago

Sadly no. There is no free way to use the OpenAI API. You used to be able to get some free credits on your first sign up, but I'm not sure if that is still happening. Having said so, using gpt-3.5 is pretty cheap (compared to other models and services).

You can still try other services we support, such as Ollama, which is 100% free and open source, but you need to run the model in your own machine, which can be slow.