Open gadenbuie opened 2 days ago
I wonder if there's some way to make something like this work:
server <- function(input, output, session) {
chat <- chat_openai(model = "gpt-4o")
observeEvent(input$ask_photo, {
stream <- chat$stream_async(
ContentText("What photographic choices were made here, and why do you think the photographer chose them?"),
content_image_file(system.file("httr2.png", package = "elmer"))
)
chat_append_message("chat", chat$last_turn("user"))
chat_append_message("chat", stream)
})
}
Currently that doesn't work because the user turn is only set after the stream is completed.
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.