Skip to content

Commit 930f673

Browse files
committed
feat: removed rag node
1 parent 6d1d91a commit 930f673

File tree

3 files changed

+7
-18
lines changed

3 files changed

+7
-18
lines changed

scrapegraphai/graphs/pdf_scraper_graph.py

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
12
"""
23
PDFScraperGraph Module
34
"""
@@ -9,7 +10,6 @@
910

1011
from ..nodes import (
1112
FetchNode,
12-
RAGNode,
1313
GenerateAnswerPDFNode
1414
)
1515

@@ -63,14 +63,7 @@ def _create_graph(self) -> BaseGraph:
6363
input='pdf | pdf_dir',
6464
output=["doc"],
6565
)
66-
rag_node = RAGNode(
67-
input="user_prompt & doc",
68-
output=["relevant_chunks"],
69-
node_config={
70-
"llm_model": self.llm_model,
71-
"embedder_model": self.embedder_model
72-
}
73-
)
66+
7467
generate_answer_node_pdf = GenerateAnswerPDFNode(
7568
input="user_prompt & (relevant_chunks | doc)",
7669
output=["answer"],
@@ -83,12 +76,10 @@ def _create_graph(self) -> BaseGraph:
8376
return BaseGraph(
8477
nodes=[
8578
fetch_node,
86-
rag_node,
8779
generate_answer_node_pdf,
8880
],
8981
edges=[
90-
(fetch_node, rag_node),
91-
(rag_node, generate_answer_node_pdf)
82+
(fetch_node, generate_answer_node_pdf)
9283
],
9384
entry_point=fetch_node
9485
)
@@ -104,4 +95,4 @@ def run(self) -> str:
10495
inputs = {"user_prompt": self.prompt, self.input_key: self.source}
10596
self.final_state, self.execution_info = self.graph.execute(inputs)
10697

107-
return self.final_state.get("answer", "No answer found.")
98+
return self.final_state.get("answer", "No answer found.")

scrapegraphai/graphs/smart_scraper_graph.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,4 +117,4 @@ def run(self) -> str:
117117
inputs = {"user_prompt": self.prompt, self.input_key: self.source}
118118
self.final_state, self.execution_info = self.graph.execute(inputs)
119119

120-
return self.final_state.get("answer", "No answer found.")
120+
return self.final_state.get("answer", "No answer found.")

scrapegraphai/nodes/generate_answer_pdf_node.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,7 @@ def execute(self, state):
9595
output_parser = JsonOutputParser()
9696
format_instructions = output_parser.get_format_instructions()
9797

98-
9998
chains_dict = {}
100-
10199
# Use tqdm to add progress bar
102100
for i, chunk in enumerate(
103101
tqdm(doc, desc="Processing chunks", disable=not self.verbose)
@@ -107,7 +105,7 @@ def execute(self, state):
107105
template=template_no_chunks_pdf,
108106
input_variables=["question"],
109107
partial_variables={
110-
"context": chunk.page_content,
108+
"context":chunk,
111109
"format_instructions": format_instructions,
112110
},
113111
)
@@ -116,7 +114,7 @@ def execute(self, state):
116114
template=template_chunks_pdf,
117115
input_variables=["question"],
118116
partial_variables={
119-
"context": chunk.page_content,
117+
"context":chunk,
120118
"chunk_id": i + 1,
121119
"format_instructions": format_instructions,
122120
},

0 commit comments

Comments
 (0)