-
Notifications
You must be signed in to change notification settings - Fork 2k
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
My LLM write the code in OOP style, defined the class and class methods, when try to execute class method it fails
Code to reproduce the error
from smolagents import LocalPythonExecutor
agent_name = "Agent"
executor = LocalPythonExecutor(additional_authorized_imports=["json", "os", "urllib.parse", "bs4", "pprint"])
executor.send_variables({"agent_name": agent_name})
code = """
class Hello:
def greetings(self, name: str):
return f"Hello {name}"
obj = Hello()
print(obj.greetings(agent_name))
"""
executor(code)
Error logs (if any)
InterpreterError: Code execution failed at line 'print(obj.greetings(agent_name))' due to: InterpreterError: It is not permitted to evaluate other functions than the provided tools or functions defined/imported in previous code (tried to execute print).
Expected behavior
Successfully execute the code
Packages version:
smolagents==1.12.0
Additional context
Add any other context about the problem here.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working