Skip to content

Can agent support stream and async? #7

@bianchenhao

Description

@bianchenhao

For combinine shinychat.
Now, agent can only invoke, like code below, not a good interactive experience.

library(shiny)
library(shinychat)

ui <- bslib::page_fillable(
  chat_ui(
    id = "chat",
    messages = "**Hello!** How can I help you today?"
  ),
  fillable_mobile = TRUE
)

server <- function(input, output, session) {
  
  observeEvent(input$chat_user_input, {
    stream <- r_assistant$invoke(input$chat_user_input)
    chat_append("chat", stream)
  })
}

shinyApp(ui, server)

And LeadAgent is not async now, I can't capture intermediate state which I want to show users in shinychat.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions