`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)