File size: 3,855 Bytes
2b75e39 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 | """
System prompts and templates for GAIA agent
"""
# Main system prompt for GAIA agent
GAIA_SYSTEM_PROMPT = """You are an AI assistant designed to answer questions for the GAIA benchmark.
CRITICAL INSTRUCTIONS FOR GAIA FORMAT:
1. Your final answer must be EXACT and CONCISE
2. Do NOT include explanations, units, or additional text
3. For yes/no questions: answer only with lowercase "yes" or "no"
4. For numerical answers: provide only the number (no units)
5. For names: provide the exact name without titles
6. For lists: use comma-separation with no spaces after commas
You have access to tools for:
- Mathematical calculations
- Web searching
- Wikipedia lookups
- Date/time operations
Think step-by-step through the problem, use tools as needed, then provide your final answer.
ALWAYS end your response with your final answer in this format:
[ANSWER]your_exact_answer[/ANSWER]
"""
# Question routing prompt
ROUTING_PROMPT = """Analyze this question and determine what type it is:
Question: {question}
Categories:
1. MATH - Mathematical calculation needed
2. FACTUAL - Simple fact that can be looked up
3. TEMPORAL - Date/time related question
4. COMPARISON - Comparing two or more things
5. MULTI_STEP - Requires multiple steps and reasoning
6. YES_NO - Simple yes/no question
Respond with only the category name."""
# Tool selection prompt
TOOL_SELECTION_PROMPT = """Given this question, what tools would be most helpful?
Question: {question}
Available tools:
- calculator: For mathematical calculations
- web_search: For searching current information
- wikipedia: For encyclopedic knowledge
- datetime: For date and time operations
List the tools needed (comma-separated, no spaces)."""
# Answer extraction prompt
ANSWER_EXTRACTION_PROMPT = """Extract only the final answer from this response:
{response}
Remember:
- Numbers: no units
- Yes/No: lowercase only
- Names: no titles
- Lists: comma-separated, no spaces after commas
Final answer:"""
# Chain of thought prompt
CHAIN_OF_THOUGHT_PROMPT = """Let's solve this step-by-step.
Question: {question}
Break down the problem:
1. What information do we need?
2. What tools should we use?
3. What's the logical sequence of steps?
Work through each step carefully."""
# Math problem prompt
MATH_PROMPT = """Solve this mathematical problem:
{question}
Show your calculation step by step, then provide the final numerical answer.
Remember: provide ONLY the number as your final answer, no units."""
# Factual lookup prompt
FACTUAL_PROMPT = """Answer this factual question:
{question}
Search for accurate, current information and provide the exact answer."""
# Temporal problem prompt
TEMPORAL_PROMPT = """Answer this date/time related question:
{question}
Use date calculations as needed. For yes/no questions about dates, answer with lowercase yes/no."""
# Comparison prompt
COMPARISON_PROMPT = """Compare and answer:
{question}
Research the relevant information, make the comparison, and provide the answer."""
# Multi-step reasoning prompt
MULTI_STEP_PROMPT = """This question requires multiple steps:
{question}
Work through each step:
1. Identify all sub-questions
2. Gather necessary information
3. Synthesize the final answer
Remember to be exact and concise in your final answer."""
# Error recovery prompt
ERROR_RECOVERY_PROMPT = """The previous attempt failed. Let's try a different approach:
Question: {question}
Previous error: {error}
Try alternative methods or tools to find the answer."""
# Validation prompt
VALIDATION_PROMPT = """Validate this answer for GAIA format compliance:
Question: {question}
Answer: {answer}
Check:
1. Is it exact and concise?
2. Are there any units or explanations that should be removed?
3. Is yes/no in lowercase?
4. Are lists properly formatted?
If the answer needs correction, provide the corrected version.""" |