Spaces:
Sleeping
Sleeping
Arghya Ghosh commited on
feat(backend): Add configuration file for GEMINI API integration
Browse files- core/config.py +14 -0
core/config.py
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# app/core/config.py
|
| 2 |
+
import os
|
| 3 |
+
from dotenv import load_dotenv
|
| 4 |
+
import google.generativeai as genai
|
| 5 |
+
|
| 6 |
+
load_dotenv()
|
| 7 |
+
|
| 8 |
+
GEMINI_API_KEY = os.getenv("GEMINI_API_KEY")
|
| 9 |
+
|
| 10 |
+
if GEMINI_API_KEY:
|
| 11 |
+
genai.configure(api_key=GEMINI_API_KEY) # type: ignore
|
| 12 |
+
GEMINI_MODEL = genai.GenerativeModel("gemini-2.5-flash") # type: ignore
|
| 13 |
+
else:
|
| 14 |
+
raise ValueError("Missing GEMINI_API_KEY in .env file")
|