Spaces:
Running on Zero
Running on Zero
Update app.py
Browse files214 unmodified lines2152162172182192202212222232487 unmodified lines27112712271327142715271627172718271927202721395 unmodified lines311731183119312031213122312369 unmodified lines3193319431953196319731983199214 unmodified linescleaned = re.sub(r"\s+", " ", unescape(plain_text)).strip()if not cleaned:return "Empty text response."if len(cleaned) <= 24000:return cleanedreturn cleaned[:12000] + "\n...\n" + cleaned[-12000:]except Exception as e:return f"Error fetching URL '{url}': {str(e)}"2487 unmodified linesf"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(...). ""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. ""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). ""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_lowerfor k in ("first name", "last name", "surname", "ioc", "country code", "recipient", "only ")):prompt += ("\n\nIMPORTANT for multi-condition & single-field questions: "69 unmodified linesif 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:"):return cleanedblocked_models.add(model_name)break214 unmodified lines2152162172182192202212222232487 unmodified lines27112712271327142715271627172718271927202721272227232724395 unmodified lines312031213122312331243125312669 unmodified lines3196319731983199320032013202214 unmodified linescleaned = re.sub(r"\s+", " ", unescape(plain_text)).strip()if not cleaned:return "Empty text response."if len(cleaned) <= 45000:return cleanedreturn cleaned[:45000] + "\n...[truncated]..."except Exception as e:return f"Error fetching URL '{url}': {str(e)}"2487 unmodified linesf"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 (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 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_lowerfor k in ("first name", "last name", "surname", "ioc", "country code", "recipient")):prompt += ("\n\nIMPORTANT for multi-condition & single-field questions: "69 unmodified linesif raw_result.lower().startswith("error in generating"):raise RuntimeError(raw_result)cleaned = self._clean_exact_match_answer(raw_result)if cleaned and len(cleaned) <= 2000 and not cleaned.startswith("AGENT ERROR:"):return cleanedblocked_models.add(model_name)break
app.py+10-7