Skip to contents

Setting up an agent

Function for setting up an AI agent

setupAgent()
set up an online LLM API for subsequent tasks

Sending prompts

Functions for sending prompts to your agent

sendPrompt()
Send a prompt to a specified language model agent and return the response.
selfcorrect()
Self correct the code returned by the agent
runCodeInResponse()
Executes the code in the received response from the agent
sampleResponse()
Sample more solutions when non-executable code returned by the agent

Manipulate agent’s answer

Functions for manipulating the agents answer so code can be extracted, executed, filenames can be extracted etc. Some of these functions are internally used by others.

clean_code_blocks()
Clean code blocks returned by the agent
extractCode()
extract the code and text from the text returned by LLM agent
executeCode()
execute code
extractFilenames()
Extract file names from user prompt
fileHeaderPrompt()
Extract file headers from files in prompt
check_install()
Check and Install R Package
extractInstallPkg()
extract package names and install them
promptContext()
Predefined prompt contexts for prompt engineering