Python scraper based on AI
Python ai-crawlerai-scrapingai-searchcrawlerdata-extractionfirecrawl-alternativelarge-language-modelllmmarkdownragscrapingscraping-pythonweb-crawlerweb-crawlersweb-dataweb-data-extractionweb-scraperweb-scrapingweb-searchwebscraping
search_link_node prompt moved
Matteo Vedovatief966525c3b1
diff --git a/scrapegraphai/nodes/search_link_node.py b/scrapegraphai/nodes/search_link_node.pyindex 6fbe51dd..180a7ba1 100644--- a/scrapegraphai/nodes/search_link_node.py+++ b/scrapegraphai/nodes/search_link_node.py@@ -10,6 +10,7 @@ from langchain_core.output_parsers import JsonOutputParserfrom langchain_core.runnables import RunnableParallelfrom ..utils.logging import get_loggerfrom .base_node import BaseNode+from ..prompts import prompt_relevant_linksclass SearchLinkNode(BaseNode):@@ -83,29 +84,6 @@ class SearchLinkNode(BaseNode):except Exception as e:# Fallback approach: Using the LLM to extract linksself.logger.error(f"Error extracting links: {e}. Falling back to LLM.")- prompt_relevant_links = """- You are a website scraper and you have just scraped the following content from a website.- Content: {content}-- Assume relevance broadly, including any links that might be related or potentially useful- in relation to the task.-- Sort it in order of importance, the first one should be the most important one, the last one- the least important-- Please list only valid URLs and make sure to err on the side of inclusion if it's uncertain- whether the content at the link is directly relevant.-- Output only a list of relevant links in the format:- [- "link1",- "link2",- "link3",- .- .- .- ]- """merge_prompt = PromptTemplate(template=prompt_relevant_links,diff --git a/scrapegraphai/prompts/__init__.py b/scrapegraphai/prompts/__init__.pyindex 2b32431a..b4d22985 100644--- a/scrapegraphai/prompts/__init__.py+++ b/scrapegraphai/prompts/__init__.py@@ -8,4 +8,5 @@ from .generate_answer_node_pdf_prompts import template_chunks_pdf, template_no_cfrom .generate_answer_node_omni_prompts import template_chunks_omni, template_no_chunk_omni, template_merge_omnifrom .merge_answer_node_prompts import template_combinedfrom .robots_node_prompts import template_robot-from .search_internet_node_prompts import search_internet_template\ No newline at end of file+from .search_internet_node_prompts import search_internet_template+from .search_link_node_prompts import prompt_relevant_links\ No newline at end of filediff --git a/scrapegraphai/prompts/search_link_node_prompts.py b/scrapegraphai/prompts/search_link_node_prompts.pynew file mode 100644index 00000000..d3bc4553--- /dev/null+++ b/scrapegraphai/prompts/search_link_node_prompts.py@@ -0,0 +1,27 @@+"""+Search link node prompts helper+"""++prompt_relevant_links = """+ You are a website scraper and you have just scraped the following content from a website.+ Content: {content}++ Assume relevance broadly, including any links that might be related or potentially useful+ in relation to the task.++ Sort it in order of importance, the first one should be the most important one, the last one+ the least important++ Please list only valid URLs and make sure to err on the side of inclusion if it's uncertain+ whether the content at the link is directly relevant.++ Output only a list of relevant links in the format:+ [+ "link1",+ "link2",+ "link3",+ .+ .+ .+ ]+ """\ No newline at end of file