-
Notifications
You must be signed in to change notification settings - Fork 946
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] Standard function pow
cannot be executed by an agent
#546
Comments
The LocalPythonInterpreter uses Any reason for this choice? @aymeric-roucher |
But if you want it can be hacked around 🙃: import smolagents
inter = smolagents.LocalPythonInterpreter(additional_authorized_imports=[], tools={"bpow": pow})
inter("bpow(2,2,2)", {}) The name has to be different as BASE takes precedence here: https://github.com/sysradium/smolagents/blob/main/src/smolagents/local_python_executor.py#L1332 @albertvillanova original math.pow accepts 2 arguments. So to me everything looks good, not a bug 🤔 It is in line with math.sqrt and the rest ... |
Thanks for the fast reply! I checked the other functions here and I think only Also, I am curious, why are there |
Probably we need to hear from the big man himself, since those "renames" appear to be there from the very inception :) sysradium@f3dcf1f#diff-fee74ba77e514d876543376ff66d78c26eae4ce359b9f3073e3be10fba6e4950R61 |
Hello,
my steps are failing when the agent tries to invoke the standard
pow
function with the third argumentCode to reproduce the error
Error logs (if any)
InterpreterError: Code execution failed at line 'pow(2,2,2)' due to: TypeError:pow expected 2 arguments, got 3
Expected behavior
A clear and concise description of what you expected to happen.
Packages version:
version 0.1.7 and main
Perhaps there are other standard functions that are affected by this error, a unit test would be nice
The text was updated successfully, but these errors were encountered: