sampleResponse {mergen} | R Documentation |
Sample more solutions when non-executable code returned by the agent
Description
The function attempts to sample more solutions by the agent when the code returned by the agent is faulty. The function simply asks for solutions until an executable code is returned or until number of attempts is reached.
Usage
sampleResponse(
agent,
prompt,
context = rbionfoExp,
attempts = 3,
output.file = NULL,
responseWithError = 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 |
responseWithError |
a list of response and errors returned from executeCode(). 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 |
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:
resp.list <- sampleResponse(agent,prompt,context=rbionfoExp, max_tokens = 500)
## End(Not run)