Currently, tool requests (ContentToolRequest in the assistant turn) and tool results (a user turn with one or more ContentToolResult objects) are emitted to the console when echo = "all" but aren't yielded into the generator streaming results.
I'd like to add an option to $stream() and $stream_async(), possibly yield_all, that, when TRUE, will yield the non-text Content items of the assistant turn and all Content items of the user turn into the generator.
We've also discussed an option like include_tools, which would match the current implementation, but I can imagine a future where other content types are created during the chat back-and-forth.
In shinychat, we'd use this option like this:
shiny::observeEvent(input$chat_user_input, {
stream <- client$stream_async(user_input, yield_all = TRUE)
shinychat::chat_append(ui_id, stream)
})
Currently, tool requests (
ContentToolRequestin the assistant turn) and tool results (a user turn with one or moreContentToolResultobjects) are emitted to the console whenecho = "all"but aren't yielded into the generator streaming results.I'd like to add an option to
$stream()and$stream_async(), possiblyyield_all, that, whenTRUE, will yield the non-textContentitems of the assistant turn and allContentitems of the user turn into the generator.We've also discussed an option like
include_tools, which would match the current implementation, but I can imagine a future where other content types are created during the chat back-and-forth.In shinychat, we'd use this option like this: