-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig.py
More file actions
24 lines (21 loc) · 826 Bytes
/
config.py
File metadata and controls
24 lines (21 loc) · 826 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
"""Configuration and environment setup."""
import os
import getpass
from dotenv import load_dotenv
# Load environment variables
try:
load_dotenv()
except ImportError:
print("python-dotenv not installed. To use .env files, run: pip install python-dotenv")
def setup_api_keys():
"""Set up required API keys."""
# Google API key
if not os.environ.get("GOOGLE_API_KEY"):
api_key = os.getenv("GOOGLE_API_KEY")
if not api_key:
api_key = getpass.getpass("Enter API key for Google Gemini: ")
os.environ["GOOGLE_API_KEY"] = api_key
# SerpAPI key validation
if not os.getenv("SERPAPI_API_KEY"):
print("Warning: SERPAPI_API_KEY not found in environment variables.")
print("Please set SERPAPI_API_KEY in your .env file for web search functionality.")