Programming with LLM APIs
A Beginner’s Guide in R and Python
posit::conf(2025)
2025-09-16
library(shiny)
library(bslib)
library(querychat)
mtcars_qc_config <- querychat_init(mtcars)
ui <- page_sidebar(
sidebar = querychat_sidebar("mtcars"),
# plots, tables, etc.
)
server <- function(input, output, session) {
mtcars_qc <- querychat_server("mtcars", mtcars_qc_config)
output$table <- renderTable({
mtcars_qc$df()
})
}
shinyApp(ui, server)import polars as pl
import querychat
from shiny import App, render, ui
mtcars = pl.read_csv("data/mtcars.csv")
mtcars_qc_config = querychat.init(mtcars, "mtcars")
app_ui = ui.page_sidebar(
querychat.sidebar("mtcars"),
# plots, tables, etc.
)
def server(input, output, session):
mtcars_qc = querychat.server("mtcars", mtcars_qc_config)
@render.data_frame
def data_table():
return qc.df()
app = App(app_ui, server)25_querychatI’ve made a Shiny dashboard to explore Airbnb listings in Asheville, NC.
Work through the steps in the comments to use querychat.
Spend a few minutes exploring the data and chatting with the app.
Which area has the most private rooms?
08:00
MCP
a.k.a. functions, tool calling or function calling
Bring real-time or up-to-date information to the model
Let the model interact with the world
posit::conf() scheduleMCP solves this problem! GitHub writes tools…
and lets you your models use them.
26_mcpFollow the instructions in README.R.md or README.py.md for this task.
What MCP servers are out there?
Set up context7 as an MCP server in Positron.
Use context7 tools to answer a coding translation question.
06:00
Agents
Hadley/Willison definition: Agents are LLMs with a read tool and a write tool
The “you know it when you see it” definition: autonomous LLMs, long context, minimal intervention
👨💻 _demos/27_demo_databot/README.md
Let’s look at
data/airbnb-asheville.csv, do some basic work to familiarize ourselves with the data, and then find interesting patterns that would be relevant to someone looking to open an Airbnb in Asheville, NC.
Please take 5-10 minutes to fill out the workshop survey.
Your feedback is important to us!
Enjoy posit::conf(2025)!