selfcorrect {mergen} | R Documentation |
Self correct the code returned by the agent
Description
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.
Usage
selfcorrect(
agent,
prompt,
context = rbionfoExp,
attempts = 3,
output.file = NULL,
...
)
Arguments
agent |
An object containing the agent's information (e.g., type and model). |
prompt |
The prompt text to send to the language model. |
context |
Optional context to provide alongside the prompt (default is rbionfoExp). |
attempts |
Numeric value denoting how many times the code should be sent back for fixing. |
output.file |
Optional output file created holding parsed code |
... |
Additional arguments to be passed to the |
Value
A list containing the following elements:
init.response |
A character vector representing the initial prompt response. |
init.blocks |
A list of initial blocks. |
final.blocks |
A list of final blocks. |
code.works |
A boolean value indicating whether the code works. |
exec.result |
A character string representing the execution results. |
tried.attempts |
An integer representing the number of attempts. |
See Also
promptContext
for predefined contexts to use.
Examples
## Not run:
response <- selfcorrect(agent,prompt,context=rbionfoExp, max_tokens = 500)
## End(Not run)