| create_clinical_chat | R Documentation |
Creates an ellmer::Chat object pre-configured with tools for exploring a clinical dataset. Data remains local; only tool results are shared with the model.
create_clinical_chat(data, system_prompt = NULL, provider = NULL, ...)
data |
A data.frame containing clinical data. |
system_prompt |
Character. System prompt for the model. Defaults to a clinical analyst persona that emphasizes accuracy and privacy. |
provider |
Character or NULL. Provider string for ellmer::chat(), e.g. "openai/gpt-4o-mini". If NULL, uses the default from ellmer. |
... |
Additional arguments passed to ellmer::chat(). |
An ellmer Chat object with clinical tools registered.
# Create sample clinical data (executable)
data <- data.frame(
patient_id = 1:20,
age = sample(25:80, 20, replace = TRUE),
sex = sample(c("M", "F"), 20, replace = TRUE),
outcome = sample(c("responder", "non-responder"), 20, replace = TRUE)
)
# Inspect available tools (no API key required)
tools <- clinical_tools(data)
length(tools)
# Creating a chat object requires a configured LLM provider
if (FALSE) {
chat <- create_clinical_chat(data, provider = "openai/gpt-4o-mini")
# chat$chat("How many responders are there by sex?")
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.