Skip to content

Commit a3bf169

Browse files
authored
Merge pull request #932 from ScrapeGraphAI/pre/beta
Pre/beta
2 parents 4381df1 + 71053bc commit a3bf169

File tree

5 files changed

+56
-6
lines changed

5 files changed

+56
-6
lines changed

CHANGELOG.md

+19-3
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,30 @@
1-
## [1.39.0](https://github.com/ScrapeGraphAI/Scrapegraph-ai/compare/v1.38.1...v1.39.0) (2025-02-17)
1+
## [1.40.0-beta.1](https://github.com/ScrapeGraphAI/Scrapegraph-ai/compare/v1.39.0...v1.40.0-beta.1) (2025-02-25)
22

33

44
### Features
55

6-
* add the new handling exception ([5c0bc46](https://github.com/ScrapeGraphAI/Scrapegraph-ai/commit/5c0bc46c6322ea07efa31d95819d7da47462f981))
6+
* add refactoring of merge and parse ([2c0b459](https://github.com/ScrapeGraphAI/Scrapegraph-ai/commit/2c0b4591ae4a13a89a73fb29a170adf6e52b3903))
7+
* update parse node ([8cf9685](https://github.com/ScrapeGraphAI/Scrapegraph-ai/commit/8cf96857a000eada6d1c9ce1a357ee3d1f2bd003))
78

89

910
### CI
1011

11-
* **release:** 1.39.0-beta.1 [skip ci] ([9be7dcd](https://github.com/ScrapeGraphAI/Scrapegraph-ai/commit/9be7dcd8d1f5b64e6a6c29c931f0195e04bb4f23))
12+
* **release:** 1.39.0-beta.2 [skip ci] ([ac2fcd6](https://github.com/ScrapeGraphAI/Scrapegraph-ai/commit/ac2fcd66ce2603153877e3141b3ff862a348e335))
13+
14+
## [1.39.0-beta.2](https://github.com/ScrapeGraphAI/Scrapegraph-ai/compare/v1.39.0-beta.1...v1.39.0-beta.2) (2025-02-25)
15+
16+
17+
18+
### Features
19+
20+
* add refactoring of merge and parse ([2c0b459](https://github.com/ScrapeGraphAI/Scrapegraph-ai/commit/2c0b4591ae4a13a89a73fb29a170adf6e52b3903))
21+
22+
23+
24+
### CI
25+
26+
* **release:** 1.38.1 [skip ci] ([5c3d62d](https://github.com/ScrapeGraphAI/Scrapegraph-ai/commit/5c3d62d55b5c6dcbb304b5879a19ca09bc18b153))
27+
1228

1329
## [1.39.0-beta.1](https://github.com/ScrapeGraphAI/Scrapegraph-ai/compare/v1.38.1-beta.1...v1.39.0-beta.1) (2025-02-17)
1430

pyproject.toml

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
[project]
22
name = "scrapegraphai"
33

4-
version = "1.39.0"
4+
version = "1.40.0b1"
5+
56

67

78
description = "A web scraping library based on LangChain which uses LLM and direct graph logic to create scraping pipelines."

scrapegraphai/nodes/generate_answer_node.py

+31
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,37 @@ def invoke_with_timeout(self, chain, inputs, timeout):
8787
self.logger.error(f"Error during chain execution: {str(e)}")
8888
raise
8989

90+
def process(self, state: dict) -> dict:
91+
"""Process the input state and generate an answer."""
92+
user_prompt = state.get("user_prompt")
93+
# Check for content in different possible state keys
94+
content = (
95+
state.get("relevant_chunks")
96+
or state.get("parsed_doc")
97+
or state.get("doc")
98+
or state.get("content")
99+
)
100+
101+
if not content:
102+
raise ValueError("No content found in state to generate answer from")
103+
104+
if not user_prompt:
105+
raise ValueError("No user prompt found in state")
106+
107+
# Create the chain input with both content and question keys
108+
chain_input = {
109+
"content": content,
110+
"question": user_prompt
111+
}
112+
113+
try:
114+
response = self.invoke_with_timeout(self.chain, chain_input, self.timeout)
115+
state.update({self.output[0]: response})
116+
return state
117+
except Exception as e:
118+
self.logger.error(f"Error in GenerateAnswerNode: {str(e)}")
119+
raise
120+
90121
def execute(self, state: dict) -> dict:
91122
"""
92123
Executes the GenerateAnswerNode.

scrapegraphai/nodes/parse_node.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@ def execute(self, state: dict) -> dict:
7878
self.logger.info(f"--- Executing {self.node_name} Node ---")
7979

8080
input_keys = self.get_input_keys(state)
81-
8281
input_data = [state[key] for key in input_keys]
8382
docs_transformed = input_data[0]
8483
source = input_data[1] if self.parse_urls else None
@@ -121,6 +120,9 @@ def execute(self, state: dict) -> dict:
121120
)
122121

123122
state.update({self.output[0]: chunks})
123+
state.update({"parsed_doc": chunks})
124+
state.update({"content": chunks})
125+
124126
if self.parse_urls:
125127
state.update({self.output[1]: link_urls})
126128
state.update({self.output[2]: img_urls})

uv.lock

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)