-
Notifications
You must be signed in to change notification settings - Fork 2k
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
Docstring for class and type hitting for variables not working it rise InterpretError
Code to reproduce the error
execution_test_parser = """
class Parser:
"""
A class to parse e-commerce product pages and extract structured data.
"""
def __init__(self):
self.data = {}
self.soup = None
def parse(self, html_content: str) -> Dict[str, Any]:
return {}
# Testing the parser
parser = Parser()
parsed_product = parser.parse(html_text_content)
"""
from smolagents import LocalPythonExecutor
executor = LocalPythonExecutor(additional_authorized_imports=["json", "os", "urllib.parse", "bs4", "pprint", "posixpath", "typing", 'html'])
executor.send_variables({"html_text_content": text_content}) # send the HTML content to the executor
executor.send_tools({})
executor(execution_test_parser)
Error logs (if any)
InterpreterError: Code execution failed at line 'class Parser:
"""
A class to parse e-commerce product pages and extract structured data.
"""
def __init__(self):
self.data = {}
self.soup = None
def parse(self, html_content: str) -> Dict[str, Any]:
return {}' due to: InterpreterError: Unsupported statement in class body: Expr
Packages version:
smolagents==1.12.0
Additional context
also not supported variables type hitting:
def __init__(self):
self.data: Dict[str, Any] = {}
it will rise InterpreterError: AnnAssign is not supported.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working