File tree Expand file tree Collapse file tree 3 files changed +30
-24
lines changed Expand file tree Collapse file tree 3 files changed +30
-24
lines changed Original file line number Diff line number Diff line change 1010from langchain_core .runnables import RunnableParallel
1111from ..utils .logging import get_logger
1212from .base_node import BaseNode
13+ from ..prompts import prompt_relevant_links
1314
1415
1516class 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 ,
Original file line number Diff line number Diff line change 88from .generate_answer_node_omni_prompts import template_chunks_omni , template_no_chunk_omni , template_merge_omni
99from .merge_answer_node_prompts import template_combined
1010from .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
Original file line number Diff line number Diff line change 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+ """
You can’t perform that action at this time.
0 commit comments