-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup_api_key.py
More file actions
41 lines (32 loc) · 1.15 KB
/
Copy pathsetup_api_key.py
File metadata and controls
41 lines (32 loc) · 1.15 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
#!/usr/bin/env python3
"""
Setup script to configure the Gemini API key
"""
import os
import sys
def setup_api_key():
"""Setup the Gemini API key"""
api_key = "AIzaSyDuyFkAkIZtYvxZddZ560m9QIuqSp6FocY"
# Set the environment variable for the current session
os.environ["GOOGLE_API_KEY"] = api_key
print("✅ Gemini API key configured successfully!")
print(f"🔑 API Key: {api_key[:10]}...")
# Test the setup
try:
from llm_processor import model
print("✅ Gemini model initialized successfully!")
return True
except Exception as e:
print(f"❌ Error initializing Gemini model: {str(e)}")
return False
if __name__ == "__main__":
print("🔧 Setting up Gemini API Key")
print("=" * 40)
success = setup_api_key()
if success:
print("\n🎉 Setup complete! You can now run the application.")
print("\nTo make this permanent, add this to your shell profile:")
print("export GOOGLE_API_KEY='AIzaSyDuyFkAkIZtYvxZddZ560m9QIuqSp6FocY'")
else:
print("\n💥 Setup failed. Please check the error messages above.")
sys.exit(1)