-
Notifications
You must be signed in to change notification settings - Fork 16.1k
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
Swap in Sympy instead of numexpr for more expressive LLMMath tool #8627
Conversation
… into mevans/fixing_sympy
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Ignored Deployment
|
i wonder if for backwards compatibility / flexibility we should introduce something like an "engine" parameter that lets' folks choose which they want to use (and uses appropriate prompt based on that) |
@montyevans Hi , could you, please, resolve the merging issues and address the last comments (if needed)? After that, ping me and I push this PR for the review. Thanks! |
Looks like this isn't being worked on anymore. I'll close for now, and if you resume work, feel free to reopen! |
@efriis if there is interest I can restart work on this PR |
sympy
instead ofnumexpr
in the LLMMath ChainNote that we already use
sympy
in the symbolic math tool, so this actually removes a dependency!numexpr
is actually quite fragile to input, whereassympify
is really quite hard to break. Take the iconic Langchain tool example mixing information retrieval and numerical calculation: "Who is Leo DiCaprio's girlfriend? What is her current age raised to the 0.43 power?" (from this tutorial page).If you make the maths more exotic ("What is the first prime number larger than her age?", "What is the factorial of her age?", etc.)
numexpr
will raise an exception.sympy
handles these with flying colours.I used the chain from that example, with the prompt:
and with
sympy
, my chain passed with flying colours :)