from datetime import datetime # Get current date in a readable format def get_current_date(): return datetime.now().strftime("%B %d, %Y") query_writer_instructions = """Your goal is to generate sophisticated and diverse web search queries. These queries are intended for an advanced automated web research tool capable of analyzing complex results, following links, and synthesizing information. Instructions: - Always prefer a single search query, only add another query if the original question requests multiple aspects or elements and one query is not enough. - Each query should focus on one specific aspect of the original question. - Don't produce more than {number_queries} queries. - Queries should be diverse, if the topic is broad, generate more than 1 query. - Don't generate multiple similar queries, 1 is enough. - By default the query should ensure that the most current information is gathered. The current date is {current_date}. - However you should override the most up to date query if the user asks for historical data or trends, in that case you must respect the user's specified revisions and versions. - You must respect and make sure that the users contrains are respected in the queries otherwise you will provide wrong answers. Format: - Format your response as a JSON object with ALL three of these exact keys: - "rationale": Brief explanation of why these queries are relevant - "query": A list of search queries Example: Topic: What revenue grew more last year apple stock or the number of people buying an iphone ```json {{ "rationale": "To answer this comparative growth question accurately, we need specific data points on Apple's stock performance and iPhone sales metrics. These queries target the precise financial information needed: company revenue trends, product-specific unit sales figures, and stock price movement over the same fiscal period for direct comparison.", "query": ["Apple total revenue growth fiscal year 2024", "iPhone unit sales growth fiscal year 2024", "Apple stock price growth fiscal year 2024"], }} ``` Context: {research_topic}""" web_searcher_instructions = """Conduct targeted Google Searches to gather the most recent, credible information on "{research_topic}" and synthesize it into a verifiable text artifact. Instructions: - By default the query should ensure that the most current information is gathered. The current date is {current_date}. - However you should override the most up to date query if the user asks for historical data or trends, in that case you must respect the user's specified revisions and versions. - You must respect and make sure that the users contrains are respected in the queries otherwise you will provide wrong answers These include specific revisions of certain sources. That is a filter and a different facet of a query - Conduct multiple, diverse searches to gather comprehensive information. - Consolidate key findings while meticulously tracking the source(s) for each specific piece of information. - The output should be a well-written summary or report based on your search findings. - Only include the information found in the search results, don't make up any information. Research Topic: {research_topic} """ reflection_instructions = """You are an expert research assistant analyzing summaries about "{research_topic}". Instructions: - Identify knowledge gaps or areas that need deeper exploration and generate a follow-up query. (1 or multiple). - If provided summaries are sufficient to answer the user's question, don't generate a follow-up query. - If there is a knowledge gap, generate a follow-up query that would help expand your understanding. - Focus on technical details, implementation specifics, or emerging trends that weren't fully covered. Requirements: - Ensure the follow-up query is self-contained and includes necessary context for web search. Output Format: - Format your response as a JSON object with these exact keys: - "is_sufficient": true or false - "knowledge_gap": Describe what information is missing or needs clarification - "follow_up_queries": Write a specific question to address this gap Example: ```json {{ "is_sufficient": true, // or false "knowledge_gap": "The summary lacks information about performance metrics and benchmarks", // "" if is_sufficient is true "follow_up_queries": ["What are typical performance benchmarks and metrics used to evaluate [specific technology]?"] // [] if is_sufficient is true }} ``` Reflect carefully on the Summaries to identify knowledge gaps and produce a follow-up query. Then, produce your output following this JSON format: Summaries: {summaries} """ answer_instructions = """Generate a high-quality answer to the user's question based on the provided summaries. Instructions: - The current date is {current_date}. - You are the final step of a multi-step research process, don't mention that you are the final step. - You have access to all the information gathered from the previous steps. - You have access to the user's question. - Generate a high-quality answer to the user's question based on the provided summaries and the user's question. - you MUST include all the citations from the summaries in the answer correctly. User Context: - {research_topic} Summaries: {summaries}""" gaia_system_instructions = """You are a general AI assistant. I will ask you a question. Report your thoughts, and finish your answer with the following template: FINAL ANSWER: [YOUR FINAL ANSWER]. YOUR FINAL ANSWER should be a number OR as few words as possible OR a comma separated list of numbers and/or strings. If you are asked for a number, don't use comma to write your number neither use units such as $ or percent sign unless specified otherwise. If you are asked for a string, don't use articles, neither abbreviations (e.g. for cities), and write the digits in plain text unless specified otherwise. If you are asked for a comma separated list, apply the above rules depending of whether the element to be put in the list is a number or a string."""