mirror of
https://github.com/VinciGit00/Scrapegraph-ai.git
synced 2026-07-01 21:00:48 +08:00
feat: refactoring of get_probable_tags node
This commit is contained in:
parent
94b9836ef6
commit
f658092dff
@ -4,6 +4,7 @@ GetProbableTagsNode Module
|
|||||||
from typing import List, Optional
|
from typing import List, Optional
|
||||||
from langchain.output_parsers import CommaSeparatedListOutputParser
|
from langchain.output_parsers import CommaSeparatedListOutputParser
|
||||||
from langchain.prompts import PromptTemplate
|
from langchain.prompts import PromptTemplate
|
||||||
|
from ..prompts import TEMPLATE_GET_PROBABLE_TAGS
|
||||||
from ..utils.logging import get_logger
|
from ..utils.logging import get_logger
|
||||||
from .base_node import BaseNode
|
from .base_node import BaseNode
|
||||||
|
|
||||||
@ -68,14 +69,7 @@ class GetProbableTagsNode(BaseNode):
|
|||||||
output_parser = CommaSeparatedListOutputParser()
|
output_parser = CommaSeparatedListOutputParser()
|
||||||
format_instructions = output_parser.get_format_instructions()
|
format_instructions = output_parser.get_format_instructions()
|
||||||
|
|
||||||
template = """
|
template = 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}
|
|
||||||
"""
|
|
||||||
|
|
||||||
tag_prompt = PromptTemplate(
|
tag_prompt = PromptTemplate(
|
||||||
template=template,
|
template=template,
|
||||||
|
|||||||
@ -36,3 +36,4 @@ from .generate_code_node_prompts import (TEMPLATE_INIT_CODE_GENERATION,
|
|||||||
from .reasoning_node_prompts import (TEMPLATE_REASONING,
|
from .reasoning_node_prompts import (TEMPLATE_REASONING,
|
||||||
TEMPLATE_REASONING_WITH_CONTEXT)
|
TEMPLATE_REASONING_WITH_CONTEXT)
|
||||||
from .merge_generated_scripts_prompts import TEMPLATE_MERGE_SCRIPTS_PROMPT
|
from .merge_generated_scripts_prompts import TEMPLATE_MERGE_SCRIPTS_PROMPT
|
||||||
|
from .get_probable_tags_node_prompts import TEMPLATE_GET_PROBABLE_TAGS
|
||||||
|
|||||||
12
scrapegraphai/prompts/get_probable_tags_node_prompts.py
Normal file
12
scrapegraphai/prompts/get_probable_tags_node_prompts.py
Normal file
@ -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…
Reference in New Issue
Block a user