From 9e5f755fee2f6996b0586db8c687ebdf99d1f531 Mon Sep 17 00:00:00 2001 From: Pavan Kumar <66913595+ascender1729@users.noreply.github.com> Date: Wed, 23 Apr 2025 17:14:38 +0530 Subject: [PATCH] Update agent_prompts.py --- swarms/prompts/agent_prompts.py | 175 +++++++++++++++----------------- 1 file changed, 82 insertions(+), 93 deletions(-) diff --git a/swarms/prompts/agent_prompts.py b/swarms/prompts/agent_prompts.py index 0f1a6b9d..88853b09 100644 --- a/swarms/prompts/agent_prompts.py +++ b/swarms/prompts/agent_prompts.py @@ -1,58 +1,35 @@ -# Agent prompts for MCP testing and interactions - -MATH_AGENT_PROMPT = """ -You are a math calculator assistant. - -When asked for calculations: -1. Determine the operation (add, multiply, or divide) -2. Extract the numbers -3. Return the JSON format of the calculation - -For example: -- For "add 5 and 3", respond with: {"tool_name": "add", "a": 5, "b": 3} -- For "multiply 7 by 4", respond with: {"tool_name": "multiply", "a": 7, "b": 4} -- For "divide 10 by 2", respond with: {"tool_name": "divide", "a": 10, "b": 2} - -When asked about your capabilities, respond with: {"tool_name": "add", "a": 1, "b": 1} -""" -FINANCE_AGENT_PROMPT = """You are a financial analysis agent with access to stock market data services. -Key responsibilities: -1. Interpret financial queries and determine required data -2. Use available stock tools to fetch market data -3. Analyze trends and provide insights -4. Format responses in a clear, professional manner - -Use the available MCP tools to fetch real market data rather than making assumptions.""" - - def generate_agent_role_prompt(agent): """Generates the agent role prompt. Args: agent (str): The type of the agent. Returns: str: The agent role prompt. """ prompts = { - "Finance Agent": - ("You are a seasoned finance analyst AI assistant. Your" - " primary goal is to compose comprehensive, astute," - " impartial, and methodically arranged financial reports" - " based on provided data and trends."), - "Travel Agent": - ("You are a world-travelled AI tour guide assistant. Your" - " main purpose is to draft engaging, insightful," - " unbiased, and well-structured travel reports on given" - " locations, including history, attractions, and cultural" - " insights."), - "Academic Research Agent": - ("You are an AI academic research assistant. Your primary" - " responsibility is to create thorough, academically" - " rigorous, unbiased, and systematically organized" - " reports on a given research topic, following the" - " standards of scholarly work."), - "Default Agent": - ("You are an AI critical thinker research assistant. Your" - " sole purpose is to write well written, critically" - " acclaimed, objective and structured reports on given" - " text."), + "Finance Agent": ( + "You are a seasoned finance analyst AI assistant. Your" + " primary goal is to compose comprehensive, astute," + " impartial, and methodically arranged financial reports" + " based on provided data and trends." + ), + "Travel Agent": ( + "You are a world-travelled AI tour guide assistant. Your" + " main purpose is to draft engaging, insightful," + " unbiased, and well-structured travel reports on given" + " locations, including history, attractions, and cultural" + " insights." + ), + "Academic Research Agent": ( + "You are an AI academic research assistant. Your primary" + " responsibility is to create thorough, academically" + " rigorous, unbiased, and systematically organized" + " reports on a given research topic, following the" + " standards of scholarly work." + ), + "Default Agent": ( + "You are an AI critical thinker research assistant. Your" + " sole purpose is to write well written, critically" + " acclaimed, objective and structured reports on given" + " text." + ), } return prompts.get(agent, "No such agent") @@ -65,14 +42,16 @@ def generate_report_prompt(question, research_summary): Returns: str: The report prompt for the given question and research summary """ - return (f'"""{research_summary}""" Using the above information,' - f' answer the following question or topic: "{question}" in a' - " detailed report -- The report should focus on the answer" - " to the question, should be well structured, informative," - " in depth, with facts and numbers if available, a minimum" - " of 1,200 words and with markdown syntax and apa format." - " Write all source urls at the end of the report in apa" - " format") + return ( + f'"""{research_summary}""" Using the above information,' + f' answer the following question or topic: "{question}" in a' + " detailed report -- The report should focus on the answer" + " to the question, should be well structured, informative," + " in depth, with facts and numbers if available, a minimum" + " of 1,200 words and with markdown syntax and apa format." + " Write all source urls at the end of the report in apa" + " format" + ) def generate_search_queries_prompt(question): @@ -81,10 +60,12 @@ def generate_search_queries_prompt(question): Returns: str: The search queries prompt for the given question """ - return ("Write 4 google search queries to search online that form an" - f' objective opinion from the following: "{question}"You must' - " respond with a list of strings in the following format:" - ' ["query 1", "query 2", "query 3", "query 4"]') + return ( + "Write 4 google search queries to search online that form an" + f' objective opinion from the following: "{question}"You must' + " respond with a list of strings in the following format:" + ' ["query 1", "query 2", "query 3", "query 4"]' + ) def generate_resource_report_prompt(question, research_summary): @@ -97,17 +78,19 @@ def generate_resource_report_prompt(question, research_summary): Returns: str: The resource report prompt for the given question and research summary. """ - return (f'"""{research_summary}""" Based on the above information,' - " generate a bibliography recommendation report for the" - f' following question or topic: "{question}". The report' - " should provide a detailed analysis of each recommended" - " resource, explaining how each source can contribute to" - " finding answers to the research question. Focus on the" - " relevance, reliability, and significance of each source." - " Ensure that the report is well-structured, informative," - " in-depth, and follows Markdown syntax. Include relevant" - " facts, figures, and numbers whenever available. The report" - " should have a minimum length of 1,200 words.") + return ( + f'"""{research_summary}""" Based on the above information,' + " generate a bibliography recommendation report for the" + f' following question or topic: "{question}". The report' + " should provide a detailed analysis of each recommended" + " resource, explaining how each source can contribute to" + " finding answers to the research question. Focus on the" + " relevance, reliability, and significance of each source." + " Ensure that the report is well-structured, informative," + " in-depth, and follows Markdown syntax. Include relevant" + " facts, figures, and numbers whenever available. The report" + " should have a minimum length of 1,200 words." + ) def generate_outline_report_prompt(question, research_summary): @@ -117,15 +100,17 @@ def generate_outline_report_prompt(question, research_summary): Returns: str: The outline report prompt for the given question and research summary """ - return (f'"""{research_summary}""" Using the above information,' - " generate an outline for a research report in Markdown" - f' syntax for the following question or topic: "{question}".' - " The outline should provide a well-structured framework for" - " the research report, including the main sections," - " subsections, and key points to be covered. The research" - " report should be detailed, informative, in-depth, and a" - " minimum of 1,200 words. Use appropriate Markdown syntax to" - " format the outline and ensure readability.") + return ( + f'"""{research_summary}""" Using the above information,' + " generate an outline for a research report in Markdown" + f' syntax for the following question or topic: "{question}".' + " The outline should provide a well-structured framework for" + " the research report, including the main sections," + " subsections, and key points to be covered. The research" + " report should be detailed, informative, in-depth, and a" + " minimum of 1,200 words. Use appropriate Markdown syntax to" + " format the outline and ensure readability." + ) def generate_concepts_prompt(question, research_summary): @@ -135,13 +120,15 @@ def generate_concepts_prompt(question, research_summary): Returns: str: The concepts prompt for the given question """ - return (f'"""{research_summary}""" Using the above information,' - " generate a list of 5 main concepts to learn for a research" - f' report on the following question or topic: "{question}".' - " The outline should provide a well-structured frameworkYou" - " must respond with a list of strings in the following" - ' format: ["concepts 1", "concepts 2", "concepts 3",' - ' "concepts 4, concepts 5"]') + return ( + f'"""{research_summary}""" Using the above information,' + " generate a list of 5 main concepts to learn for a research" + f' report on the following question or topic: "{question}".' + " The outline should provide a well-structured frameworkYou" + " must respond with a list of strings in the following" + ' format: ["concepts 1", "concepts 2", "concepts 3",' + ' "concepts 4, concepts 5"]' + ) def generate_lesson_prompt(concept): @@ -153,11 +140,13 @@ def generate_lesson_prompt(concept): str: The lesson prompt for the given concept. """ - prompt = (f"generate a comprehensive lesson about {concept} in Markdown" - f" syntax. This should include the definitionof {concept}," - " its historical background and development, its" - " applications or uses in differentfields, and notable" - f" events or facts related to {concept}.") + prompt = ( + f"generate a comprehensive lesson about {concept} in Markdown" + f" syntax. This should include the definitionof {concept}," + " its historical background and development, its" + " applications or uses in differentfields, and notable" + f" events or facts related to {concept}." + ) return prompt