Spaces:
No application file
No application file
Update app.py
Browse files
app.py
CHANGED
|
@@ -11,7 +11,15 @@ class Task(BaseModel):
|
|
| 11 |
|
| 12 |
def make_llm():
|
| 13 |
# LangChain helper; will raise if GOOGLE_API_KEY missing
|
| 14 |
-
return ChatGoogleGenerativeAI(model="gemini-2.0-flash-exp")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
|
| 16 |
@app.post("/run")
|
| 17 |
async def run_task(t: Task):
|
|
|
|
| 11 |
|
| 12 |
def make_llm():
|
| 13 |
# LangChain helper; will raise if GOOGLE_API_KEY missing
|
| 14 |
+
# return ChatGoogleGenerativeAI(model="gemini-2.0-flash-exp")
|
| 15 |
+
|
| 16 |
+
# Allow override from HF Secrets, but fall back to a stable, supported model
|
| 17 |
+
model_id = os.getenv("GEMINI_MODEL", "gemini-2.0-flash")
|
| 18 |
+
return ChatGoogleGenerativeAI(
|
| 19 |
+
model=model_id,
|
| 20 |
+
max_retries=3, # built-in exponential back-off
|
| 21 |
+
temperature=0.2,
|
| 22 |
+
)
|
| 23 |
|
| 24 |
@app.post("/run")
|
| 25 |
async def run_task(t: Task):
|