Skip to content

Conversation

@gadenbuie
Copy link
Contributor

@gadenbuie gadenbuie commented Aug 18, 2025

Adds a simple chat interface via querychat_app() that lets you quickly spin up a chat around a dataset.

The simplest approach is to just pass in a dataset:

library(querychat)

mtcars |> querychat_app()

Or you can configure the chat using the ..., which are passed to querychat_init()

mtcars |> querychat_app(client = ellmer::chat_anthropic())

Or you can pass in a full querychat_init() object

querychat_config <- querychat_init(
  data_source = querychat_data_source(mtcars),
  greeting = "Hi! Ask me about the mtcars dataset.

* <span class='suggestion submit'>What is the average mpg?</span>
* <span class='suggestion submit'>Show me the top 5 cars by hp.</span>
* <span class='suggestion submit'>Show me the cars with mpg greater than 20.</span>",
  extra_instructions = "/no_think",
  client = ellmer::chat_ollama(model = "qwen3:8b"),
)

querychat_config |> querychat_app()

@gadenbuie gadenbuie force-pushed the r/feat/querychat-app branch from 9a37c10 to 26ad4ef Compare August 18, 2025 19:56
@gadenbuie gadenbuie requested a review from Copilot August 18, 2025 20:25
@gadenbuie gadenbuie marked this pull request as ready for review August 18, 2025 20:25
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds a new querychat_app() function that creates a simple Shiny app for chatting with data using natural language queries. The app provides a complete interface with a sidebar chat, data dashboard, and SQL query display.

Key changes include:

  • New querychat_app() function for launching a standalone Shiny app
  • Refactored tool system with dedicated functions for dashboard updates and queries
  • Enhanced UI components with proper HTML dependencies and JavaScript interactions

Reviewed Changes

Copilot reviewed 9 out of 10 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
pkg-r/R/querychat_app.R Main implementation of the new querychat_app() function with complete Shiny UI/server logic
pkg-r/R/querychat_tools.R New tool system with tool_update_dashboard() and tool_query() functions
pkg-r/R/querychat.R Refactored to use new tool system and added JavaScript dependency management
pkg-r/inst/htmldep/querychat.js JavaScript for handling dashboard update button interactions
pkg-r/man/querychat_app.Rd Documentation for the new function
pkg-r/pkgdown/_pkgdown.yml Added new function to package documentation index
pkg-r/NAMESPACE Exported the new querychat_app() function
pkg-r/DESCRIPTION Updated dependencies for new functionality
pkg-r/NEWS.md Documented the new feature

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@gadenbuie gadenbuie force-pushed the r/feat/querychat-app branch from 74529e4 to 41d46f0 Compare August 18, 2025 20:35
@gadenbuie gadenbuie merged commit c708063 into main Aug 18, 2025
15 checks passed
@gadenbuie gadenbuie deleted the r/feat/querychat-app branch August 18, 2025 20:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants