-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_comprehensive_google_stack.py
More file actions
293 lines (249 loc) Β· 11.7 KB
/
Copy pathtest_comprehensive_google_stack.py
File metadata and controls
293 lines (249 loc) Β· 11.7 KB
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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
#!/usr/bin/env python3
"""
Comprehensive Google Tech Stack Test
Tests all Google services integration
"""
import os
import sys
from dotenv import load_dotenv
import time
# Load environment variables
load_dotenv()
# Add src to path
sys.path.append('src')
def test_google_services_integration():
"""Test comprehensive Google services integration"""
print("π COMPREHENSIVE GOOGLE TECH STACK TEST")
print("=" * 60)
try:
from src.utils.google_services import google_services
# Get status of all services
status = google_services.get_status()
print("π Google Services Status:")
print(f" Google Generative AI (Gemini): {'β
WORKING' if status['gemini'] else 'β NOT AVAILABLE'}")
print(f" Vertex AI: {'β
WORKING' if status['vertex_ai'] else 'β NOT AVAILABLE'}")
print(f" Firebase: {'β
WORKING' if status['firebase'] else 'β NOT AVAILABLE'}")
print(f" Google Cloud Storage: {'β
WORKING' if status['storage'] else 'β NOT AVAILABLE'}")
print()
# Test each service
test_results = {}
# Test 1: Google Generative AI (Gemini)
if status['gemini']:
print("π§ͺ Testing Google Generative AI (Gemini)...")
try:
test_prompt = "What is 2+2? Answer in one word."
response = google_services.analyze_with_gemini(test_prompt)
print(f"β
Gemini Response: {response}")
test_results['gemini'] = True
except Exception as e:
print(f"β Gemini test failed: {str(e)}")
test_results['gemini'] = False
else:
print("β οΈ Gemini not available - check GOOGLE_API_KEY")
test_results['gemini'] = False
# Test 2: Vertex AI
if status['vertex_ai']:
print("\nπ§ͺ Testing Vertex AI...")
try:
test_prompt = "Analyze this startup: TechFlow Solutions, AI-powered workflow automation. Provide investment recommendation."
response = google_services.analyze_with_vertex_ai(test_prompt)
print(f"β
Vertex AI Response: {response[:200]}...")
test_results['vertex_ai'] = True
except Exception as e:
print(f"β Vertex AI test failed: {str(e)}")
test_results['vertex_ai'] = False
else:
print("β οΈ Vertex AI not available - check service account and APIs")
test_results['vertex_ai'] = False
# Test 3: Firebase
if status['firebase']:
print("\nπ§ͺ Testing Firebase...")
try:
# Test storing data
test_data = {
"test": True,
"timestamp": time.time(),
"message": "Firebase test data"
}
success = google_services.store_analysis_result("test_startup", test_data, "test_user")
if success:
print("β
Firebase storage test passed")
test_results['firebase'] = True
else:
print("β Firebase storage test failed")
test_results['firebase'] = False
except Exception as e:
print(f"β Firebase test failed: {str(e)}")
test_results['firebase'] = False
else:
print("β οΈ Firebase not available - check service account and Firestore setup")
test_results['firebase'] = False
# Test 4: Google Cloud Storage
if status['storage']:
print("\nπ§ͺ Testing Google Cloud Storage...")
try:
# Test file upload
test_data = b"Test file content for Google Cloud Storage"
public_url = google_services.upload_file(test_data, "test_file.txt")
print(f"β
Cloud Storage test passed: {public_url}")
test_results['storage'] = True
except Exception as e:
print(f"β Cloud Storage test failed: {str(e)}")
test_results['storage'] = False
else:
print("β οΈ Cloud Storage not available - check service account and bucket setup")
test_results['storage'] = False
# Summary
print("\nπ COMPREHENSIVE TEST RESULTS:")
print("=" * 40)
working_services = sum(test_results.values())
total_services = len(test_results)
for service, status in test_results.items():
print(f" {service.upper()}: {'β
WORKING' if status else 'β NEEDS SETUP'}")
print(f"\nπ― Overall Status: {working_services}/{total_services} services working")
if working_services >= 2:
print("β
SUFFICIENT FOR HACKATHON DEMO!")
print(" You have enough Google services working to impress judges")
elif working_services >= 1:
print("β οΈ PARTIAL SETUP - Can demo basic features")
print(" Consider setting up additional services for full impact")
else:
print("β NEEDS SETUP - No Google services working")
print(" Please follow the setup guide to configure services")
return test_results
except Exception as e:
print(f"β Test failed: {str(e)}")
return {}
def test_startup_analysis():
"""Test complete startup analysis workflow"""
print("\nπ TESTING COMPLETE STARTUP ANALYSIS WORKFLOW")
print("=" * 60)
try:
from src.utils.google_services import google_services
from src.models.startup import StartupInput
# Create test startup
test_startup = StartupInput(
company_name="TestAI Solutions",
business_description="AI-powered test automation platform for software development teams. Reduces testing time by 80% and improves code quality.",
industry="DevTools",
stage="Series A",
founder_name="Jane Smith",
founder_background="Former Google engineer with 10 years in test automation. PhD in Computer Science from MIT."
)
print(f"π Analyzing: {test_startup.company_name}")
print(f"Business: {test_startup.business_description}")
print()
# Choose AI service
if google_services.vertex_ai_initialized:
print("π€ Using Vertex AI for analysis...")
ai_service = "Vertex AI"
prompt = f"""
As an expert startup investment analyst using Google's Vertex AI, analyze this startup:
COMPANY: {test_startup.company_name}
BUSINESS: {test_startup.business_description}
INDUSTRY: {test_startup.industry}
STAGE: {test_startup.stage}
FOUNDER: {test_startup.founder_name}
FOUNDER BACKGROUND: {test_startup.founder_background}
Provide a comprehensive investment analysis including:
1. Market Analysis
2. Business Model Assessment
3. Risk Assessment
4. Investment Recommendation (INVEST/PASS/WATCH)
5. Key Investment Thesis
6. Due Diligence Priorities
Be specific and actionable.
"""
try:
analysis = google_services.analyze_with_vertex_ai(prompt)
print("β
Vertex AI analysis completed")
except Exception as e:
print(f"β Vertex AI analysis failed: {str(e)}")
return False
elif google_services.gemini_initialized:
print("π€ Using Google Generative AI (Gemini) for analysis...")
ai_service = "Google Generative AI (Gemini)"
prompt = f"""
As an expert startup investment analyst using Google's Gemini AI, analyze this startup:
COMPANY: {test_startup.company_name}
BUSINESS: {test_startup.business_description}
INDUSTRY: {test_startup.industry}
STAGE: {test_startup.stage}
FOUNDER: {test_startup.founder_name}
Provide a comprehensive investment analysis with clear recommendations.
"""
try:
analysis = google_services.analyze_with_gemini(prompt)
print("β
Gemini analysis completed")
except Exception as e:
print(f"β Gemini analysis failed: {str(e)}")
return False
else:
print("β No AI services available")
return False
# Store results in Firebase if available
if google_services.firebase_initialized:
print("πΎ Storing results in Firebase...")
try:
google_services.store_analysis_result("test_startup", {
"analysis": analysis,
"ai_service": ai_service,
"startup_data": test_startup.dict()
}, "test_user")
print("β
Results stored in Firebase")
except Exception as e:
print(f"β οΈ Firebase storage failed: {str(e)}")
# Display analysis
print(f"\nπ {ai_service} ANALYSIS RESULTS:")
print("=" * 50)
print(analysis[:500] + "..." if len(analysis) > 500 else analysis)
print(f"\nπ COMPLETE WORKFLOW TEST SUCCESSFUL!")
print(f" AI Service: {ai_service}")
print(f" Firebase: {'β
Connected' if google_services.firebase_initialized else 'β Not available'}")
print(f" Storage: {'β
Connected' if google_services.storage_initialized else 'β Not available'}")
return True
except Exception as e:
print(f"β Workflow test failed: {str(e)}")
return False
def main():
"""Run comprehensive tests"""
print("π― HACKATHON READINESS TEST - GOOGLE TECH STACK")
print("=" * 60)
print("This test verifies your prototype is ready for hackathon judges!")
print()
# Test 1: Google Services Integration
test_results = test_google_services_integration()
# Test 2: Complete Workflow
if any(test_results.values()):
workflow_success = test_startup_analysis()
else:
print("\nβ οΈ Skipping workflow test - no Google services available")
workflow_success = False
# Final assessment
print("\nπ HACKATHON READINESS ASSESSMENT")
print("=" * 50)
working_services = sum(test_results.values())
total_services = len(test_results)
if working_services >= 3 and workflow_success:
print("π EXCELLENT! Ready for hackathon!")
print(" β
Multiple Google services working")
print(" β
Complete workflow functional")
print(" β
Judges will be impressed")
elif working_services >= 2 and workflow_success:
print("β
GOOD! Ready for hackathon demo!")
print(" β
Core Google services working")
print(" β
Basic workflow functional")
print(" β
Sufficient for judges")
elif working_services >= 1:
print("β οΈ PARTIAL - Can demo basic features")
print(" β οΈ Limited Google services")
print(" β οΈ Consider setting up more services")
else:
print("β NEEDS WORK - Not ready for hackathon")
print(" β No Google services working")
print(" β Please follow setup guide")
print(f"\nπ Final Score: {working_services}/{total_services} services + {'β
' if workflow_success else 'β'} workflow")
return working_services >= 2 and workflow_success
if __name__ == "__main__":
success = main()
sys.exit(0 if success else 1)