[PR #2390] add built-in maths tool for local expression evaluation on NumExpr #23610

Closed
opened 2026-02-21 20:21:25 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/langgenius/dify/pull/2390

State: closed
Merged: Yes


Introduce a built-in tool for maths expression evaluation, running locally on numexpr (already required by Numpy as well).

The incorrect result on GLM3 without maths tool:
企业微信截图_1a8f1273-441c-4855-9298-46a46ce7214b

The correct result on GLM3 with maths tool:
企业微信截图_2d6197c8-9c93-4a54-b1ba-a06b22c657f8

image

**Original Pull Request:** https://github.com/langgenius/dify/pull/2390 **State:** closed **Merged:** Yes --- Introduce a built-in tool for maths expression evaluation, running locally on `numexpr` (already required by Numpy as well). - NumExpr is a fast numerical array expression evaluator for Python, NumPy, Pandas - NumExpr's `evaluate` method is used for math expression evaluation, doc: https://numexpr.readthedocs.io/en/latest/user_guide.html#usage-notes - supported operators: https://numexpr.readthedocs.io/en/latest/user_guide.html#supported-operators - supported functions: https://numexpr.readthedocs.io/en/latest/user_guide.html#supported-functions The incorrect result on GLM3 without maths tool: ![企业微信截图_1a8f1273-441c-4855-9298-46a46ce7214b](https://github.com/langgenius/dify/assets/1935105/e9d28bc0-75db-49cb-893f-9502826c0c82) The correct result on GLM3 with maths tool: ![企业微信截图_2d6197c8-9c93-4a54-b1ba-a06b22c657f8](https://github.com/langgenius/dify/assets/1935105/7f89c426-ed3f-4f5a-8879-2f7316d32e4b) ![image](https://github.com/langgenius/dify/assets/1935105/281f33bd-d96f-4dc4-8a32-d4943e6a9b79)
yindo added the pull-request label 2026-02-21 20:21:25 -05:00
yindo closed this issue 2026-02-21 20:21:25 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#23610