Spaces:
Running on Zero
Running on Zero
Update app.py
Browse files125 unmodified lines126127128129130131132133134135136137138139140141142143144145146147148149150151152153125 unmodified linesprint("CodeAgent initialized with LiteLLMModel.")def _clean_exact_match_answer(raw_answer: str) -> str:import retext = (raw_answer or "").strip()if not text or text.startswith("AGENT ERROR:"):return texttext = re.sub(r"(?im)^\s*(final\s*answer|answer)\s*:\s*", "", text).strip()lines = [line.strip() for line in text.splitlines() if line.strip()]if lines:text = lines[-1]if text.startswith("```") and text.endswith("```"):text = text.strip("`").strip()if len(text) >= 2 and ((text[0] == '"' and text[-1] == '"') or (text[0] == "'" and text[-1] == "'")):text = text[1:-1].strip()if len(text) > 1 and text.endswith(".") and not re.search(r"\d\.$", text):text = text[:-1].strip()return textdef __call__(self, question: str, task_id: str = "") -> str:prompt = question.strip()125 unmodified lines126127128129130131132133134135136137138139140141142143144145146147148149150151152153125 unmodified linesprint("CodeAgent initialized with LiteLLMModel.")def _clean_exact_match_answer(raw_answer: str) -> str:import retext = (raw_answer or "").strip()if not text or text.startswith("AGENT ERROR:"):return texttext = re.sub(r"(?im)^\s*(final\s*answer|answer)\s*:\s*", "", text).strip()lines = [line.strip() for line in text.splitlines() if line.strip()]if lines:text = lines[-1]if text.startswith("```") and text.endswith("```"):text = text.strip("`").strip()if len(text) >= 2 and ((text[0] == '"' and text[-1] == '"') or (text[0] == "'" and text[-1] == "'")):text = text[1:-1].strip()if len(text) > 1 and text.endswith(".") and not re.search(r"\d\.$", text):text = text[:-1].strip()return textdef __call__(self, question: str, task_id: str = "") -> str:prompt = question.strip()
app.py+20-20