shank commited on
Commit ·
cd968e7
1
Parent(s): 2a482a5
Fix: precaution to prevent infinite loop
Browse files178 unmodified lines17918018118218318418518654 unmodified lines241242243244245246247178 unmodified lineslast_result = {"reward": {"grader_score": 0.0, "cumulative_reward": 0.0}, "observation": obs}action = {}while not done:# Get LLM action using the robust helpertry:raw = get_completion(messages)if not raw:54 unmodified linesprint(f"Env: {ENV_BASE_URL}")if not has_token and "openai.com" in API_BASE_URL:print("WARNING: HF_TOKEN is missing but using default OpenAI endpoint. This may fail.")print("=" * 55)178 unmodified lines17918018118218318418518618718818919019154 unmodified lines246247248249250251252178 unmodified lineslast_result = {"reward": {"grader_score": 0.0, "cumulative_reward": 0.0}, "observation": obs}action = {}max_steps = obs.get("max_steps",25)step_count = 0while not done:step_count+=1if(step_count>max_steps+5):print(f"[!] Safety limit reached, breaking loop")breaktry:raw = get_completion(messages)if not raw:54 unmodified linesprint(f"Env: {ENV_BASE_URL}")if not has_token and "openai.com" in API_BASE_URL:print("WARNING: HF_TOKEN is missing. API calls will likely fail.")print("=" * 55)
inference.py+7-2