These functions wrap shinychat::chat_ui() and shinychat::chat_server()
with commons-specific answer provenance UI. Answers produced from
registered measures get a compact verified-answer pill. Answers produced
from fallback SQL or R can cite text from the agent's context, measure
definitions, or data documentation; verified citations render as footnotes
whose tooltips name their source. Fallback answers with no verified
citation get an untrusted caution pill.
Arguments
- id
The ID of the chat element; must match between
commons_ui()andcommons_server().- ...
In
commons_ui(), extra arguments passed toshinychat::chat_ui(). Incommons_server(), arguments passed toshinychat::chat_server().- client
A
commons()agent. Create a new agent for each Shiny session.
Value
commons_ui() returns UI. commons_server() returns the
shinychat::chat_server() result.
Examples
if (FALSE) { # \dontrun{
library(shiny)
ui <- page_fillable(
commons_ui("chat")
)
server <- function(input, output, session) {
agent <- commons(
ellmer::chat_anthropic(),
data_sources = data_source(sales = sales)
)
commons_server("chat", agent)
}
shinyApp(ui, server)
} # }
