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.
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)
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.
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:
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".