Lecture 22
Cornell University
INFO 4940/5940 - Fall 2025
November 13, 2025
TODO
ae-21Instructions
ae-21 (repo name will be suffixed with your GitHub name).renv::restore() (R) or uv sync (Python), open the Quarto document in the repo, and follow along and complete the exercises.Natural language chat powered by LLMs
Do not provide the LLM direct access to raw data
It can only read or filter data by writing SQL SELECT statements
Leverages DuckDB for its SQL engine
library(shiny)
library(bslib)
library(querychat)
penguins_qc_config <- querychat_init(penguins)
ui <- page_sidebar(
sidebar = querychat_sidebar("penguins"),
# plots, tables, etc.
)
server <- function(input, output, session) {
penguins_qc <- querychat_server("penguins", penguins_qc_config)
output$table <- renderTable({
penguins_qc$df()
})
}
shinyApp(ui, server)import polars as pl
import querychat
from shiny import App, render, ui
penguins = pl.read_csv("data/penguins.csv")
penguins_qc_config = querychat.init(penguins, "penguins")
app_ui = ui.page_sidebar(
querychat.sidebar("penguins"),
# plots, tables, etc.
)
def server(input, output, session):
penguins_qc = querychat.server("penguins", penguins_qc_config)
@render.data_frame
def data_table():
return qc.df()
app = App(app_ui, server)25_querychatInstructions
I’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
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
Tools that use LLms to help developers write, debug, and understand code
Instructions
12:00
TODO what coding task?
Online tool to help you build Shiny apps using an LLM
Also built directly into Positron Assistant - use the @shiny tag in your prompt
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
MCP solves this problem! GitHub writes tools…
and lets you your models use them.
26_mcp06:00
mcpEnables R/Python to be both MCP client and server
querychat