Amna2024's picture
Create config/app_config.py
455db38 verified
raw
history blame contribute delete
598 Bytes
"""
Configuration for API keys and model setup.
"""
import os
import google.generativeai as genai
def setup_api():
"""Setup and configure the Gemini API"""
# Retrieve API keys from environment variables
userdata = {
"GEMINI_API_KEY": os.getenv("GEMINI_API_KEY"),
}
api_key = userdata.get("GEMINI_API_KEY")
if not api_key:
raise ValueError("API key not found. Make sure to set it in environment variables.")
#os.environ["GEMINI_API_KEY"] = api_key
genai.configure(api_key=api_key)
return genai.GenerativeModel("gemini-2.0-flash-exp")