Skip to content

[Bug]: chat app crashes when using Azure OpenAI service #257

@stevegbrooks

Description

@stevegbrooks

Confirm setup

  • I have installed the development version of {gptstudio} (pak::pak("MichelNivard/gptstudio")) and tested if the problem remains.
  • I have installed the {reprex} and {sessioninfo} packages to be able to run this issue's code snippet pak::pak(c("reprex", "sessioninfo")).

What happened?

When trying to engage in a chat using azure_openai service, the gptstudio::gptstudio_chat() app crashes:

Image

My take on this is that the function ellmer_chat.gptstudio_request_azure_openai is getting the skeleton from gptstudio_request_skeleton.azure_openai(), but that skeleton doesn't have fields for endpoint, deployment_id or api_version for some reason.

I tried it out to just manually add these and then running this ellmer_chat.gptstudio_request_azure_openai works without error.

Relevant log output

Loading required package: shiny

Listening on http://127.0.0.1:7266
ℹ Fetching models for azure_openai service...
✔ Got models!
Warning: Error in ellmer::chat_azure_openai: `endpoint` must be a single string, not `NULL`.
  152: base$onError
  151: base$onError
  150: base$onError
  149: base$onError
  148: base$onError
  147: base$onError
  146: base$onError
  145: base$onError
  144: base$onError
  143: domain$onError
  142: promiseDomain$onError
  141: <Anonymous>
  140: stop
  139: signalConditions
  138: value.Future
  127: check
  126: action
  119: promise
  118: as.promise.Future
  116: private$doResolve
  109: resolve
  108: work_fn
  107: private$do_work
  106: private$attempt_work
  105: queue$schedule_work
  104: action
   97: promise
   96: promises::future_promise
   95: <Anonymous>
   86: private$do_invoke
   85: process_chat$invoke
   84: observe
   83: <observer:observeEvent(input$chat)>
    4: shiny::runApp
    3: eval
    2: eval
    1: .rs.sourceWithProgress

Session info

r
gptstudio::gptstudio_sitrep()
#> 
#> ── Configuration for gptstudio ─────────────────────────────────────────────────
#> Using user configuration file at
#> '/fsx/home/brooksst/.config/R/gptstudio/config.yml'
#> 
#> 
#> ── Current Settings ──
#> 
#> 
#> 
#> - Model: Using ENV variables
#> 
#> - Task: coding
#> 
#> - Language: en
#> 
#> - Service: azure_openai
#> 
#> - Custom prompt:
#> 
#> - Stream: TRUE
#> 
#> - Code style: tidyverse
#> 
#> - Skill: beginner
#> 
#> 
#> 
#> ── Checking API connections ──
#> 
#> 
#> 
#> ── Checking OpenAI API connection 
#> 
#> ✖ API key is not set or invalid for openai 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 service.
#> 
#> 
#> 
#> ── Checking Azure OpenAI API connection 
#> 
#> ✖ Failed to connect to the azure_openai API 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 ──────────────────────────────────────────────


<sup>Created on 2025-04-30 with [reprex v2.1.1](https://reprex.tidyverse.org)</sup>

<details style="margin-bottom:10px;">

<summary>

Session info
</summary>

 r
sessioninfo::session_info()
#> ─ Session info ───────────────────────────────────────────────────────────────
#>  setting  value
#>  version  R version 4.4.1 (2024-06-14)
#>  os       Ubuntu 22.04.5 LTS
#>  system   x86_64, linux-gnu
#>  ui       X11
#>  language (EN)
#>  collate  en_US.UTF-8
#>  ctype    en_US.UTF-8
#>  tz       Europe/Dublin
#>  date     2025-04-30
#>  pandoc   3.3 @ /usr/bin/ (via rmarkdown)
#> 
#> ─ Packages ───────────────────────────────────────────────────────────────────
#>  package     * version     date (UTC) lib source
#>  cli           3.6.4       2025-02-13 [1] CRAN (R 4.4.1)
#>  coro          1.1.0       2024-11-05 [1] RSPM (R 4.4.1)
#>  curl          6.2.3       2025-04-30 [1] Github (jeroen/curl@755854c)
#>  digest        0.6.37      2024-08-19 [1] RSPM (R 4.4.1)
#>  ellmer        0.1.1.9000  2025-04-30 [1] Github (tidyverse/ellmer@1b1616b)
#>  evaluate      1.0.1       2024-10-10 [1] RSPM (R 4.4.1)
#>  fansi         1.0.6       2023-12-08 [1] RSPM
#>  fastmap       1.2.0       2024-05-15 [1] RSPM
#>  fs            1.6.5       2024-10-30 [1] RSPM (R 4.4.1)
#>  glue          1.8.0       2024-09-30 [1] RSPM (R 4.4.1)
#>  gptstudio     0.4.0.9017  2025-04-30 [1] Github (MichelNivard/gptstudio@d314f96)
#>  htmltools     0.5.8.1     2024-04-04 [1] RSPM
#>  htmlwidgets   1.6.4       2023-12-06 [1] RSPM (R 4.4.1)
#>  httpuv        1.6.15      2024-03-26 [1] RSPM (R 4.4.1)
#>  httr2         1.1.2.9000  2025-04-18 [1] Github (r-lib/httr2@19d57be)
#>  knitr         1.49        2024-11-08 [1] RSPM (R 4.4.1)
#>  later         1.4.1       2024-11-27 [1] RSPM (R 4.4.1)
#>  lifecycle     1.0.4       2023-11-07 [1] RSPM
#>  magrittr      2.0.3       2022-03-30 [1] RSPM (R 4.4.1)
#>  mime          0.12        2021-09-28 [1] RSPM (R 4.4.1)
#>  pillar        1.9.0       2023-03-22 [1] RSPM
#>  promises      1.3.2       2024-11-28 [1] RSPM (R 4.4.1)
#>  purrr         1.0.2       2023-08-10 [1] RSPM (R 4.4.1)
#>  R6            2.6.1       2025-02-15 [1] CRAN (R 4.4.1)
#>  rappdirs      0.3.3       2021-01-31 [1] RSPM (R 4.4.1)
#>  Rcpp          1.0.13-1    2024-11-02 [1] RSPM (R 4.4.1)
#>  reprex        2.1.1       2024-07-06 [1] RSPM
#>  rlang         1.1.6       2025-04-11 [1] CRAN (R 4.4.1)
#>  rmarkdown     2.29        2024-11-04 [1] RSPM (R 4.4.1)
#>  rstudioapi    0.17.1      2024-10-22 [1] RSPM (R 4.4.1)
#>  S7            0.2.0       2024-11-07 [1] RSPM
#>  sessioninfo   1.2.2       2021-12-06 [1] RSPM
#>  shiny         1.10.0.9000 2025-04-30 [1] Github (rstudio/shiny@f79a22b)
#>  utf8          1.2.4       2023-10-22 [1] RSPM
#>  vctrs         0.6.5       2023-12-01 [1] RSPM
#>  withr         3.0.2       2024-10-28 [1] RSPM (R 4.4.1)
#>  xfun          0.49        2024-10-31 [1] RSPM (R 4.4.1)
#>  xtable        1.8-4       2019-04-21 [1] RSPM (R 4.4.1)
#>  yaml          2.3.10      2024-07-26 [1] RSPM (R 4.4.1)
#> 
#>  [1] /fsx/home/brooksst/R/x86_64-pc-linux-gnu-library/4.4
#>  [2] /usr/local/lib/R/site-library
#>  [3] /usr/local/lib/R/library
#> 
#> ──────────────────────────────────────────────────────────────────────────────


</details>

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugan unexpected problem or unintended behavior

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions