| goose_stream | R Documentation |
Execute a query with streaming response handling
goose_stream(
query,
callback = NULL,
error_callback = NULL,
complete_callback = NULL,
session_id = NULL,
max_time = getOption("goose.stream_timeout", Inf),
idle_timeout = getOption("goose.stream_idle_timeout", Inf)
)
query |
The query to send to Goose |
callback |
Function to call with each chunk (default: cat) |
error_callback |
Function to call on error |
complete_callback |
Function to call on completion |
session_id |
Optional session ID for context |
max_time |
Numeric, maximum runtime in seconds for the stream (default uses
|
idle_timeout |
Numeric, maximum time in seconds without receiving any output
before aborting the stream (default uses |
Invisible NULL (results handled via callbacks)
## Not run:
# Simple streaming with default output
goose_stream("Explain R functions")
# Custom callback for processing chunks
goose_stream("Write a function", callback = function(chunk) {
message("Received: ", nchar(chunk), " characters")
cat(chunk)
})
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.