Update app.py
Browse files
app.py
CHANGED
|
@@ -38,7 +38,7 @@ class GeminiReActAgent:
|
|
| 38 |
raise ValueError("GEMINI_API_KEY not set")
|
| 39 |
|
| 40 |
# Direct REST API endpoint for Gemini 2.5 Flash
|
| 41 |
-
self.url = f"https://generativelanguage.googleapis.com/v1beta/models/gemini-
|
| 42 |
print("Vanilla ReAct Gemini Agent initialized with rate-limit handling.")
|
| 43 |
|
| 44 |
def call_gemini(self, history) -> str:
|
|
@@ -57,7 +57,7 @@ class GeminiReActAgent:
|
|
| 57 |
try:
|
| 58 |
# ENFORCED TIME PACING: Wait 15 seconds to stay under the 5 Requests Per Minute limit.
|
| 59 |
print(" -> Pacing API: Sleeping for 15 seconds to respect 5 RPM limit...")
|
| 60 |
-
time.sleep(
|
| 61 |
|
| 62 |
response = requests.post(self.url, json=payload, timeout=20)
|
| 63 |
|
|
|
|
| 38 |
raise ValueError("GEMINI_API_KEY not set")
|
| 39 |
|
| 40 |
# Direct REST API endpoint for Gemini 2.5 Flash
|
| 41 |
+
self.url = f"https://generativelanguage.googleapis.com/v1beta/models/gemini-1.5-flash:generateContent?key={self.api_key}"
|
| 42 |
print("Vanilla ReAct Gemini Agent initialized with rate-limit handling.")
|
| 43 |
|
| 44 |
def call_gemini(self, history) -> str:
|
|
|
|
| 57 |
try:
|
| 58 |
# ENFORCED TIME PACING: Wait 15 seconds to stay under the 5 Requests Per Minute limit.
|
| 59 |
print(" -> Pacing API: Sleeping for 15 seconds to respect 5 RPM limit...")
|
| 60 |
+
time.sleep(5)
|
| 61 |
|
| 62 |
response = requests.post(self.url, json=payload, timeout=20)
|
| 63 |
|