View source: R/goose_ask_enhanced.R
| goose_ask | R Documentation |
Send a query to Goose AI and get a beautifully formatted response. This is an enhanced version of goose_ask that formats the output by default.
goose_ask(
prompt,
format = getOption("goose.auto_format", TRUE),
output_format = c("text", "json"),
quiet = TRUE,
timeout = getOption("goose.timeout", 300),
retries = getOption("goose.retries", 1),
session_id = NULL,
width = getOption("goose.format_width", 80),
color = getOption("goose.format_color", TRUE),
...
)
prompt |
Character string with the question or prompt |
format |
Logical, whether to format the response (default TRUE) |
output_format |
Character, either "text" or "json" |
quiet |
Logical, suppress status messages |
timeout |
Numeric, timeout in seconds (default 300, i.e., 5 minutes). Complex queries may take longer. Set to Inf for no timeout. |
retries |
Integer, number of retries after the first attempt (default uses
|
session_id |
Optional session ID for context preservation |
width |
Integer, line width for wrapping (default 80) |
color |
Logical, whether to use color output (default TRUE) |
... |
Additional formatting arguments |
If format=TRUE and output_format="text", displays formatted response and returns raw text invisibly. If format=FALSE or output_format="json", returns the raw response.
## Not run:
# Get a beautifully formatted response (default)
goose_ask("What is the tidyverse?")
# Get raw unformatted response
raw <- goose_ask("What is R?", format = FALSE)
# Get JSON response (never formatted)
data <- goose_ask("List 5 R packages", output_format = "json")
# Customize formatting
goose_ask("Explain ggplot2", width = 100, color = FALSE)
# For very complex queries, increase timeout
goose_ask("Write a complete Shiny app", timeout = 600)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.