Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -65,6 +65,8 @@ class GeminiLLM(LLM):
|
|
| 65 |
# Si el error es por cuota y hay fallback API key definida, intentar con la fallback
|
| 66 |
if response.status_code == 403 and "quota" in response.text.lower():
|
| 67 |
if self.fallback_api_key:
|
|
|
|
|
|
|
| 68 |
response = self._make_request(self.fallback_api_key, prompt)
|
| 69 |
else:
|
| 70 |
return f"Error {response.status_code}: {response.text} (no hay API key alternativa)"
|
|
@@ -512,7 +514,7 @@ class BasicAgent:
|
|
| 512 |
# Reemplazamos todas las invocaciones de tools en la pregunta
|
| 513 |
processed_question = re.sub(pattern, tool_replacer, question)
|
| 514 |
|
| 515 |
-
time.sleep(
|
| 516 |
|
| 517 |
try:
|
| 518 |
response = self.chain.run({"question": processed_question})
|
|
|
|
| 65 |
# Si el error es por cuota y hay fallback API key definida, intentar con la fallback
|
| 66 |
if response.status_code == 403 and "quota" in response.text.lower():
|
| 67 |
if self.fallback_api_key:
|
| 68 |
+
time.sleep(3) # Simula latencia opcional
|
| 69 |
+
|
| 70 |
response = self._make_request(self.fallback_api_key, prompt)
|
| 71 |
else:
|
| 72 |
return f"Error {response.status_code}: {response.text} (no hay API key alternativa)"
|
|
|
|
| 514 |
# Reemplazamos todas las invocaciones de tools en la pregunta
|
| 515 |
processed_question = re.sub(pattern, tool_replacer, question)
|
| 516 |
|
| 517 |
+
time.sleep(3) # Simula latencia opcional
|
| 518 |
|
| 519 |
try:
|
| 520 |
response = self.chain.run({"question": processed_question})
|