The function attempts to correct the code returned by the agent by re-feeding to the agent with the error message. If there are no error messages function returns the original response.
selfcorrect(
agent,
prompt,
context = rbionfoExp,
attempts = 3,
output.file = NULL,
responseWithError = NULL,
history = NULL,
...
)
A list containing the following elements:
A character vector representing the initial prompt response.
A list of initial blocks.
A list of final blocks.
A boolean value indicating whether the code works.
A character string representing the execution results.
An integer representing the number of attempts.
An object containing the agent's information (e.g., type and model).
The prompt text to send to the language model.
Optional context to provide alongside the prompt (default is rbionfoExp).
Numeric value denoting how many times the code should be sent back for fixing.
Optional output file created holding parsed code
a list of response and errors returned from executeCode().
a list of previous response and prompts. Default is NULL and should be stayed as is for most use cases. First element is expected to be the response and the second element is the error list returned by executeCode().
Additional arguments to be passed to the sendPrompt
function.
promptContext
for predefined contexts to use.
if (FALSE) {
response <- selfcorrect(agent,prompt,context=rbionfoExp, max_tokens = 500)
}
Run the code above in your browser using DataLab