querychat in R: Query Your Data with Natural Language | Shiny + LLMs | Veerle van Leemput
Learn how to use querychat, an R package that lets users query data using natural language instead of predefined filters. Perfect for data scientists who want to build flexible, interactive Shiny dashboards without anticipating every possible user question.
In this tutorial, you'll discover:
- How querychat translates natural language to SQL using LLMs
- Setting up querychat in seconds with your data
- Building custom Shiny interfaces with reactive data frames
- Why it's reliable, transparent, and safe for production use
- Enterprise deployment with Azure, AWS Bedrock, or Google Vertex AI
Key Features:
Drop-in Shiny component
Works with any DBI-compatible database
Read-only by design for data safety
Full SQL transparency for reproducibility
Supports Claude, GPT, Gemini via ellmer
Resources:
- querychat Documentation: [https://posit-dev.github.io/querychat/py/index.html]
- Blog Post: "Where Questions Become Queries" [https://shiny.posit.co/blog/posts/querychat-python-r/
- Github repo: [https://github.com/posit-dev/querychat/tree/main/pkg-r]
Perfect for R users working with Shiny, data exploration, and interactive analytics.
Timestamps
00:00 - Introduction: The Dashboard Problem
00:50 - Why Dashboards Can't Answer Every Question
01:47 - What is querychat?
02:46 - Getting Started (Installation & Setup)
03:08 - API Key Setup (Claude, GPT, Gemini)
03:20 - First querychat App in 5 Lines of Code
04:04 - Live Demo: Querying Data with Natural Language
05:01 - How querychat Works Under the Hood
06:44 - Four Key Benefits (Reliability, Transparency, Reproducibility, Safety)
07:37 - Tool Calling & DuckDB Integration
08:46 - Building Custom Shiny Interfaces
09:01 - Customizing querychat Behavior (Greetings, Data Descriptions, Instructions)
11:00 - Creating Custom Dashboards with Reactive Data Frames
12:00 - Complete App Structure Walkthrough
13:10 - Safety & Security Deep Dive
14:00 - Enterprise Deployment (Azure, AWS, Google Vertex AI)
15:12 - Resources & Documentation
DBI
ellmer
querychat
Shiny
RStudio
Data Science
Machine Learning
Python
Stats
Tidyverse
Data Visualization
Data Viz
Ggplot
Technology
Coding
Connect
Server Pro
Shiny
RMarkdown
Package Manager
CRAN
Interoperability
Serious Data Science
Dplyr
Forcats
Ggplot2
Tibble
Readr
Stringr
Tidyr
Purrr
Github
Data Wrangling
Tidy Data
Odbc
Rayshader
Plumber
Blogdown
Gt
Lazy Evaluation
Tidymodels
Statistics
Debugging
Programming Education
Rstats
Open Source
OSS
Reticulate