LamiaYT commited on
Commit
9a40f14
Β·
1 Parent(s): fad4996

Optimiztation

Browse files
Files changed (1) hide show
  1. app.py +12 -3
app.py CHANGED
@@ -30,6 +30,16 @@ except ImportError:
30
  # --- Constants ---
31
  DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
32
 
 
 
 
 
 
 
 
 
 
 
33
  class CPUOptimizedGAIAAgent:
34
  def __init__(self):
35
  print("πŸš€ Initializing CPU-Optimized GAIA Agent...")
@@ -113,9 +123,7 @@ class CPUOptimizedGAIAAgent:
113
  "repetition_penalty": 1.15,
114
  "pad_token_id": self.tokenizer.eos_token_id,
115
  "num_beams": 1, # Disable beam search for speed
116
- },
117
- # Optimized system message for GAIA reasoning
118
-
119
  )
120
 
121
  def setup_enhanced_tools(self):
@@ -339,6 +347,7 @@ class CPUOptimizedGAIAAgent:
339
  llm=self.llm,
340
  verbose=True,
341
  max_iterations=4, # Balance between capability and speed
 
342
  )
343
  print("βœ… Enhanced ReAct Agent created successfully")
344
  except Exception as e:
 
30
  # --- Constants ---
31
  DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
32
 
33
+ # Enhanced system prompt for GAIA reasoning
34
+ GAIA_SYSTEM_PROMPT = """You are an expert problem-solver. For each question:
35
+
36
+ 1. ANALYZE the question type (factual, mathematical, reasoning)
37
+ 2. CHOOSE the right tool (web_search for facts, math_calculator for numbers, fact_checker for verification)
38
+ 3. REASON step-by-step with the tool results
39
+ 4. PROVIDE a clear, specific answer
40
+
41
+ Use tools actively - don't guess when you can search or calculate!"""
42
+
43
  class CPUOptimizedGAIAAgent:
44
  def __init__(self):
45
  print("πŸš€ Initializing CPU-Optimized GAIA Agent...")
 
123
  "repetition_penalty": 1.15,
124
  "pad_token_id": self.tokenizer.eos_token_id,
125
  "num_beams": 1, # Disable beam search for speed
126
+ }
 
 
127
  )
128
 
129
  def setup_enhanced_tools(self):
 
347
  llm=self.llm,
348
  verbose=True,
349
  max_iterations=4, # Balance between capability and speed
350
+ context=GAIA_SYSTEM_PROMPT # Inject system prompt here
351
  )
352
  print("βœ… Enhanced ReAct Agent created successfully")
353
  except Exception as e: