Skip to content

Commit ef96652

Browse files
search_link_node prompt moved
1 parent 86a4903 commit ef96652

File tree

3 files changed

+30
-24
lines changed

3 files changed

+30
-24
lines changed

scrapegraphai/nodes/search_link_node.py

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
from langchain_core.runnables import RunnableParallel
1111
from ..utils.logging import get_logger
1212
from .base_node import BaseNode
13+
from ..prompts import prompt_relevant_links
1314

1415

1516
class SearchLinkNode(BaseNode):
@@ -83,29 +84,6 @@ def execute(self, state: dict) -> dict:
8384
except Exception as e:
8485
# Fallback approach: Using the LLM to extract links
8586
self.logger.error(f"Error extracting links: {e}. Falling back to LLM.")
86-
prompt_relevant_links = """
87-
You are a website scraper and you have just scraped the following content from a website.
88-
Content: {content}
89-
90-
Assume relevance broadly, including any links that might be related or potentially useful
91-
in relation to the task.
92-
93-
Sort it in order of importance, the first one should be the most important one, the last one
94-
the least important
95-
96-
Please list only valid URLs and make sure to err on the side of inclusion if it's uncertain
97-
whether the content at the link is directly relevant.
98-
99-
Output only a list of relevant links in the format:
100-
[
101-
"link1",
102-
"link2",
103-
"link3",
104-
.
105-
.
106-
.
107-
]
108-
"""
10987

11088
merge_prompt = PromptTemplate(
11189
template=prompt_relevant_links,

scrapegraphai/prompts/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,5 @@
88
from .generate_answer_node_omni_prompts import template_chunks_omni, template_no_chunk_omni, template_merge_omni
99
from .merge_answer_node_prompts import template_combined
1010
from .robots_node_prompts import template_robot
11-
from .search_internet_node_prompts import search_internet_template
11+
from .search_internet_node_prompts import search_internet_template
12+
from .search_link_node_prompts import prompt_relevant_links
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
"""
2+
Search link node prompts helper
3+
"""
4+
5+
prompt_relevant_links = """
6+
You are a website scraper and you have just scraped the following content from a website.
7+
Content: {content}
8+
9+
Assume relevance broadly, including any links that might be related or potentially useful
10+
in relation to the task.
11+
12+
Sort it in order of importance, the first one should be the most important one, the last one
13+
the least important
14+
15+
Please list only valid URLs and make sure to err on the side of inclusion if it's uncertain
16+
whether the content at the link is directly relevant.
17+
18+
Output only a list of relevant links in the format:
19+
[
20+
"link1",
21+
"link2",
22+
"link3",
23+
.
24+
.
25+
.
26+
]
27+
"""

0 commit comments

Comments
 (0)