Spaces:
Running on Zero
Running on Zero
Update app.py
Browse files214 unmodified lines2152162172182182192202202212222232487 unmodified lines27112712271327142715271627172715271627182719272027182721272227232724395 unmodified lines3120312131223120312331243125312669 unmodified lines31963197319831963199320032013202214 unmodified lines cleaned = re.sub(r"\s+", " ", unescape(plain_text)).strip() if not cleaned: return "Empty text response." if len(cleaned) <= 24000: if len(cleaned) <= 45000: return cleaned return cleaned[:12000] + "\n...\n" + cleaned[-12000:] return cleaned[:45000] + "\n...[truncated]..." except Exception as e: return f"Error fetching URL '{url}': {str(e)}"
2487 unmodified lines f"Write ONLY valid, executable Python code inside {code_open_tag}...{code_close_tag} at every step. " "In intermediate steps, always call print(...) on tool outputs (e.g., `res = search_wikipedia(...); print(res)`) " "so you can read the result in the next step—never end a step with a bare assignment without print(...). " "NEVER pass raw webpage text, paragraphs, or full tool outputs into `final_answer(...)`. " "Always parse/extract the specific answer in Python (using regex, string search, or reasoning in the next step) " "before calling `final_answer(exact_value)`. " "When you have the final result, call `final_answer(exact_value)` inside the code block, where `exact_value` is ONLY " "the exact requested value (number, short phrase, or comma-separated list) with no explanations, no units, no sentences, " "and no 'final answer' prefix. " "the exact requested value (a single number, single name/surname, short phrase, or comma-separated list, strictly under 100 characters) " "with NO explanations, NO units, NO sentences, and NO 'final answer' prefix. " "Match the exact requested granularity: if the question asks for a single item, person, first name, or surname, " "pass ONLY that single field (e.g., only the first name if asked for 'first name', never both first and last name or multiple people). " "pass ONLY that single word/field (e.g., only the surname if asked for 'surname', never a paragraph or full name). " "Output a comma-separated list ONLY when multiple items are requested, evaluating every item in the provided list in the requested order. " "For chess moves, pass ONLY Standard Algebraic Notation (SAN, e.g., 'Rd5', 'Nf6+', 'O-O') without move numbers or commentary. " "For numbers, omit commas ('1500' not '1,500'). "395 unmodified lines ) if any( k in prompt_lower for k in ("first name", "last name", "surname", "ioc", "country code", "recipient", "only ") for k in ("first name", "last name", "surname", "ioc", "country code", "recipient") ): prompt += ( "\n\nIMPORTANT for multi-condition & single-field questions: "69 unmodified lines if raw_result.lower().startswith("error in generating"): raise RuntimeError(raw_result) cleaned = self._clean_exact_match_answer(raw_result) if cleaned and not cleaned.startswith("AGENT ERROR:"): if cleaned and len(cleaned) <= 2000 and not cleaned.startswith("AGENT ERROR:"): return cleaned blocked_models.add(model_name) breakapp.py+10-7