From e2350eda6249d8e121344d12c92645a3887a5b76 Mon Sep 17 00:00:00 2001 From: VinciGit00 Date: Sun, 12 May 2024 11:14:30 +0200 Subject: [PATCH] feat: add new prompt info --- scrapegraphai/nodes/generate_answer_csv_node.py | 1 + scrapegraphai/nodes/generate_answer_node.py | 8 +++++--- scrapegraphai/nodes/generate_answer_pdf_node.py | 1 + 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/scrapegraphai/nodes/generate_answer_csv_node.py b/scrapegraphai/nodes/generate_answer_csv_node.py index 7f2a46a5..53f7121b 100644 --- a/scrapegraphai/nodes/generate_answer_csv_node.py +++ b/scrapegraphai/nodes/generate_answer_csv_node.py @@ -111,6 +111,7 @@ def execute(self, state): following content from a csv. You are now asked to answer a user question about the content you have scraped.\n You have scraped many chunks since the csv is big and now you are asked to merge them into a single answer without repetitions (if there are any).\n + Make sure that if a maximum number of items is specified in the instructions that you get that maximum number and do not exceed it. \n Output instructions: {format_instructions}\n User question: {question}\n csv content: {context}\n diff --git a/scrapegraphai/nodes/generate_answer_node.py b/scrapegraphai/nodes/generate_answer_node.py index 90ab704d..f554f8d9 100644 --- a/scrapegraphai/nodes/generate_answer_node.py +++ b/scrapegraphai/nodes/generate_answer_node.py @@ -33,12 +33,13 @@ class GenerateAnswerNode(BaseNode): node_name (str): The unique identifier name for the node, defaulting to "GenerateAnswer". """ - def __init__(self, input: str, output: List[str], node_config: Optional[dict]=None, + def __init__(self, input: str, output: List[str], node_config: Optional[dict] = None, node_name: str = "GenerateAnswer"): super().__init__(node_name, "node", input, output, 2, node_config) - + self.llm_model = node_config["llm_model"] - self.verbose = False if node_config is None else node_config.get("verbose", False) + self.verbose = False if node_config is None else node_config.get( + "verbose", False) def execute(self, state: dict) -> dict: """ @@ -97,6 +98,7 @@ def execute(self, state: dict) -> dict: following content from a website. You are now asked to answer a user question about the content you have scraped.\n You have scraped many chunks since the website is big and now you are asked to merge them into a single answer without repetitions (if there are any).\n + Make sure that if a maximum number of items is specified in the instructions that you get that maximum number and do not exceed it. \n Output instructions: {format_instructions}\n User question: {question}\n Website content: {context}\n diff --git a/scrapegraphai/nodes/generate_answer_pdf_node.py b/scrapegraphai/nodes/generate_answer_pdf_node.py index 2f34ee69..31839d22 100644 --- a/scrapegraphai/nodes/generate_answer_pdf_node.py +++ b/scrapegraphai/nodes/generate_answer_pdf_node.py @@ -111,6 +111,7 @@ def execute(self, state): following content from a PDF. You are now asked to answer a user question about the content you have scraped.\n You have scraped many chunks since the PDF is big and now you are asked to merge them into a single answer without repetitions (if there are any).\n + Make sure that if a maximum number of items is specified in the instructions that you get that maximum number and do not exceed it. \n Output instructions: {format_instructions}\n User question: {question}\n PDF content: {context}\n