MrArray22 commited on
Commit
8d51314
·
verified ·
1 Parent(s): 0575916

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +46 -10
app.py CHANGED
@@ -13,7 +13,7 @@ load_dotenv()
13
  # (Keep Constants as is)
14
  # --- Constants ---
15
  DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
16
- OPENAI_MODEL = "openai/o3-mini" # or "gpt-3.5-turbo" based on your preference
17
 
18
 
19
  # --- Basic Agent Definition ---
@@ -39,18 +39,54 @@ class BasicAgent:
39
  messages=[
40
  {
41
  "role": "developer",
42
- "content": """You are a Expert AI assistant designed to answer questions from the GAIA benchmark dataset.
43
- Follow these guidelines:
44
- 1. Provide clear, concise, and accurate answers
45
- 2. If a question requires specific steps or calculations, show them clearly
46
- 3. Format your response in a clean, readable way
47
- 4. Be precise and avoid ambiguity
48
- 5. If you're not completely sure about an answer, state your confidence level
49
- Remember: Your answers will be evaluated through exact matching.""",
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
50
  },
51
  {"role": "user", "content": prompt},
52
  ],
53
- # temperature=0.5, # Lower temperature for more consistent outputs
54
  # max_tokens=1000,
55
  )
56
  return response.choices[0].message.content.strip()
 
13
  # (Keep Constants as is)
14
  # --- Constants ---
15
  DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
16
+ OPENAI_MODEL = "openai/gpt-4.1" # or "gpt-3.5-turbo" based on your preference
17
 
18
 
19
  # --- Basic Agent Definition ---
 
39
  messages=[
40
  {
41
  "role": "developer",
42
+ "content": """
43
+ You are an expert research assistant that provides precise, accurate answers. Before responding, use this hidden planning phase (which will not be shown to users):
44
+
45
+ ```
46
+ <planning>
47
+ 1. Classify the question type:
48
+ - Arithmetic/mathematical calculation
49
+ - Factual lookup (dates, codes, definitions)
50
+ - Complex knowledge (requires synthesis of multiple facts)
51
+ - Subjective/opinion-based (requires reasoning with caveats)
52
+
53
+ 2. For each type:
54
+ - Arithmetic: Calculate step-by-step to ensure accuracy
55
+ - Factual lookup: Identify the specific data point needed
56
+ - Complex knowledge: Break down into key components and relationships
57
+ - Subjective: Note major perspectives and evidence for each
58
+
59
+ 3. Check for potential ambiguities or misinterpretations
60
+ 4. Formulate the most precise answer possible
61
+ </planning>
62
+ ```
63
+
64
+ ## Response Format
65
+
66
+ After your planning, provide your answer in this format:
67
+
68
+ **Answer:** [Your concise, precise answer]
69
+
70
+ For factual questions, include only the exact information requested - no extra text.
71
+ For complex questions, provide a concise, well-structured response focused on accuracy.
72
+
73
+ ## Examples
74
+
75
+ **Q: What is 493 × 27?**
76
+ <planning>Arithmetic calculation: 493 × 27 = (493 × 20) + (493 × 7) = 9,860 + 3,451 = 13,311</planning>
77
+ **Answer:** 13,311
78
+
79
+ **Q: Which country has the smallest land area in South America?**
80
+ <planning>Factual lookup: South American countries by land area. Smallest is Suriname at 63,251 square miles.</planning>
81
+ **Answer:** Suriname
82
+
83
+ **Q: How does atmospheric carbon dioxide affect ocean acidity?**
84
+ <planning>Complex knowledge question requiring synthesis of chemistry concepts...</planning>
85
+ **Answer:** Atmospheric CO₂ dissolves in seawater forming carbonic acid (H₂CO₃), which releases hydrogen ions and lowers pH. This process, called ocean acidification, has increased ocean acidity by approximately 30% since the Industrial Revolution.""",
86
  },
87
  {"role": "user", "content": prompt},
88
  ],
89
+ temperature=0.5, # Lower temperature for more consistent outputs
90
  # max_tokens=1000,
91
  )
92
  return response.choices[0].message.content.strip()