MichelNivard / gptstudio

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

[Azure OpenAI] Error in : Not a GUID #187

Closed JiaZhang42 closed 2 months ago

JiaZhang42 commented 8 months ago

Hi Team,

I encountered the error Not a GUID when I tried to send messages through "Addins-GPTSTUDIO-Chat" using Azure OpenAI.

Loading required package: shiny

Listening on http://127.0.0.1:7975
$messages
$messages[[1]]
$messages[[1]]$role
[1] "system"
$messages[[1]]$content
As a chat bot assisting an R programmer working in the RStudio IDE it is important to tailor responses to their skill level and preferred coding style. They consider themselves to be a beginner R programmer. Provide answers with their skill level in mind. They prefer to use a tidyverse style of coding. When possible, answer code questions using tidyverse, r-lib, and tidymodels family of packages. R for Data Science is also a good resource to pull from. 
$messages[[2]]
$messages[[2]]$role
[1] "user"
$messages[[2]]$content
[1] "hi"
Warning: Error in : Not a GUID
  95: is_request
  94: check_request
  93: httr2::req_body_json
  92: is_request
  91: check_request
  90: httr2::req_retry
  89: is_request
  88: check_request
  87: httr2::req_error
  86: is_request
  85: check_request
  84: httr2::req_perform
  78: gptstudio_response_process
  76: observe
  75: <observer>
   4: shiny::runApp
   3: eval
   2: eval
   1: .rs.sourceWithProgress

Before this error, the error said if (use_token) { is not a logical input. I tried to look at the source code, and it seems gptstudio is expecting "AZURE_OPENAI_USE_TOKEN" from .Renviron, so I added "AZURE_OPENAI_USE_TOKEN = TRUE" in the .Renviron. Now the error becomes Not a GUID.

I tried to understand this. It seems it's expecting a client ID while retrieving the Azure token. But this is not set up and I don't know what it should be. I'd be grateful if you could help. Thanks!

Best, Jia

calderonsamuel commented 8 months ago

Thank you @JiaZhang42 . We will take a look into this

JamesHWade commented 8 months ago

Looks like you found a bug. You most likely want AZURE_OPENAI_USE_TOKEN=FALSE. Most Azure OpenAI services will not need it. Thanks for creating the issue!

JiaZhang42 commented 8 months ago

Thank you, James! I will try AZURE_OPENAI_USE_TOKEN=FALSE.

JamesHWade commented 7 months ago

@JiaZhang42, were you able to get it to work with that variable change?

JiaZhang42 commented 7 months ago

@JamesHWade Unfortunately no. I got Error code 500 - Internal Server Error though I tried at different times.