Spaces:
Runtime error
Runtime error
Omachoko
commited on
Commit
Β·
57ebe39
1
Parent(s):
c7cc357
π§Ή Clean up: Remove diagnostic test file
Browse files- Removed test_agent.py (temporary diagnostic script)
- Repository now contains only production-ready GAIA system files
β
All speech recognition updates successfully deployed
- test_agent.py +0 -140
test_agent.py
DELETED
@@ -1,140 +0,0 @@
|
|
1 |
-
#!/usr/bin/env python3
|
2 |
-
"""
|
3 |
-
π GAIA Agent Diagnostic Test
|
4 |
-
Quick test to diagnose why the agent isn't answering questions
|
5 |
-
"""
|
6 |
-
|
7 |
-
import os
|
8 |
-
import sys
|
9 |
-
from gaia_system import BasicAgent, EnhancedMultiModelGAIASystem
|
10 |
-
|
11 |
-
def test_basic_agent():
|
12 |
-
"""Test the BasicAgent with simple questions"""
|
13 |
-
print("π§ͺ Testing BasicAgent...")
|
14 |
-
|
15 |
-
try:
|
16 |
-
# Initialize agent
|
17 |
-
agent = BasicAgent()
|
18 |
-
print("β
Agent initialized successfully")
|
19 |
-
|
20 |
-
# Test simple questions
|
21 |
-
test_questions = [
|
22 |
-
"What is 2 + 2?",
|
23 |
-
"What is the capital of France?",
|
24 |
-
"How many days are in a week?",
|
25 |
-
"What color is the sky?"
|
26 |
-
]
|
27 |
-
|
28 |
-
for i, question in enumerate(test_questions, 1):
|
29 |
-
print(f"\nπ Test {i}: {question}")
|
30 |
-
try:
|
31 |
-
response = agent(question)
|
32 |
-
print(f"π€ Response: '{response}'")
|
33 |
-
print(f"π Length: {len(response)} characters")
|
34 |
-
|
35 |
-
if not response or response.strip() == "":
|
36 |
-
print("β Empty response!")
|
37 |
-
elif "Unable to" in response or "Error" in response:
|
38 |
-
print("β οΈ Error response detected")
|
39 |
-
else:
|
40 |
-
print("β
Got non-empty response")
|
41 |
-
|
42 |
-
except Exception as e:
|
43 |
-
print(f"β Error: {e}")
|
44 |
-
|
45 |
-
except Exception as e:
|
46 |
-
print(f"β Failed to initialize agent: {e}")
|
47 |
-
return False
|
48 |
-
|
49 |
-
return True
|
50 |
-
|
51 |
-
def test_enhanced_system():
|
52 |
-
"""Test the EnhancedMultiModelGAIASystem directly"""
|
53 |
-
print("\nπ§ͺ Testing EnhancedMultiModelGAIASystem...")
|
54 |
-
|
55 |
-
try:
|
56 |
-
# Test with HF token if available
|
57 |
-
hf_token = os.getenv('HF_TOKEN')
|
58 |
-
if hf_token:
|
59 |
-
print(f"β
Found HF_TOKEN: {hf_token[:10]}...")
|
60 |
-
else:
|
61 |
-
print("β οΈ No HF_TOKEN found - using fallback mode")
|
62 |
-
|
63 |
-
system = EnhancedMultiModelGAIASystem(hf_token=hf_token)
|
64 |
-
print("β
Enhanced system initialized")
|
65 |
-
|
66 |
-
# Test simple query
|
67 |
-
question = "What is 5 + 3?"
|
68 |
-
print(f"\nπ Testing: {question}")
|
69 |
-
|
70 |
-
response = system.query_with_tools(question)
|
71 |
-
print(f"π€ Raw response: '{response}'")
|
72 |
-
|
73 |
-
# Test fallback
|
74 |
-
fallback = system._fallback_response(question)
|
75 |
-
print(f"π‘οΈ Fallback response: '{fallback}'")
|
76 |
-
|
77 |
-
# Test answer extraction
|
78 |
-
if response:
|
79 |
-
extracted = system._extract_final_answer(response)
|
80 |
-
print(f"β¨ Extracted answer: '{extracted}'")
|
81 |
-
|
82 |
-
return True
|
83 |
-
|
84 |
-
except Exception as e:
|
85 |
-
print(f"β Enhanced system error: {e}")
|
86 |
-
import traceback
|
87 |
-
traceback.print_exc()
|
88 |
-
return False
|
89 |
-
|
90 |
-
def test_model_availability():
|
91 |
-
"""Test which AI models are available"""
|
92 |
-
print("\nπ Testing model availability...")
|
93 |
-
|
94 |
-
try:
|
95 |
-
system = EnhancedMultiModelGAIASystem()
|
96 |
-
|
97 |
-
print(f"π Available models: {len(system.clients)}")
|
98 |
-
for name, client_info in system.clients.items():
|
99 |
-
provider = client_info.get('provider', 'Unknown')
|
100 |
-
priority = client_info.get('priority', 999)
|
101 |
-
print(f" - {name} (Priority: {priority}, Provider: {provider})")
|
102 |
-
|
103 |
-
if system.model_priority:
|
104 |
-
print(f"π― Top priority model: {system.model_priority[0]}")
|
105 |
-
else:
|
106 |
-
print("β No models in priority list!")
|
107 |
-
|
108 |
-
return True
|
109 |
-
|
110 |
-
except Exception as e:
|
111 |
-
print(f"β Model availability error: {e}")
|
112 |
-
return False
|
113 |
-
|
114 |
-
def main():
|
115 |
-
"""Run all diagnostic tests"""
|
116 |
-
print("π GAIA Agent Diagnostic Tests\n")
|
117 |
-
|
118 |
-
# Test basic functionality
|
119 |
-
test1 = test_basic_agent()
|
120 |
-
test2 = test_enhanced_system()
|
121 |
-
test3 = test_model_availability()
|
122 |
-
|
123 |
-
print("\nπ Test Summary:")
|
124 |
-
print(f" BasicAgent: {'β
PASS' if test1 else 'β FAIL'}")
|
125 |
-
print(f" Enhanced System: {'β
PASS' if test2 else 'β FAIL'}")
|
126 |
-
print(f" Model Availability: {'β
PASS' if test3 else 'β FAIL'}")
|
127 |
-
|
128 |
-
if not any([test1, test2, test3]):
|
129 |
-
print("\nβ All tests failed! Check dependencies and configuration.")
|
130 |
-
return False
|
131 |
-
elif not test1:
|
132 |
-
print("\nβ οΈ BasicAgent failed - this is the issue for GAIA submissions!")
|
133 |
-
return False
|
134 |
-
else:
|
135 |
-
print("\nβ
Core functionality working - issue might be elsewhere")
|
136 |
-
return True
|
137 |
-
|
138 |
-
if __name__ == "__main__":
|
139 |
-
success = main()
|
140 |
-
sys.exit(0 if success else 1)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|