f"The code blob you used is invalid: due to the following error: {e}. This means that the regex pattern {pattern} was not respected. Make sure to correct its formatting. Code blob was: {code_blob}"
f"""
The code blob you used is invalid: due to the following error: {e}
This means that the regex pattern {pattern} was not respected: make sure to include code with the correct pattern, for instance:
}# This list can be augmented by the code agent creating some new functions
defstep(self):
defstep(self):
"""
"""
...
@@ -911,7 +1053,11 @@ class ReactCodeAgent(ReactAgent):
...
@@ -911,7 +1053,11 @@ class ReactCodeAgent(ReactAgent):
try:
try:
result=self.python_evaluator(
result=self.python_evaluator(
code_action,
code_action,
tools=self.available_tools,
static_tools={
**BASE_PYTHON_TOOLS.copy(),
**self.toolbox.tools,
},
custom_tools=self.custom_tools,
state=self.state,
state=self.state,
authorized_imports=self.authorized_imports,
authorized_imports=self.authorized_imports,
)
)
...
@@ -920,7 +1066,7 @@ class ReactCodeAgent(ReactAgent):
...
@@ -920,7 +1066,7 @@ class ReactCodeAgent(ReactAgent):
self.logger.log(32,information)
self.logger.log(32,information)
current_step_logs["observation"]=information
current_step_logs["observation"]=information
exceptExceptionase:
exceptExceptionase:
error_msg=f"Failed while trying to execute the code below:\n{CustomFormatter.reset+code_action+CustomFormatter.reset}\nThis failed due to the following error:\n{str(e)}"
error_msg=f"Code execution failed due to the following error:\n{str(e)}"
if"'dict' object has no attribute 'read'"instr(e):
if"'dict' object has no attribute 'read'"instr(e):
error_msg+="\nYou get this error because you passed a dict as input for one of the arguments instead of a string."
error_msg+="\nYou get this error because you passed a dict as input for one of the arguments instead of a string."