Learn R Programming

llmflow (version 3.0.2)

response_to_r: Response to R code generation and execution with session continuity

Description

Response to R code generation and execution with session continuity

Usage

response_to_r(
  chat_obj,
  prompt,
  add_text = NULL,
  pkgs_to_use = c(),
  objects_to_use = list(),
  existing_session = NULL,
  list_packages = TRUE,
  list_objects = TRUE,
  return_session_info = TRUE,
  evaluate_code = TRUE,
  r_session_options = list(),
  return_mode = c("full", "code", "console", "object", "formatted_output", "llm_answer",
    "session"),
  max_iterations = 3
)

Value

Result based on return_mode

Arguments

chat_obj

Chat object from ellmer

prompt

User prompt for R code generation

add_text

Additional instruction text

pkgs_to_use

Packages to load in R session

objects_to_use

Named list of objects to load in R session

existing_session

Existing callr session to continue from (optional)

list_packages

Whether to list available packages in prompt

list_objects

Whether to list available objects in prompt

return_session_info

Whether to return session state information

evaluate_code

Whether to evaluate the generated code

r_session_options

Options for callr R session

return_mode

Return mode specification

max_iterations

Maximum retry attempts