30  πŸ— btw

Published

2025-06-11

Alert

The contents for section are being revised. Thank you for your patience.

The final chapter in this section will focus on btw, a package designed to, β€œhelp you describe your computational environment to LLMs.” btw also relies on ellmer for configuring a model of choice (the default is ellmer::chat_claude()).

30.1 Configuration

Place the btw configuration options in the .Rprofile (similar to other ellmer configurations). Recall that the .Rprofile file can exist at the user and/or the project-level. For example, a project-level .Rprofile for the sap package might include the following:

if (interactive()) {
  require(ellmer, quietly = TRUE)
}
if (interactive()) {
  require(btw, quietly = TRUE)
}
options(
  btw.chat_client = ellmer::chat_anthropic(),
  width = 50L,
  pillar.width = 50L,
  width = 80,
  str = utils::strOptions(strict.width = 'cut'),
  repos = c(pm = "https://packagemanager.posit.co/cran/latest",
            CRAN = "https://cloud.r-project.org")
)
1
ellmer llm package
2
btw llm package
3
btw config
4
printing configs
5
repos configs

After restarting Positron (or RStudio ), the Console should display the model we’re using:

R 4.5.0 exited (preparing for restart)
R 4.5.0 restarted.
Using model = "claude-sonnet-4-20250514".

We can confirm btw is configured by viewing the R version:

btw("@platform_info")
# βœ” btw copied to the clipboard!
## Context

"@platform_info"
<system_info>
R_VERSION: R version 4.5.0 (2025-04-11)
OS: macOS Sequoia 15.5
SYSTEM: x86_64, darwin20
UI: Positron (a VS Code equivalent)
LANGUAGE: (EN)
LOCALE: en_US.UTF-8
ENCODING: en_US.UTF-8
TIMEZONE: America/Phoenix
DATE: Wednesday, June 11, 2025 (2025-06-11)
</system_info>