Update app.py
Browse files
app.py
CHANGED
|
@@ -1,35 +1,6 @@
|
|
| 1 |
import os
|
| 2 |
import re
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
class BasicAgent:
|
| 6 |
-
|
| 7 |
-
def __init__(self):
|
| 8 |
-
api_key = os.getenv("GEMINI_API_KEY")
|
| 9 |
-
if not api_key:
|
| 10 |
-
raise ValueError("Missing GEMINI_API_KEY")
|
| 11 |
-
|
| 12 |
-
genai.configure(api_key=api_key)
|
| 13 |
-
|
| 14 |
-
# ✅ stable model
|
| 15 |
-
self.model = genai.GenerativeModel("gemini-1.5-flash")
|
| 16 |
-
|
| 17 |
-
print("✅ Gemini Agent Ready")
|
| 18 |
-
|
| 19 |
-
def clean(self, text: str) -> str:
|
| 20 |
-
if not text:
|
| 21 |
-
return "N/A"
|
| 22 |
-
|
| 23 |
-
text = text.strip()
|
| 24 |
-
text = text.replace("Final Answer:", "").strip()
|
| 25 |
-
text = re.sub(r"\n.*", "", text) # first line only
|
| 26 |
-
text = text.strip()
|
| 27 |
-
|
| 28 |
-
return text[:100]
|
| 29 |
-
|
| 30 |
-
import os
|
| 31 |
-
import re
|
| 32 |
-
import google.generativeai as genai
|
| 33 |
|
| 34 |
class BasicAgent:
|
| 35 |
|
|
|
|
| 1 |
import os
|
| 2 |
import re
|
| 3 |
+
from google import genai
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
|
| 5 |
class BasicAgent:
|
| 6 |
|