SCPlotterChat Class
SCPlotterChat Class
Methods
Method new()
Create a new instance of the SCPlotterChat class
Usage
SCPlotterChat$new(provider, verbose = FALSE)
Arguments
provider
An LLM provider object See https://tjarkvandemerwe.github.io/tidyprompt/articles/getting_started.html#setup-an-llm-provider for more details on LLM providers
verbose
A logical value indicating whether to print verbose messages Default is FALSE. And this will override the verbose setting of the provider
Method ask()
Send a prompt to the chat interface and receive a response
Arguments
prompt
A character string containing the user's query or instruction
verbose
A logical value indicating whether to print verbose messages Default is NULL, which will use the verbose setting of the SCPlotterChat object
add_to_history
A logical value indicating whether to add the prompt and response to the chat history Default is TRUE
Examples
# \donttest{
if (FALSE) {
provider <- tidyprompt::llm_provider_openai(api_key = Sys.getenv("OPENAI_API_KEY"))
chat <- SCPlotterChat$new(provider)
chat$ask("What are the tools to use?")
# Tool identified: ListTools
# Available tools:
# - ClonalOverlapPlot : ClonalOverlapPlot
# Plot the overlap of the clones in different samples/groups.
#
# - EnrichmentPlot : Enrichment Plot
# This function generates various types of plots for enrichment analysis.
# ...
chat$ask("Plot the default cell-cell communication plot for the cellphonedb_res dataset")
# Tool identified: CCCPlot
# Data object identified: cellphonedb_res
# Running tool: CCCPlot
chat$ask("do a heatmap instead")
# Tool identified: CCCPlot
# Data object identified: cellphonedb_res
# Running tool: CCCPlot
}
# }