-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdebug.py
More file actions
52 lines (44 loc) · 1.55 KB
/
Copy pathdebug.py
File metadata and controls
52 lines (44 loc) · 1.55 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
import os
from dotenv import load_dotenv
import google.generativeai as genai
from agents import run_pipeline
# 1. Check Environment
print("--- DIAGNOSTIC START ---")
load_dotenv()
key = os.getenv("GOOGLE_API_KEY")
if not key:
print("❌ CRITICAL: GOOGLE_API_KEY is missing from environment.")
print(" Please create a .env file with your key.")
exit()
else:
print(f"✅ API Key found: {key[:5]}...{key[-3:]}")
# 2. Test Connection (Simple Ping)
print("\n--- TESTING GEMINI CONNECTION ---")
try:
genai.configure(api_key=key)
# Using the exact model from your previous successful list
model = genai.GenerativeModel('gemini-2.0-flash')
response = model.generate_content("Say 'Hello' if you can hear me.")
print(f"✅ Gemini Responded: {response.text.strip()}")
except Exception as e:
print(f"❌ Connection Failed: {e}")
exit()
# 3. Test Full Pipeline
print("\n--- TESTING AGENT PIPELINE ---")
test_problem = "Solve x + 5 = 10"
print(f"Input: {test_problem}")
try:
result = run_pipeline(test_problem)
print("\n✅ RAW RESULT FROM PIPELINE:")
print(result)
status = result.get("status")
print(f"\nStatus Key: {status}")
if status not in ["SUCCESS", "HITL"]:
print("❌ ERROR: Status key is missing or invalid! This is why Streamlit shows nothing.")
else:
print("✅ Pipeline logic is valid. If this works, the issue is in app.py.")
except Exception as e:
print(f"\n❌ PIPELINE CRASHED: {e}")
import traceback
traceback.print_exc()
print("\n--- DIAGNOSTIC END ---")