Spaces:
Runtime error
Runtime error
ddd
Browse files- my_tools.py +7 -6
my_tools.py
CHANGED
|
@@ -64,7 +64,7 @@ class GeminiLLM(LLM):
|
|
| 64 |
|
| 65 |
# --------- Normalización rápida (evita FieldInfo) -----------------
|
| 66 |
if not isinstance(self.model_name, str):
|
| 67 |
-
self.model_name = "models/gemini-1.5-flash-latest"
|
| 68 |
if not isinstance(self.temperature, (float, int)):
|
| 69 |
self.temperature = 0.0
|
| 70 |
# ------------------------------------------------------------------
|
|
@@ -439,13 +439,14 @@ agent = ReActAgent.from_tools(
|
|
| 439 |
|
| 440 |
|
| 441 |
# Helper to strip to the last Observation or fallback
|
| 442 |
-
|
| 443 |
def _extract_observation(raw: str) -> str:
|
|
|
|
| 444 |
if "Observation:" in raw:
|
| 445 |
-
|
| 446 |
-
|
| 447 |
-
|
| 448 |
-
|
|
|
|
| 449 |
return raw.strip()
|
| 450 |
|
| 451 |
|
|
|
|
| 64 |
|
| 65 |
# --------- Normalización rápida (evita FieldInfo) -----------------
|
| 66 |
if not isinstance(self.model_name, str):
|
| 67 |
+
self.model_name = "models/gemini-1.5-pro-latest" #"models/gemini-1.5-flash-latest"
|
| 68 |
if not isinstance(self.temperature, (float, int)):
|
| 69 |
self.temperature = 0.0
|
| 70 |
# ------------------------------------------------------------------
|
|
|
|
| 439 |
|
| 440 |
|
| 441 |
# Helper to strip to the last Observation or fallback
|
|
|
|
| 442 |
def _extract_observation(raw: str) -> str:
|
| 443 |
+
"""Extrae la ÚLTIMA observación de la cadena de pensamiento."""
|
| 444 |
if "Observation:" in raw:
|
| 445 |
+
# rsplit divide desde la derecha, asegurando que tomamos la última
|
| 446 |
+
segment = raw.rsplit("Observation:", 1)[-1]
|
| 447 |
+
if "Final Answer:" in segment:
|
| 448 |
+
segment = segment.split("Final Answer:", 1)[0]
|
| 449 |
+
return segment.strip()
|
| 450 |
return raw.strip()
|
| 451 |
|
| 452 |
|