You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: pkg-py/docs/build.qmd
+17Lines changed: 17 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -4,6 +4,23 @@ title: Build an app
4
4
5
5
While the [`.app()` method](reference/querychat.qmd#querychat.querychat.app) provides a quick way to start exploring data, building bespoke Shiny apps with querychat unlocks the full power of integrating natural language data exploration with custom visualizations, layouts, and interactivity. This guide shows you how to integrate querychat into your own Shiny applications and leverage its reactive data outputs to create rich, interactive dashboards.
6
6
7
+
querychat is a particularly good fit for Shiny apps that have:
8
+
9
+
1.**A single data source** (or a set of related tables that can be joined)
10
+
2.**Multiple filters** that let users slice and explore the data in different ways
11
+
3.**Several visualizations and outputs** that all depend on the same filtered data
12
+
13
+
In these apps, querychat can replace or augment your filtering UI by allowing users to describe what they want to see in natural language. Instead of building complex filter controls, users can simply ask questions like "show me customers from California who spent over $1000 last quarter" and querychat will generate the appropriate SQL query.
14
+
15
+
This is especially valuable when:
16
+
17
+
- Your data has many columns and building a UI for all possible filters would be overwhelming
18
+
- Users want to explore ad-hoc combinations of filters that you didn't anticipate
19
+
- You want to make data exploration more accessible to users who aren't comfortable with traditional filtering UIs
20
+
21
+
If you have an existing app with a reactive data frame that flows through multiple outputs, querychat can be a natural addition to provide an alternative way to filter that data.
22
+
23
+
7
24
## Starter template
8
25
9
26
Integrating querychat into a Shiny app requires just three steps:
Copy file name to clipboardExpand all lines: pkg-r/vignettes/build.Rmd
+27-10Lines changed: 27 additions & 10 deletions
Original file line number
Diff line number
Diff line change
@@ -15,14 +15,31 @@ knitr::opts_chunk$set(
15
15
)
16
16
```
17
17
18
-
While `querychat_app()` provides a quick way to start exploring data, building bespoke Shiny apps with QueryChat unlocks the full power of integrating natural language data exploration with custom visualizations, layouts, and interactivity. This guide shows you how to integrate QueryChat into your own Shiny applications and leverage its reactive data outputs to create rich, interactive dashboards.
18
+
While `querychat_app()` provides a quick way to start exploring data, building bespoke Shiny apps with querychat unlocks the full power of integrating natural language data exploration with custom visualizations, layouts, and interactivity. This guide shows you how to integrate querychat into your own Shiny applications and leverage its reactive data outputs to create rich, interactive dashboards.
19
+
20
+
querychat is a particularly good fit for Shiny apps that have:
21
+
22
+
1.**A single data source** (or a set of related tables that can be joined)
23
+
2.**Multiple filters** that let users slice and explore the data in different ways
24
+
3.**Several visualizations and outputs** that all depend on the same filtered data
25
+
26
+
In these apps, querychat can replace or augment your filtering UI by allowing users to describe what they want to see in natural language. Instead of building complex filter controls, users can simply ask questions like "show me customers from California who spent over $1000 last quarter" and querychat will generate the appropriate SQL query.
27
+
28
+
This is especially valuable when:
29
+
30
+
- Your data has many columns and building a UI for all possible filters would be overwhelming
31
+
- Users want to explore ad-hoc combinations of filters that you didn't anticipate
32
+
- You want to make data exploration more accessible to users who aren't comfortable with traditional filtering UIs
33
+
34
+
If you have an existing app with a reactive data frame that flows through multiple outputs, querychat can be a natural addition to provide an alternative way to filter that data.
35
+
19
36
20
37
## Starter template
21
38
22
-
Integrating QueryChat into a Shiny app requires just three steps:
39
+
Integrating querychat into a Shiny app requires just three steps:
23
40
24
41
1. Initialize a `QueryChat` instance with your data
25
-
2. Add the QueryChat UI component (either `$sidebar()` or `$ui()`)
42
+
2. Add the UI component (either `$sidebar()` or `$ui()`)
26
43
3. Use reactive values like `$df()`, `$sql()`, and `$title()` to build outputs that respond to user queries
27
44
28
45
Here's a starter template demonstrating these steps:
@@ -68,12 +85,12 @@ shinyApp(ui, server)
68
85
```
69
86
70
87
::: {.alert .alert-info}
71
-
You'll need to call the `qc$server()` method within your server function to set up QueryChat's reactive behavior, and capture its return value to access reactive data.
88
+
You'll need to call the `qc$server()` method within your server function to set up querychat's reactive behavior, and capture its return value to access reactive data.
72
89
:::
73
90
74
91
## Reactives
75
92
76
-
There are three main reactive values provided by QueryChat for use in your app:
93
+
There are three main reactive values provided by querychat for use in your app:
77
94
78
95
### Filtered data {#filtered-data}
79
96
@@ -334,7 +351,7 @@ shinyApp(ui = ui, server = server)
334
351
335
352
## Programmatic updates {#programmatic-filtering}
336
353
337
-
QueryChat's reactive state can be updated programmatically. For example, you might want to add a "Reset Filters" button that clears any active filters and returns the data table to its original state. You can do this by setting both the SQL query and title to their default values. This way you don't have to rely on both the user and LLM to send the right prompt.
354
+
querychat's reactive state can be updated programmatically. For example, you might want to add a "Reset Filters" button that clears any active filters and returns the data table to its original state. You can do this by setting both the SQL query and title to their default values. This way you don't have to rely on both the user and LLM to send the right prompt.
338
355
339
356
```{r}
340
357
ui <- page_sidebar(
@@ -368,10 +385,10 @@ This is equivalent to the user asking the LLM to "reset" or "show all data".
368
385
369
386
## Multiple tables
370
387
371
-
Currently, you have two options for exploring multiple tables in QueryChat:
388
+
Currently, you have two options for exploring multiple tables in querychat:
372
389
373
-
1. Join the tables into a single table before passing to QueryChat
374
-
2. Use multiple QueryChat instances in the same app
390
+
1. Join the tables into a single table before passing to querychat
391
+
2. Use multiple querychat instances in the same app
375
392
376
393
The first option makes it possible to chat with multiple tables inside a single chat interface, whereas the second option requires a separate chat interface for each table.
0 commit comments