Skip to content

Python scraper based on AI

Merge branch 'main' into refactoring-parse-html

Marco Perini5735f3ec7f3f
diff --cc scrapegraphai/nodes/generate_answer_node.py
index 63700445,86363c76..134e7fed
--- a/scrapegraphai/nodes/generate_answer_node.py
+++ b/scrapegraphai/nodes/generate_answer_node.py
@@@ -58,10 -62,10 +62,10 @@@ class GenerateAnswerNode(BaseNode)
that the necessary information for generating an answer is missing.
"""
- print("---GENERATE ANSWER---")
+ print("---GENERATING ANSWER---")
try:
user_input = state["user_input"]
- document = state["document"]
+ document = state["document_chunks"]
except KeyError as e:
print(f"Error: {e} not found in state.")
raise
diff --cc scrapegraphai/nodes/parse_html_node.py
index e178800c,106db34d..f145e62e
--- a/scrapegraphai/nodes/parse_html_node.py
+++ b/scrapegraphai/nodes/parse_html_node.py
@@@ -28,13 -27,16 +28,16 @@@ class ParseHTMLNode(BaseNode)
the specified tags, if provided, and updates the state with the parsed content.
"""
- def __init__(self, node_name="ParseHTMLNode"):
+ def __init__(self, node_name: str, node_type: str = "ParseHTMLNode"):
"""
Initializes the ParseHTMLNode with a node name.
+ Args:
+ node_name (str): name of the node
+ node_type (str, optional): type of the node
"""
- super().__init__(node_name, "node")
+ super().__init__(node_name, node_type)
- def execute(self, state):
+ def execute(self, state):
"""
Executes the node's logic to parse the HTML document based on specified tags.
If tags are provided in the state, the document is parsed accordingly; otherwise,