Learn R Programming

querychat (version 0.2.0)

querychat-package: querychat: Chat with Your Data Using Natural Language

Description

querychat provides an interactive chat interface for querying data using natural language. It translates your questions into SQL queries, executes them against your data, and displays the results. The package works with both data frames and database connections.

Arguments

Quick Start

The easiest way to get started is with the QueryChat R6 class:

library(querychat)

# Create a QueryChat object (table name inferred from variable) qc <- QueryChat$new(mtcars)

# Option 1: Run a complete app with sensible defaults qc$app()

# Option 2: Build a custom Shiny app ui <- page_sidebar( qc$sidebar(), dataTableOutput("data") )

server <- function(input, output, session) { qc$server() output$data <- renderDataTable(qc$df()) }

shinyApp(ui, server)

Key Features

  • Natural language queries: Ask questions in plain English

  • SQL transparency: See the generated SQL queries

  • Multiple data sources: Works with data frames and database connections

  • Customizable: Add data descriptions, extra instructions, and custom greetings

  • LLM agnostic: Works with OpenAI, Anthropic, Google, and other providers via ellmer

Main Components

  • QueryChat: The main R6 class for creating chat interfaces

  • DataSource, DataFrameSource, DBISource: R6 classes for data sources

Examples

To see examples included with the package, run:

shiny::runExample(package = "querychat")

This provides a list of available examples. To run a specific example, like '01-hello-app', use:

shiny::runExample("01-hello-app", package = "querychat")

Author

Maintainer: Garrick Aden-Buie garrick@posit.co (ORCID)

Authors:

Other contributors:

  • Posit Software, PBC [copyright holder, funder]

See Also