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
The package includes an experimental function `llm_auto_viz()` that uses Large Language Models (LLMs) to automatically generate appropriate visualisations based on dataset structure and optional user guidance. This feature inspired by agentic workflows to simplify exploratory data visualisation for epidemiologists.
157
+
158
+
```r
159
+
# Basic usage - let the LLM choose the most appropriate visualisation
160
+
viz<- llm_auto_viz(lab_data)
161
+
162
+
# Provide guidance on the type of visualisation needed
163
+
viz<- llm_auto_viz(lab_data,
164
+
user_prompt="Create a line chart showing trends over time.")
165
+
166
+
# Get the generated R code without executing it (for reviewing or modifying)
167
+
code<- llm_auto_viz(lab_data, execute=FALSE)
168
+
```
169
+
170
+
#### Key Features
171
+
172
+
-**Privacy Protection**: Only metadata (column names, types, and summary statistics) is shared with the LLM, never the actual data, ensuring confidentiality of sensitive health information.
173
+
-**User-guided Visualisation**: Combine the standard structurally-aware prompt with your specific visualisation needs through the `user_prompt` parameter.
174
+
-**Code Generation**: Use `execute = FALSE` to retrieve the generated R code for review, learning or further customisation instead of the visualisation itself.
175
+
-**Data-aware Selection**: The LLM selects appropriate chart types and column mappings based on the dataset structure, choosing suitable date columns for x-axes and numeric columns for measurements.
176
+
-**Exploratory Analysis**: Ideal for rapid exploratory analysis, especially for epidemiologists with limited R programming experience.
177
+
178
+
> **Note**: As LLM outputs are non-deterministic, this feature is not suitable for reproducible analytical pipelines. However, it excels at exploratory data analysis by providing instant, contextually appropriate visualisations.
179
+
180
+
#### Supported LLM Providers
181
+
182
+
The function supports multiple LLM providers:
183
+
121
184
## Package data
122
185
123
186
epiviz includes an anonymised sample dataset from the SGSS laboratory database: `lab_data()`
Copy file name to clipboardExpand all lines: README.md
+27-1Lines changed: 27 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -83,6 +83,32 @@ plot <- line_chart(
83
83
plot_interpretation<- llm_interpret(plot)
84
84
```
85
85
86
+
### Automated Visualisation Generation
87
+
88
+
The package includes an experimental function `llm_auto_viz()` that uses Large Language Models (LLMs) to automatically generate appropriate visualisations based on dataset structure and optional user guidance. This feature inspired by agentic workflows to simplify exploratory data visualisation for epidemiologists.
89
+
90
+
```r
91
+
# Basic usage - let the LLM choose the most appropriate visualisation
92
+
viz<- llm_auto_viz(lab_data)
93
+
94
+
# Provide guidance on the type of visualisation needed
95
+
viz<- llm_auto_viz(lab_data,
96
+
user_prompt="Create a line chart showing trends over time.")
97
+
98
+
# Get the generated R code without executing it (for reviewing or modifying)
99
+
code<- llm_auto_viz(lab_data, execute=FALSE)
100
+
```
101
+
102
+
#### Key Features
103
+
104
+
-**Privacy Protection**: Only metadata (column names, types, and summary statistics) is shared with the LLM, never the actual data, ensuring confidentiality of sensitive health information.
105
+
-**User-guided Visualisation**: Combine the standard structurally-aware prompt with your specific visualisation needs through the `user_prompt` parameter.
106
+
-**Code Generation**: Use `execute = FALSE` to retrieve the generated R code for review, learning or further customisation instead of the visualisation itself.
107
+
-**Data-aware Selection**: The LLM selects appropriate chart types and column mappings based on the dataset structure, choosing suitable date columns for x-axes and numeric columns for measurements.
108
+
-**Exploratory Analysis**: Ideal for rapid exploratory analysis, especially for epidemiologists with limited R programming experience.
109
+
110
+
> **Note**: As LLM outputs are non-deterministic, this feature is not suitable for reproducible analytical pipelines. However, it excels at exploratory data analysis by providing instant, contextually appropriate visualisations.
111
+
86
112
#### Supported LLM Providers
87
113
88
114
The function supports multiple LLM providers:
@@ -93,7 +119,7 @@ The function supports multiple LLM providers:
93
119
94
120
#### Environment Variable Setup
95
121
96
-
To use the `llm_interpret()`function, you need to set up the following environment variables:
122
+
To use the `llm_interpret()`or `llm_auto_viz()` functions, you need to set up the following environment variables:
97
123
98
124
```r
99
125
# In your .Renviron file or before calling the function:
0 commit comments