Spaces:
Running on Zero
Running on Zero
Update app.py
Browse files1739 unmodified lines174017411742174317431744174517451746174717471748174917501751175217531536 unmodified lines32903291329232913292329332943293329432953296329732983299330033013302329733033304330533064 unmodified lines331133123313331433153309331033113316331733181739 unmodified lines key_missing = 0 if self._get_api_key(model_name) else 1
if provider == "nvidia_nim": if "nemotron" in low or "550b" in low: if "ultra" in low or "550b" in low: sub_rank = 0 elif "kimi" in low: elif "mistral-large" in low: sub_rank = 1 else: elif "nemotron" in low and "nano" not in low and "bolt" not in low and "reasoning" not in low: sub_rank = 2 else: sub_rank = 3 return (key_missing, 0, sub_rank, (0, 0), model_name)
if provider == "openrouter":1536 unmodified lines collected_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]) for attr_name in ("observations", "action_output", "model_output"): val = getattr(st, attr_name, None) if val is None: continue txt = "\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[-3:]) 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 lines deadline=deadline, ) if direct_ans: print(f"[DIRECT EXTRACT OK] task_id={task_id} ans={direct_ans!r}", flush=True) return direct_ans
blocked_models.add(model_name) break except 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