Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -355,8 +355,24 @@ Return JSON format:
|
|
| 355 |
}}
|
| 356 |
""".strip()
|
| 357 |
|
| 358 |
-
|
| 359 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 360 |
|
| 361 |
def step_c_build_verified_facts(plan: Dict[str, Any], verification: Dict[str, Any]) -> Dict[str, Any]:
|
| 362 |
vmap = {v["id"]: v for v in verification.get("verifications", [])}
|
|
|
|
| 355 |
}}
|
| 356 |
""".strip()
|
| 357 |
|
| 358 |
+
prompt = system_rules + "\n\n" + user
|
| 359 |
+
|
| 360 |
+
out = gemini_generate(prompt, temperature=0.1)
|
| 361 |
+
try:
|
| 362 |
+
return safe_json_extract(out)
|
| 363 |
+
except Exception:
|
| 364 |
+
# Retry 1: extra streng, plus "ONLY JSON" reminder
|
| 365 |
+
repair = f"""
|
| 366 |
+
You MUST output ONLY valid JSON. No explanations. No markdown. No extra text.
|
| 367 |
+
If you previously added any text outside JSON, remove it.
|
| 368 |
+
|
| 369 |
+
Return the JSON again now.
|
| 370 |
+
|
| 371 |
+
PREVIOUS_OUTPUT:
|
| 372 |
+
{out}
|
| 373 |
+
""".strip()
|
| 374 |
+
out2 = gemini_generate(prompt + "\n\n" + repair, temperature=0.0)
|
| 375 |
+
return safe_json_extract(out2)
|
| 376 |
|
| 377 |
def step_c_build_verified_facts(plan: Dict[str, Any], verification: Dict[str, Any]) -> Dict[str, Any]:
|
| 378 |
vmap = {v["id"]: v for v in verification.get("verifications", [])}
|