-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcheck_setup.py
61 lines (55 loc) · 1.34 KB
/
check_setup.py
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
53
54
55
56
57
58
59
60
61
import importlib
import os
dependencies = [
'requests',
'PIL',
'openai',
'tqdm',
'json',
'googlemaps',
'time',
'typing',
'math',
'collections',
're',
'argparse',
'tempfile',
'anthropic',
'base64',
'google.generativeai',
'io',
'mistralai',
]
api_keys = [
'OPENAI_API_KEY',
'GOOGLE_API_KEY',
'ANTHROPIC_API_KEY',
'MISTRAL_API_KEY'
]
def check_dependencies(dependencies):
missing_dependencies = []
for dependency in dependencies:
try:
importlib.import_module(dependency)
except ImportError:
missing_dependencies.append(dependency)
return missing_dependencies
def check_api_keys(api_keys):
missing_keys = []
for key in api_keys:
if not os.environ.get(key):
missing_keys.append(key)
return missing_keys
if __name__ == "__main__":
print("Checking dependencies...")
missing_dependencies = check_dependencies(dependencies)
if missing_dependencies:
print(f"Missing dependencies: {', '.join(missing_dependencies)}")
else:
print("All dependencies are installed.")
print("\nChecking API keys...")
missing_keys = check_api_keys(api_keys)
if missing_keys:
print(f"Missing API keys: {', '.join(missing_keys)}")
else:
print("All API keys are set.")