Spaces:
Running on Zero
Running on Zero
Update app.py
Browse files1739 unmodified lines1740174117421743174417451746174717481749175017511536 unmodified lines32883289329032913292329332943295329632973298329933004 unmodified lines33053306330733083309331033113312331333141739 unmodified lineskey_missing = 0 if self._get_api_key(model_name) else 1if provider == "nvidia_nim":if "nemotron" in low or "550b" in low:sub_rank = 0elif "kimi" in low:sub_rank = 1else:sub_rank = 2return (key_missing, 0, sub_rank, (0, 0), model_name)if provider == "openrouter":1536 unmodified linescollected_obs = []mem_steps = getattr(getattr(run_agent, "memory", None), "steps", None) or []for st in mem_steps:obs_txt = getattr(st, "observations", None)if isinstance(obs_txt, str) and obs_txt.strip():if "Invalid non-code output" not in obs_txt:collected_obs.append(obs_txt.strip()[:4500])if collected_obs or raw_result:context_blob = "\n---\n".join(collected_obs[-3:])if raw_result and "max steps" not in raw_result.lower():context_blob += f"\n---\nAgent draft: {raw_result[:1500]}"if context_blob.strip():4 unmodified linesdeadline=deadline,)if direct_ans:return direct_ansblocked_models.add(model_name)breakexcept Exception as exc:llm_err = getattr(built_model, "_last_llm_error", None)if llm_err is not None and llm_err is not exc:1739 unmodified lines174017411742174317441745174617471748174917501751175217531536 unmodified lines329032913292329332943295329632973298329933003301330233033304330533064 unmodified lines331133123313331433153316331733181739 unmodified lineskey_missing = 0 if self._get_api_key(model_name) else 1if provider == "nvidia_nim":if "ultra" in low or "550b" in low:sub_rank = 0elif "mistral-large" in low:sub_rank = 1elif "nemotron" in low and "nano" not in low and "bolt" not in low and "reasoning" not in low:sub_rank = 2else:sub_rank = 3return (key_missing, 0, sub_rank, (0, 0), model_name)if provider == "openrouter":1536 unmodified linescollected_obs = []mem_steps = getattr(getattr(run_agent, "memory", None), "steps", None) or []for st in mem_steps:for attr_name in ("observations", "action_output", "model_output"):val = getattr(st, attr_name, None)if val is None:continuetxt = "\n".join(str(x) for x in val) if isinstance(val, list) else str(val)txt = txt.strip()if txt and "Invalid non-code output" not in txt and len(txt) > 10:collected_obs.append(txt[:4500])if collected_obs or raw_result:context_blob = "\n---\n".join(collected_obs[-4:])if raw_result and "max steps" not in raw_result.lower():context_blob += f"\n---\nAgent draft: {raw_result[:1500]}"if context_blob.strip():4 unmodified linesdeadline=deadline,)if direct_ans:print(f"[DIRECT EXTRACT OK] task_id={task_id} ans={direct_ans!r}", flush=True)return direct_ansexcept Exception as exc:llm_err = getattr(built_model, "_last_llm_error", None)if llm_err is not None and llm_err is not exc:
app.py+15-11