-
Notifications
You must be signed in to change notification settings - Fork 6
Description
I've been using btw to develop a Shiny app-package. The code for this application is stored in a repo with multiple branches
Background
I've configured btw/ellmer using the code below:
if (interactive()) {
require(ellmer, quietly = TRUE)
}
if (interactive()) {
require(btw, quietly = TRUE)
}
options(
btw.client = ellmer::chat_anthropic(
system_prompt =
"You are an expert R/Python programmer who loves explaining complex topics to non-technical audiences.
- When writing R code, use base R functions, but follow the tidyverse style guide.
- Avoid using `for` loops and prefer functional programming patterns like `apply()` or `purrr`.
- When creating graphs/plots, use `ggplot2`.
- If writing R Shiny code, use `bslib` for all layout functions (unless explicitly instructed otherwise).
- If writing Python Shiny code, use shiny core (not express) to build apps and include explanations in comments. ",
model = "claude-sonnet-4-5-20250929"
)
)This allows me to use the btw_client() to create a chat client:
chat <- btw_client()And I've been able to create the btw.md file (and run btw_task_create_btw_md())
use_btw_md(scope = "project")
btw_task_create_btw_md(mode = "console", client = "anthropic")After installing the development version of shinychat, I was able to launch btw_app()
btw_app()All of these details are available here (and outputs are here).
Issue
When I run the btw_app() in the 30_llm-btw branch of sqp, I see the following:
btw_app()Prompt and response 1
Expand the downloadable R Markdown report to include all the graphs and tables in the Shiny app.
"I'll help you expand the R Markdown report to include all the graphs and tables from the Shiny app. Let me first examine the current report structure and then the modules to understand what visualizations and tables are available."
Project Files - Find report template files
Project Files - List all module files to understand app structure
Project Files - List R files with correct path
Project Files - List files in the R directory
"Now let me read the current report template and examine the key modules:"
Read report_template.Rmd - Read current report template
Read nav_ui.R - Read nav_ui to understand app structure
Read mod_report.R - Read mod_report to understand report generation
"Now let me examine the helper functions and key modules to understand the data structures:"
Read mod_counts_bar.R - Read counts bar module to understand count visualizations
Read mod_counts_waffle.R - Read counts waffle module
Read mod_dist_box.R - Read distribution box module
Read mod_dist_raincloud.R - Read distribution raincloud module
Read mod_awards_point.R - Read awards point module
Read count_bar_plot.R - Read helper functions for plotting
Read name_case.R - Read name_case helper function
"Now let me check the table modules to understand the data structure better:"
Read mod_counts_tbl.R - Read counts table module
Read mod_dist_tbl.R - Read distribution table module
Read mod_awards_tbl.R - Read awards table module
"Perfect! Now I have a complete understanding of the app structure. Let me create a comprehensive R Markdown report that includes all visualizations and tables. I'll create an expanded version that includes:"
Compare section (already exists) - scatter plots
Counts section - horizontal bar plots, waffle charts, and count tables
Distributions section - box plots, raincloud plots, and summary tables
Awards section - scatter plots with labels and awards tables
Error 1
An error occurred:
parse error: premature EOF
{"_intent": "Create expanded re
(right here) ------^Prompt and response 2
It seems like you stopped before you finished.
"You're right! Let me continue and finish reading the table modules:"
Read mod_counts_tbl.R - Read counts table module
Read mod_dist_tbl.R - Read distribution table module
Read mod_awards_tbl.R - Read awards table module
"Great! Now I have a complete understanding of the app structure. Let me create an expanded R Markdown report template that includes all graphs and tables from the four main sections: Compare, Counts, Distributions, and Awards."
Error 1
An error occurred:
parse error: premature EOF
{"_intent": "Create expanded re
(right here) ------^Console output
The error in the console is below:
Warning: ERROR: An error occurred in `chat_append_stream(id="chat-chat")`
Caused by error:
! parse error: premature EOF
{"_intent": "Create expanded re
(right here) ------^
Warning in append_stream_task$invoke(client, "chat", input$chat_user_input) :
ERROR: An error occurred when invoking the ExtendedTask.
Caused by error:
! parse error: premature EOF
{"_intent": "Create expanded re
(right here) ------^
Warning: ERROR: An error occurred in `chat_append_stream(id="chat-chat")`
Caused by error:
! parse error: premature EOF
{"_intent": "Create expanded re
(right here) ------^
Warning in append_stream_task$invoke(client, "chat", input$chat_user_input) :
ERROR: An error occurred when invoking the ExtendedTask.
Caused by error:
! parse error: premature EOF
{"_intent": "Create expanded re
(right here) ------^
Warning: ERROR: An error occurred in `chat_append_stream(id="chat-chat")`
Caused by error:
! parse error: premature EOF
{"_intent": "Create expanded re
(right here) ------^
Warning in append_stream_task$invoke(client, "chat", input$chat_user_input) :
ERROR: An error occurred when invoking the ExtendedTask.
Caused by error:
! parse error: premature EOF
{"_intent": "Create expanded re
(right here) ------^It looks like the _intent argument from one the tools?
Session info
sessioninfo::session_info()─ Session info ──────────────────────────────────────────────────────────────────
setting value
version R version 4.5.1 (2025-06-13)
os macOS Tahoe 26.1
system x86_64, darwin20
ui X11
language (EN)
collate en_US.UTF-8
ctype en_US.UTF-8
tz America/Phoenix
date 2025-11-19
pandoc 3.8.2.1 @ /usr/local/bin/ (via rmarkdown)
quarto 1.8.26 @ /Applications/quarto/bin/quarto
─ Packages ──────────────────────────────────────────────────────────────────────
! package * version date (UTC) lib source
P askpass 1.2.1 2024-10-04 [?] CRAN (R 4.5.0)
P bsicons 0.1.2 2023-11-04 [?] CRAN (R 4.5.0)
P bslib 0.9.0 2025-01-30 [?] CRAN (R 4.5.0)
btw * 0.0.6.9000 2025-10-22 [1] Github (posit-dev/btw@9fc3621)
P cachem 1.1.0 2024-05-16 [?] CRAN (R 4.5.0)
P chromote 0.5.1 2025-04-24 [?] RSPM
cli 3.6.5 2025-04-23 [1] CRAN (R 4.5.0)
coro 1.1.0 2024-11-05 [1] CRAN (R 4.5.0)
P credentials 2.0.3 2025-09-12 [?] RSPM
P curl 7.0.0 2025-08-19 [?] CRAN (R 4.5.1)
digest 0.6.38 2025-11-12 [1] RSPM (R 4.5.0)
P dplyr 1.1.4 2023-11-17 [?] CRAN (R 4.5.0)
ellmer * 0.4.0 2025-11-15 [1] RSPM (R 4.5.0)
P evaluate 1.0.5 2025-08-27 [?] CRAN (R 4.5.1)
P fastmap 1.2.0 2024-05-15 [?] CRAN (R 4.5.0)
P fontawesome 0.5.3 2024-11-16 [?] CRAN (R 4.5.0)
P fs 1.6.6 2025-04-12 [?] CRAN (R 4.5.0)
P generics 0.1.4 2025-05-09 [?] CRAN (R 4.5.0)
P gert 2.1.5 2025-03-25 [?] CRAN (R 4.5.0)
P gh 1.5.0 2025-05-26 [?] RSPM (R 4.5.0)
P gitcreds 0.1.2 2022-09-08 [?] RSPM (R 4.5.0)
glue 1.8.0 2024-09-30 [1] CRAN (R 4.5.0)
P htmltools 0.5.8.1 2024-04-04 [?] CRAN (R 4.5.0)
P httpuv 1.6.16 2025-04-16 [?] CRAN (R 4.5.0)
P httr2 1.2.1 2025-07-22 [?] CRAN (R 4.5.1)
P jquerylib 0.1.4 2021-04-26 [?] CRAN (R 4.5.0)
P jsonlite 2.0.0 2025-03-27 [?] CRAN (R 4.5.0)
P knitr 1.50 2025-03-16 [?] CRAN (R 4.5.0)
P later 1.4.4 2025-08-27 [?] CRAN (R 4.5.1)
lifecycle 1.0.4 2023-11-07 [1] CRAN (R 4.5.0)
P magrittr 2.0.4 2025-09-12 [?] CRAN (R 4.5.1)
P memoise 2.0.1 2021-11-26 [?] CRAN (R 4.5.0)
P mime 0.13 2025-03-17 [?] CRAN (R 4.5.0)
P openssl 2.3.4 2025-09-30 [?] RSPM
P otel 0.2.0 2025-08-29 [?] CRAN (R 4.5.1)
P pillar 1.11.1 2025-09-17 [?] CRAN (R 4.5.1)
P pkgconfig 2.0.3 2019-09-22 [?] CRAN (R 4.5.0)
P processx 3.8.6 2025-02-21 [?] CRAN (R 4.5.0)
promises 1.5.0 2025-11-01 [1] RSPM (R 4.5.0)
P ps 1.9.1 2025-04-12 [?] CRAN (R 4.5.0)
R6 2.6.1 2025-02-15 [1] CRAN (R 4.5.0)
P rappdirs 0.3.3 2021-01-31 [?] CRAN (R 4.5.0)
P Rcpp 1.1.0 2025-07-02 [?] CRAN (R 4.5.1)
renv 1.1.5 2025-07-24 [1] RSPM
rlang 1.1.6 2025-04-11 [1] CRAN (R 4.5.0)
P rmarkdown 2.30 2025-09-28 [?] RSPM
P rstudioapi 0.17.1 2024-10-22 [?] CRAN (R 4.5.0)
S7 0.2.1 2025-11-14 [1] RSPM (R 4.5.0)
sap * 0.0.0.1000 2025-11-19 [1] local
P sass 0.4.10 2025-04-11 [?] CRAN (R 4.5.0)
sessioninfo 1.2.3 2025-02-05 [1] CRAN (R 4.5.0)
P shiny * 1.11.1 2025-07-03 [?] CRAN (R 4.5.1)
shinychat 0.2.0.9000 2025-11-18 [1] Github (posit-dev/shinychat@8578e67)
P sys 3.4.3 2024-10-04 [?] CRAN (R 4.5.0)
P tibble 3.3.0 2025-06-08 [?] CRAN (R 4.5.0)
P tidyselect 1.2.1 2024-03-11 [?] CRAN (R 4.5.0)
vctrs 0.6.5 2023-12-01 [1] CRAN (R 4.5.0)
P websocket 1.4.4 2025-04-10 [?] RSPM
withr 3.0.2 2024-10-28 [1] CRAN (R 4.5.0)
P xfun 0.53 2025-08-19 [?] CRAN (R 4.5.1)
P xtable 1.8-4 2019-04-21 [?] CRAN (R 4.5.0)
P yaml 2.3.10 2024-07-26 [?] RSPM
[1] /Users/mjfrigaard/Library/Caches/org.R-project.R/R/renv/library/sap-28a55b39/macos/R-4.5/x86_64-apple-darwin20
[2] /Users/mjfrigaard/Library/Caches/org.R-project.R/R/renv/sandbox/macos/R-4.5/x86_64-apple-darwin20/c8cd77eb
* ── Packages attached to the search path.
P ── Loaded and on-disk path mismatch.
─────────────────────────────────────────────────────────────────────────────────



