`greeting` does not appear by querychat package in R on shiny app

Hi. After the presentation of "Harnessing LLMs for Data Analysis", I felt impressed for the technology and have tried it by myself.

But I have two main problems for using querychat package in R.
I do not have so much knowledge about shiny and shinychat, so I would be happy if somebodies help and give any advices. I am completely stacked.

Problems:

  • The "greeting" message does not appear on the chat box.
  • After input and order in the chat box, the AI is still working with showing three dots, "...". for minutes. I waited for 20 mins, but nothing changed.

Environment:

  • R version: R.4.5.0
  • Deployment: https://connect.posit.cloud/ via Github (free option)
  • AI: Anthropic (API purchased) API values are assigned on Configure variables on connect.posit.colod
  • Shiny: Free version

What I tried:

  1. Tried OPENAI_API_KEY with free version. -> a same result.
  2. Reffered to the codes of Mr.jacobpstein. -> a same result.

Screenshots:

  1. No greeting message:
  2. three dots working.

Codes (used example codes on "querychat" on Github. :

ANTHROPIC_API_KEY <- Sys.getenv("ANTHROPIC_API_KEY")
library(shiny)
library(bslib)
library(querychat)

# 1. Configure querychat. This is where you specify the dataset and can also
#    override options like the greeting message, system prompt, model, etc.
querychat_config <- querychat_init(mtcars,
                                   greeting = "Hello! Tell me about something.",
                                   create_chat_func = purrr::partial(
                                     ellmer::chat_anthropic,
                                     model = "claude-3-5-sonnet-20241022"
                                   )
                                   
                                   )

ui <- page_sidebar(
  # 2. Use querychat_sidebar(id) in a bslib::page_sidebar.
  #    Alternatively, use querychat_ui(id) elsewhere if you don't want your
  #    chat interface to live in a sidebar.
  sidebar = querychat_sidebar("chat"),
  DT::DTOutput("dt")
)

server <- function(input, output, session) {
  
  # 3. Create a querychat object using the config from step 1.
  querychat <- querychat_server("chat", querychat_config)
  
  output$dt <- DT::renderDT({
    # 4. Use the filtered/sorted data frame anywhere you wish, via the
    #    querychat$df() reactive.
    DT::datatable(querychat$df())
  })
}

shinyApp(ui, server)

Hello:

Sorry this is one of the perils of working with rapidly changing packages. I assume you are currently using shinychat_0.2.0 and the version of querychat in main doesn't have those changes incorporated yet.

We have the fix in process now and querychat should be working soon.

Hi Satoshi:

The {querychat} patch was merged. It should be working now?

This was the code (from the docs) that I used to test.

library(shiny)
library(bslib)
library(querychat)

querychat_config <- querychat_init(mtcars, greeting = "hello you")

ui <- page_sidebar(
  sidebar = querychat_sidebar("chat"),
  DT::DTOutput("dt")
)

server <- function(input, output, session) {

  querychat <- querychat_server("chat", querychat_config)

  output$dt <- DT::renderDT({
    DT::datatable(querychat$df())
  })
}

shinyApp(ui, server)

Hi, Daniel.

Thank you for your kind and quick reply!
I tried it, but the package did not work it. Maybe, it will be better to wait for the further updates of querychat, right?

Workflow: Rstudio IDE (for coding) -> publishing on GitHub (as public) -> Connect Posit Cloud for deployment

API KEYS:

  1. OPENAI_API_KEY: I used free version. There is not any greeting message in the chatbox, it is disconnected after the chat order, "show me cyl with over 6".

  2. ANTHROPIC_API_KEY: I used a paid version. There is not any greeting message in the chatbox, opertion with three dots is on-going after the chat-order.

package version:
shinychat_0.2.0 : confirmed.
R version 4.5.0 (2025-04-11 ucrt)
Platform: x86_64-w64-mingw32/x64
Running under: Windows 11 x64 (build 26100)

Matrix products: default
LAPACK version 3.12.1

locale:
[1] LC_COLLATE=English_United Kingdom.utf8 LC_CTYPE=English_United Kingdom.utf8 LC_MONETARY=English_United Kingdom.utf8
[4] LC_NUMERIC=C LC_TIME=English_United Kingdom.utf8

time zone: Europe/Berlin
tzcode source: internal

attached base packages:
[1] stats graphics grDevices utils datasets methods base

other attached packages:
[1] querychat_0.0.0.9000 bslib_0.9.0 shiny_1.10.0

loaded via a namespace (and not attached):
[1] rappdirs_0.3.3 sass_0.4.10 generics_0.1.4 renv_1.1.4 digest_0.6.37 magrittr_2.0.3 grid_4.5.0
[8] RColorBrewer_1.1-3 fastmap_1.2.0 jsonlite_2.0.0 whisker_0.4.1 DBI_1.2.3 promises_1.3.3 purrr_1.0.4
[15] crosstalk_1.2.1 scales_1.4.0 coro_1.1.0 httr2_1.1.2 jquerylib_0.1.4 duckdb_1.3.0 cli_3.6.4
[22] rlang_1.1.6 crayon_1.5.3 withr_3.0.2 cachem_1.1.0 yaml_2.3.10 tools_4.5.0 memoise_2.0.1
[29] dplyr_1.1.4 ggplot2_3.5.2 httpuv_1.6.16 DT_0.33 shinychat_0.2.0 curl_6.3.0 vctrs_0.6.5
[36] R6_2.6.1 mime_0.13 lifecycle_1.0.4 fs_1.6.6 htmlwidgets_1.6.4 pkgconfig_2.0.3 pillar_1.10.2
[43] later_1.4.2 gtable_0.3.6 rsconnect_1.4.1 glue_1.8.0 Rcpp_1.0.14 tibble_3.2.1 tidyselect_1.2.1
[50] rstudioapi_0.17.1 farver_2.1.2 xtable_1.8-4 bsicons_0.1.2 htmltools_0.5.8.1 ellmer_0.2.1 compiler_4.5.0
[57] S7_0.2.0

library(shiny)
library(bslib)
library(querychat)

# sessionInfo() to check version of packages
querychat_config <- querychat_init(mtcars, 
                                #   create_chat_func = purrr::partial(
                                 #    ellmer::chat_anthropic,
                                  #   model = "claude-3-5-sonnet-20241022"
                                   #),
                                   greeting = "hello you" )

ui <- page_sidebar(
  sidebar = querychat_sidebar("chat"),
  DT::DTOutput("dt")
)

server <- function(input, output, session) {
  
  querychat <- querychat_server("chat", querychat_config)
  
  output$dt <- DT::renderDT({
    DT::datatable(querychat$df())
  })
}

shinyApp(ui, server)