search_internet_node prompt moved

This commit is contained in:
Matteo Vedovati 2024-08-11 11:31:51 +02:00
parent f455fcbc5f
commit 86a4903e99
4 changed files with 18 additions and 12 deletions

View File

@ -8,6 +8,7 @@ from langchain_community.chat_models import ChatOllama
from ..utils.logging import get_logger
from ..utils.research_web import search_on_web
from .base_node import BaseNode
from ..prompts import search_internet_template
class SearchInternetNode(BaseNode):
"""
@ -73,19 +74,8 @@ class SearchInternetNode(BaseNode):
output_parser = CommaSeparatedListOutputParser()
search_template = """
PROMPT:
You are a search engine and you need to generate a search query based on the user's prompt. \n
Given the following user prompt, return a query that can be
used to search the internet for relevant information. \n
You should return only the query string without any additional sentences. \n
For example, if the user prompt is "What is the capital of France?",
you should return "capital of France". \n
If you return something else, you will get a really bad grade. \n
USER PROMPT: {user_prompt}"""
search_prompt = PromptTemplate(
template=search_template,
template=search_internet_template,
input_variables=["user_prompt"],
)

View File

@ -8,3 +8,4 @@ from .generate_answer_node_pdf_prompts import template_chunks_pdf, template_no_c
from .generate_answer_node_omni_prompts import template_chunks_omni, template_no_chunk_omni, template_merge_omni
from .merge_answer_node_prompts import template_combined
from .robots_node_prompts import template_robot
from .search_internet_node_prompts import search_internet_template

View File

@ -1,6 +1,7 @@
"""
Robot node prompts helper
"""
template_robot = """
You are a website scraper and you need to scrape a website.
You need to check if the website allows scraping of the provided path. \n

View File

@ -0,0 +1,14 @@
"""
Search internet node prompts helper
"""
search_internet_template = """
PROMPT:
You are a search engine and you need to generate a search query based on the user's prompt. \n
Given the following user prompt, return a query that can be
used to search the internet for relevant information. \n
You should return only the query string without any additional sentences. \n
For example, if the user prompt is "What is the capital of France?",
you should return "capital of France". \n
If you return something else, you will get a really bad grade. \n
USER PROMPT: {user_prompt}"""