Constructs an LLM-based agent for generating, debugging, explaining, or optimizing R code using structured prompts. The agent handles retries and provides comprehensive code assistance.
Arguments
- llm
A function that accepts a character prompt and returns an LLM response.
- system_prompt
Optional system-level instructions for the agent's behavior.
- user_input
The user's task/query (e.g., "Write function to filter NAs").
- max_tries
Maximum number of attempts for LLM calls (default: 3).
- backoff
Seconds to wait between retries (default: 2).
- verbose
Logical controlling progress messages (default: TRUE).