Skip to content

Chat UI component for Shiny for R

License

Unknown, MIT licenses found

Licenses found

Unknown
LICENSE
MIT
LICENSE.md
Notifications You must be signed in to change notification settings

jcheng5/shinychat

Repository files navigation

shinychat

R-CMD-check

Chat UI component for Shiny for R.

(For Shiny for Python, see ui.Chat.)

Installation

You can install the development version of shinychat from GitHub with:

# install.packages("pak")
pak::pak("jcheng5/shinychat")

Example

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("hadley/elmer") to install the {elmer} package.

library(shiny)
library(shinychat)

ui <- bslib::page_fluid(
  chat_ui("chat")
)

server <- function(input, output, session) {
  chat <- elmer::chat_openai(system_prompt = "You're a trickster who answers in riddles")
  
  observeEvent(input$chat_user_input, {
    stream <- chat$stream_async(input$chat_user_input)
    chat_append("chat", stream)
  })
}

shinyApp(ui, server)

About

Chat UI component for Shiny for R

Resources

License

Unknown, MIT licenses found

Licenses found

Unknown
LICENSE
MIT
LICENSE.md

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published