Description
When using ellmer (connected to Snowflake Cortex AI) as the client for querychat, chat interactions fail with an error suggesting ellmer's response structure doesn't match what querychat expects.
Environment:
- ellmer: (latest version)
- querychat: v0.2.0.9000 (dev version via
pak::pak("posit-dev/querychat/pkg-r"))
- R version: 4.5
- Environment: Posit Team Snowflake Native App, Positron within Workbench
- Snowflake Cortex AI model:
snowflake/claude-sonnet-4-5
Reproducible Example:
library(shiny)
library(bslib)
library(querychat)
library(ellmer)
library(DT)
library(palmerpenguins)
# Initialize chat with Snowflake Cortex AI
chat <- chat(
name = "snowflake/claude-sonnet-4-5",
system_prompt = "You are a data analysis expert",
account = Sys.getenv("SNOWFLAKE_ACCOUNT")
)
# Test that ellmer chat works standalone
chat$chat("Hello") # This works fine
# Initialize QueryChat with ellmer client
qc <- QueryChat$new(
penguins,
client = chat,
greeting = "Hello! Ask me questions about the penguins data."
)
# Define UI
ui <- page_sidebar(
title = "Penguins Data Explorer",
sidebar = qc$sidebar(),
card(
card_header("Data Results"),
dataTableOutput("table")
)
)
# Define server
server <- function(input, output, session) {
qc_vals <- qc$server()
output$table <- renderDataTable({
datatable(qc_vals$df(), fillContainer = TRUE)
})
}
shinyApp(ui = ui, server = server)
Behavior:
- App launches successfully
- Data table displays correctly
- Chat UI appears with the greeting message
- When attempting to send a message in the chat, the following error occurs:
Error:
Warning: ERROR: An error occurred in `chat_append_stream(id="querychat_penguins-chat")`
Caused by error in `if (content$type == "text") ...`:
! argument is of length zero
Warning in append_stream_task$invoke(chat, input$chat_user_input) :
ERROR: An error occurred when invoking the ExtendedTask.
Caused by error in `if (content$type == "text") ...`:
! argument is of length zero
Additional Context:
This is for a guide I'm writing that demonstrates natural language data querying using Snowflake Cortex AI in the Posit Team Native App. Guidance on how to make it work with querychat (or confirmation that this integration isn't currently supported) would be helpful. Thank you!!
Description
When using ellmer (connected to Snowflake Cortex AI) as the client for querychat, chat interactions fail with an error suggesting ellmer's response structure doesn't match what querychat expects.
Environment:
pak::pak("posit-dev/querychat/pkg-r"))snowflake/claude-sonnet-4-5Reproducible Example:
Behavior:
Additional Context:
This is for a guide I'm writing that demonstrates natural language data querying using Snowflake Cortex AI in the Posit Team Native App. Guidance on how to make it work with querychat (or confirmation that this integration isn't currently supported) would be helpful. Thank you!!