Skip to content

feat: refactoring of get_probable_tags node #763

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 2 additions & 8 deletions scrapegraphai/nodes/get_probable_tags_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from typing import List, Optional
from langchain.output_parsers import CommaSeparatedListOutputParser
from langchain.prompts import PromptTemplate
from ..prompts import TEMPLATE_GET_PROBABLE_TAGS
from ..utils.logging import get_logger
from .base_node import BaseNode

Expand Down Expand Up @@ -68,14 +69,7 @@ def execute(self, state: dict) -> dict:
output_parser = CommaSeparatedListOutputParser()
format_instructions = output_parser.get_format_instructions()

template = """
PROMPT:
You are a website scraper that knows all the types of html tags.
You are now asked to list all the html tags where you think you can find the information of the asked question.\n
INSTRUCTIONS: {format_instructions} \n
WEBPAGE: The webpage is: {webpage} \n
QUESTION: The asked question is the following: {question}
"""
template = TEMPLATE_GET_PROBABLE_TAGS

tag_prompt = PromptTemplate(
template=template,
Expand Down
1 change: 1 addition & 0 deletions scrapegraphai/prompts/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,4 @@
from .reasoning_node_prompts import (TEMPLATE_REASONING,
TEMPLATE_REASONING_WITH_CONTEXT)
from .merge_generated_scripts_prompts import TEMPLATE_MERGE_SCRIPTS_PROMPT
from .get_probable_tags_node_prompts import TEMPLATE_GET_PROBABLE_TAGS
12 changes: 12 additions & 0 deletions scrapegraphai/prompts/get_probable_tags_node_prompts.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
"""
Get probable tags node prompts
"""

TEMPLATE_GET_PROBABLE_TAGS = """
PROMPT:
You are a website scraper that knows all the types of html tags.
You are now asked to list all the html tags where you think you can find the information of the asked question.\n
INSTRUCTIONS: {format_instructions} \n
WEBPAGE: The webpage is: {webpage} \n
QUESTION: The asked question is the following: {question}
"""
Loading