-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcheck_models.py
More file actions
36 lines (30 loc) · 1.26 KB
/
Copy pathcheck_models.py
File metadata and controls
36 lines (30 loc) · 1.26 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
import google.generativeai as genai
# Configure Gemini with your API key
GEMINI_API_KEY = "AIzaSyDvUYaiJzsH3CgYMogcS6BY3kPVzyV69hI"
if not GEMINI_API_KEY:
print("Error: GEMINI_API_KEY not set.")
else:
genai.configure(api_key=GEMINI_API_KEY)
print("=" * 70)
print("Available Gemini Models:")
print("=" * 70)
try:
for m in genai.list_models():
# Filter for models that can generate content (text generation)
if 'generateContent' in m.supported_generation_methods:
print(f"\n✓ {m.name}")
print(f" Description: {m.description}")
print(f" Version: {m.version}")
print(f" Methods: {', '.join(m.supported_generation_methods)}")
else:
print(f"\n- {m.name}")
print(f" Description: {m.description}")
print(f" Methods: {', '.join(m.supported_generation_methods)}")
print("\n" + "=" * 70)
print("Models with ✓ can be used for your chat feature.")
print("=" * 70)
except Exception as e:
print(f"\nAn error occurred while listing models: {e}")
print("Please check your API key and internet connection.")
import traceback
traceback.print_exc()