The hardware and bandwidth for this mirror is donated by METANET, the Webhosting and Full Service-Cloud Provider.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]metanet.ch.
Chat UI component for Shiny for R.
(For Shiny for Python, see ui.Chat.)
You can install shinychat from CRAN with:
install.packages("shinychat")
Or, install the development version of shinychat from GitHub with:
# install.packages("pak")
::pak("jcheng5/shinychat") pak
To run this example, you’ll first need to create an OpenAI API key,
and set it in your environment as OPENAI_API_KEY
.
You’ll also need to call pak::pak("tidyverse/elmer")
to
install the {elmer}
package.
library(shiny)
library(shinychat)
<- bslib::page_fluid(
ui chat_ui("chat")
)
<- function(input, output, session) {
server <- elmer::chat_openai(system_prompt = "You're a trickster who answers in riddles")
chat
observeEvent(input$chat_user_input, {
<- chat$stream_async(input$chat_user_input)
stream chat_append("chat", stream)
})
}
shinyApp(ui, server)
These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.