Have you ever had an idea for a great web application with Shiny but felt something holding you back from getting started? Maybe it’s that you don’t know where to start, or that you don’t know which packages use to build the app, or maybe it’s just that you can’t muster the energy to get started. Sometimes you just need a little help to get unstuck.
We’re excited to announce a new addition to the Shiny ecosystem that can help: Shiny Assistant.
Shiny Assistant is a new AI-powered tool that helps you get things done: you can ask it questions about Shiny, or to create a Shiny application from scratch, or ask it to make changes to an existing application. You can think of it as a knowledgeable colleague who is always ready to help out with your Shiny projects, in both R and in Python.
Let’s have a look at a few practical examples of what Shiny Assistant can do. Suppose you want to build an application to calculate mortgage payments. You can just ask Shiny Assistant to build it for you.
“Create an application which calculates mortgage payments.”
Great, we have a working application!
Although Shiny Assistant quickly built an application that works, you are still needed in the loop. It is important to verify the code – you will need to apply your knowledge of the problem domain to check that the application is doing the right thing.
Now that we have something that’s working, we can also ask it to make changes to the application.
“Add a plot which shows the remaining principal on the mortgage.”
Sometimes you know the change that you want to make, and it would be inefficient or complicated to ask Shiny Assistant to make the change for you. In these cases, you can edit the code directly, in the editor panel.
The default values for mortgage amount and interest need a little bit of adjustment to accurately reflect today’s economic conditions. Here we’ll change the code in the editor panel and re-run the application by clicking on the Play button.
Now if we ask Shiny Assistant to make more changes, it will use the code in the editor panel as the basis for further changes – no need to copy and paste your modified code into the chat window.
Notice that when we ask it to add another feature, the updated code keeps the changes to the starting values that we made just above.
“Add an amortization table.”
If you’d like to use this application, here it is with the code editor, and here’s just the application on its own.
Quickly turn ideas into reality
Now that you’ve seen Shiny Assistant in action, here are some applications that it helped build – all in under 5 minutes. Some of these are made with R and some are made with Python.
An assistant for Shiny apps
It’s useful to think of Shiny Assistant really as an assistant – it’s there to help you get things done, and it’s fast, and it never gets tired of helping. If you don’t know whether it can do the thing you want, just try asking. We’ve been surprised many times by what Shiny Assistant is capable of doing.
All that said, it doesn’t always get things right. Like a human assistant, it’s imperfect: it makes mistakes, it has gaps in its knowledge, and sometimes in the course of trying to solve a problem, it gets stuck on the wrong path.
When those things happen, you can use the chat to ask it to fix mistakes. For example, if there’s an error that you don’t understand, you can copy and paste the error message into the chat and ask Shiny Assistant to explain and/or fix the problem.
The LLM’s training data is at least few months old as of this writing, so it doesn’t know the absolute latest features in Shiny or other packages. If you find that you need a feature that is newer than the training data, then you can “teach” it by pasting documentation or other examples into the chat.
Shiny Assistant can help with both R and Python – notice the R/Python switch in the upper left.