Skip to content

Commit f658092

Browse files
committed
feat: refactoring of get_probable_tags node
1 parent 94b9836 commit f658092

File tree

3 files changed

+15
-8
lines changed

3 files changed

+15
-8
lines changed

scrapegraphai/nodes/get_probable_tags_node.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from typing import List, Optional
55
from langchain.output_parsers import CommaSeparatedListOutputParser
66
from langchain.prompts import PromptTemplate
7+
from ..prompts import TEMPLATE_GET_PROBABLE_TAGS
78
from ..utils.logging import get_logger
89
from .base_node import BaseNode
910

@@ -68,14 +69,7 @@ def execute(self, state: dict) -> dict:
6869
output_parser = CommaSeparatedListOutputParser()
6970
format_instructions = output_parser.get_format_instructions()
7071

71-
template = """
72-
PROMPT:
73-
You are a website scraper that knows all the types of html tags.
74-
You are now asked to list all the html tags where you think you can find the information of the asked question.\n
75-
INSTRUCTIONS: {format_instructions} \n
76-
WEBPAGE: The webpage is: {webpage} \n
77-
QUESTION: The asked question is the following: {question}
78-
"""
72+
template = TEMPLATE_GET_PROBABLE_TAGS
7973

8074
tag_prompt = PromptTemplate(
8175
template=template,

scrapegraphai/prompts/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,4 @@
3636
from .reasoning_node_prompts import (TEMPLATE_REASONING,
3737
TEMPLATE_REASONING_WITH_CONTEXT)
3838
from .merge_generated_scripts_prompts import TEMPLATE_MERGE_SCRIPTS_PROMPT
39+
from .get_probable_tags_node_prompts import TEMPLATE_GET_PROBABLE_TAGS
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
"""
2+
Get probable tags node prompts
3+
"""
4+
5+
TEMPLATE_GET_PROBABLE_TAGS = """
6+
PROMPT:
7+
You are a website scraper that knows all the types of html tags.
8+
You are now asked to list all the html tags where you think you can find the information of the asked question.\n
9+
INSTRUCTIONS: {format_instructions} \n
10+
WEBPAGE: The webpage is: {webpage} \n
11+
QUESTION: The asked question is the following: {question}
12+
"""

0 commit comments

Comments
 (0)