Spaces:
Sleeping
Sleeping
Create config.py
Browse files
config.py
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# config.py
|
2 |
+
import os
|
3 |
+
import logging
|
4 |
+
|
5 |
+
logging.basicConfig(level=logging.WARNING)
|
6 |
+
logger = logging.getLogger(__name__)
|
7 |
+
|
8 |
+
def clean_api_key(key: str) -> str:
|
9 |
+
return ''.join(c for c in key if ord(c) < 128).strip()
|
10 |
+
|
11 |
+
for key in ["GEMINI_API_KEY", "GROQ_API_KEY"]:
|
12 |
+
if not os.environ.get(key):
|
13 |
+
raise ValueError(f"Environment variable {key} is not set.")
|
14 |
+
|
15 |
+
gemini_api_key = clean_api_key(os.environ["GEMINI_API_KEY"])
|
16 |
+
groq_api_key = clean_api_key(os.environ["GROQ_API_KEY"])
|