Mendu9 commited on
Commit ·
ff18be4
1
Parent(s): 2b28619
fix: lazy-import numexpr, add numexpr+sqlalchemy to HF requirements
Browse files- mao/agents/tool_agent.py +1 -1
- requirements.txt +2 -0
mao/agents/tool_agent.py
CHANGED
|
@@ -7,7 +7,6 @@ import logging
|
|
| 7 |
import re
|
| 8 |
from typing import Any
|
| 9 |
|
| 10 |
-
import numexpr
|
| 11 |
import requests
|
| 12 |
from mao.core import llm as groq_llm
|
| 13 |
import wikipediaapi
|
|
@@ -155,6 +154,7 @@ def _calculator(expression: str) -> str:
|
|
| 155 |
try:
|
| 156 |
# Strip any markdown code fences
|
| 157 |
clean_expr = re.sub(r"```.*?```", "", expression, flags=re.DOTALL).strip()
|
|
|
|
| 158 |
result = numexpr.evaluate(clean_expr)
|
| 159 |
return str(float(result))
|
| 160 |
except Exception as exc: # noqa: BLE001
|
|
|
|
| 7 |
import re
|
| 8 |
from typing import Any
|
| 9 |
|
|
|
|
| 10 |
import requests
|
| 11 |
from mao.core import llm as groq_llm
|
| 12 |
import wikipediaapi
|
|
|
|
| 154 |
try:
|
| 155 |
# Strip any markdown code fences
|
| 156 |
clean_expr = re.sub(r"```.*?```", "", expression, flags=re.DOTALL).strip()
|
| 157 |
+
import numexpr
|
| 158 |
result = numexpr.evaluate(clean_expr)
|
| 159 |
return str(float(result))
|
| 160 |
except Exception as exc: # noqa: BLE001
|
requirements.txt
CHANGED
|
@@ -44,6 +44,8 @@ pydantic>=2.7.0,<3.0.0
|
|
| 44 |
# --- Tools ---
|
| 45 |
duckduckgo-search>=6.1.0
|
| 46 |
wikipedia-api>=0.6.0
|
|
|
|
|
|
|
| 47 |
|
| 48 |
# --- Config / HTTP ---
|
| 49 |
redis>=4.0.0
|
|
|
|
| 44 |
# --- Tools ---
|
| 45 |
duckduckgo-search>=6.1.0
|
| 46 |
wikipedia-api>=0.6.0
|
| 47 |
+
numexpr>=2.10.0
|
| 48 |
+
sqlalchemy>=2.0,<3.0
|
| 49 |
|
| 50 |
# --- Config / HTTP ---
|
| 51 |
redis>=4.0.0
|