Skip to content

Commit 86a4903

Browse files
search_internet_node prompt moved
1 parent f455fcb commit 86a4903

File tree

4 files changed

+18
-12
lines changed

4 files changed

+18
-12
lines changed

scrapegraphai/nodes/search_internet_node.py

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
from ..utils.logging import get_logger
99
from ..utils.research_web import search_on_web
1010
from .base_node import BaseNode
11+
from ..prompts import search_internet_template
1112

1213
class SearchInternetNode(BaseNode):
1314
"""
@@ -73,19 +74,8 @@ def execute(self, state: dict) -> dict:
7374

7475
output_parser = CommaSeparatedListOutputParser()
7576

76-
search_template = """
77-
PROMPT:
78-
You are a search engine and you need to generate a search query based on the user's prompt. \n
79-
Given the following user prompt, return a query that can be
80-
used to search the internet for relevant information. \n
81-
You should return only the query string without any additional sentences. \n
82-
For example, if the user prompt is "What is the capital of France?",
83-
you should return "capital of France". \n
84-
If you return something else, you will get a really bad grade. \n
85-
USER PROMPT: {user_prompt}"""
86-
8777
search_prompt = PromptTemplate(
88-
template=search_template,
78+
template=search_internet_template,
8979
input_variables=["user_prompt"],
9080
)
9181

scrapegraphai/prompts/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@
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

scrapegraphai/prompts/robots_node_prompts.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""
22
Robot node prompts helper
33
"""
4+
45
template_robot = """
56
You are a website scraper and you need to scrape a website.
67
You need to check if the website allows scraping of the provided path. \n
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
"""
2+
Search internet node prompts helper
3+
"""
4+
5+
search_internet_template = """
6+
PROMPT:
7+
You are a search engine and you need to generate a search query based on the user's prompt. \n
8+
Given the following user prompt, return a query that can be
9+
used to search the internet for relevant information. \n
10+
You should return only the query string without any additional sentences. \n
11+
For example, if the user prompt is "What is the capital of France?",
12+
you should return "capital of France". \n
13+
If you return something else, you will get a really bad grade. \n
14+
USER PROMPT: {user_prompt}"""

0 commit comments

Comments
 (0)