You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've wrapped smolagents.CodeAgent in a FastAPI app and noticed that when running the generated code with imports, thousands of INFO-level logs are produced by LocalPythonInterpreter, such as:
2025-02-15 19:16:23,417 - INFO - Skipping dangerous attribute pandas.io.formats.printing.Any
2025-02-15 19:16:23,418 - INFO - Skipping dangerous attribute pandas.io.formats.printing.Callable
Lastly, I’m curious about how dangerous_patterns are applied at any levels. As seen in the logs, modules like pandas.io.formats.printing.Any are being excluded simply because their path contains 'io', even though they don’t actually use the io library.
Would it be possible to modify the logic to check only the top-level module against dangerous_patterns, rather than filtering based on any part of the path?
The text was updated successfully, but these errors were encountered:
I would say that precisely logging these messages as INFO instead of DEBUG allows users to notice that the handling of dangerous_patterns could be definitely improved in this case... 😅
I agree current implementation to exclude dangerous patterns is too simplistic. Any idea how to improve it for this case? CC: @aymeric-roucher
pandas.io.formats.printing.Any
Related corresponding PR, where we excluded io also in non-root package levels:
Logs issue
I've wrapped smolagents.CodeAgent in a FastAPI app and noticed that when running the generated code with imports, thousands of INFO-level logs are produced by LocalPythonInterpreter, such as:
Full log from single run in the attached app.log.
Would it be possible to adjust the logger level for these messages to DEBUG? This would help reduce log clutter during regular FastAPI execution.
Here's minimal example:
Run it locally
Additional question
Lastly, I’m curious about how
dangerous_patterns
are applied at any levels. As seen in the logs, modules likepandas.io.formats.printing.Any
are being excluded simply because their path contains 'io', even though they don’t actually use the io library.Would it be possible to modify the logic to check only the top-level module against dangerous_patterns, rather than filtering based on any part of the path?
The text was updated successfully, but these errors were encountered: