-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcheck_models.py
More file actions
30 lines (24 loc) · 910 Bytes
/
Copy pathcheck_models.py
File metadata and controls
30 lines (24 loc) · 910 Bytes
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
import google.generativeai as genai
from dotenv import load_dotenv
import os
# Load Environment Variables
load_dotenv()
api_key = os.getenv("GOOGLE_API_KEY")
if not api_key:
print("❌ Error: GOOGLE_API_KEY not found in .env file!")
else:
print(f"✅ Key Found: {api_key[:5]}********")
try:
genai.configure(api_key=api_key)
print("\n🔎 Searching for available models...")
print("-----------------------------------")
# List all models
found = False
for m in genai.list_models():
if 'generateContent' in m.supported_generation_methods:
print(f"✅ Available: {m.name}")
found = True
if not found:
print("⚠️ No content generation models found. Check your API Key permissions.")
except Exception as e:
print(f"❌ Connection Error: {e}")