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
When using elmer with shinychat, users may have to construct both the message for shinychat::chat_append_message() and then separately call chat$stream() with the same message, or parts of it.
Here's an example app:
library(elmer)
library(shiny)
library(shinychat)
ui<-bslib::page_fluid(
chat_ui("chat"),
actionButton("ask_photo", "Ask question with image")
)
server<-function(input, output, session) {
chat<- chat_openai(
model="gpt-4o",
)
observeEvent(input$ask_photo, {
turn<- Turn(
"user",
list(
ContentText("What photographic choices were made here, and why do you think the photographer chose them?"),
content_image_file("photo.jpg")
)
)
chat_append_message(
"chat",
list(
role="user",
content=turn@text
)
)
chat_append(
"chat",
chat$stream_async(!!!turn@contents)
)
})
}
shinyApp(ui, server)
It'd be helpful if there were a way to take the constructed turn and pass it directly to a chat method. Ideally even multiple turns at once to support advanced use cases.
The text was updated successfully, but these errors were encountered:
When using elmer with shinychat, users may have to construct both the message for
shinychat::chat_append_message()
and then separately callchat$stream()
with the same message, or parts of it.Here's an example app:
It'd be helpful if there were a way to take the constructed turn and pass it directly to a
chat
method. Ideally even multiple turns at once to support advanced use cases.The text was updated successfully, but these errors were encountered: