-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdiagnose_genai.py
More file actions
24 lines (22 loc) · 845 Bytes
/
diagnose_genai.py
File metadata and controls
24 lines (22 loc) · 845 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
import os, sys, json
sys.path.insert(0, r'd:\Python\Projects\Test\Gemini\ImageGen')
out = {}
try:
from google import genai
out['genai_version'] = getattr(genai, '__version__', 'unknown')
except Exception as e:
out['genai_import_error'] = repr(e)
try:
client = genai.Client(api_key=os.environ.get('GEMINI_API_KEY'))
out['client_dir'] = [n for n in dir(client) if not n.startswith('_')]
try:
out['client_models_dir'] = [n for n in dir(client.models) if not n.startswith('_')]
except Exception as e:
out['client_models_error'] = repr(e)
try:
out['client_chats_dir'] = [n for n in dir(client.chats) if not n.startswith('_')]
except Exception as e:
out['client_chats_error'] = repr(e)
except Exception as e:
out['client_init_error'] = repr(e)
print(json.dumps(out, indent=2))