File size: 481 Bytes
b5475f0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# config.py
import os
import logging

logging.basicConfig(level=logging.WARNING)
logger = logging.getLogger(__name__)

def clean_api_key(key: str) -> str:
    return ''.join(c for c in key if ord(c) < 128).strip()

for key in ["GEMINI_API_KEY", "GROQ_API_KEY"]:
    if not os.environ.get(key):
        raise ValueError(f"Environment variable {key} is not set.")

gemini_api_key = clean_api_key(os.environ["GEMINI_API_KEY"])
groq_api_key = clean_api_key(os.environ["GROQ_API_KEY"])