Skip to content
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

Remove pythonrepl from LLM-MathChain #2943

Merged
merged 2 commits into from
Apr 16, 2023
Merged

Conversation

vowelparrot
Copy link
Contributor

@vowelparrot vowelparrot commented Apr 15, 2023

Use numexpr evaluate instead of the python REPL to avoid malicious code injection.

Tested against the (limited) math dataset and got the same score as before.

For more permissive tools (like the REPL tool itself), other approaches ought to be provided (some combination of Sanitizer + Restricted python + unprivileged-docker + ...), but for a calculator tool, only mathematical expressions should be permitted.

See #814

Use numexpr evaluate instead of the python repl.

Tested against the (limited) math dataset and got the same
score as before.
@vowelparrot vowelparrot changed the title Fix LLM-MathChain's Logic Remove pythonrepl from LLM-MathChain Apr 15, 2023
Copy link
Contributor

@hwchase17 hwchase17 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lets ship it!

@hwchase17 hwchase17 merged commit 5ca7ce7 into master Apr 16, 2023
@hwchase17 hwchase17 deleted the vwp/use_numexpr_math_chain branch April 16, 2023 15:50
samching pushed a commit to samching/langchain that referenced this pull request May 1, 2023
Use numexpr evaluate instead of the python REPL to avoid malicious code
injection.

Tested against the (limited) math dataset and got the same score as
before.

For more permissive tools (like the REPL tool itself), other approaches
ought to be provided (some combination of Sanitizer + Restricted python
+ unprivileged-docker + ...), but for a calculator tool, only
mathematical expressions should be permitted.

See langchain-ai#814
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants