shank commited on
Commit ·
212d2d9
1
Parent(s): cd968e7
Update: Dockerfile and inference.py
Browse filesFiles changed (2)
- Dockerfile+1-1
- inference.py+5-5
1234FROM python:3.10-slimWORKDIR /app1234FROM python:3.10.14-slim-bookwormWORKDIR /app
81 unmodified lines828384858687881 unmodified line9091929394959697989910065 unmodified lines16616716816917017117228 unmodified lines20120220320420520620781 unmodified linesreturn completion.choices[0].message.contentexcept (RateLimitError, APIConnectionError, APITimeoutError) as e:if attempt == max_retries - 1:raise ewait_time = (2 ** attempt) + random.random()print(f" [!] API Error ({type(e).__name__}). Retrying in {wait_time:.1f}s... (Attempt {attempt+1}/{max_retries})")time.sleep(wait_time)1 unmodified line# For general API errors, log and potentially retry if it's a 5xxprint(f" [!] OpenAI API Error: {e}")if attempt == max_retries - 1:raise etime.sleep(2)except Exception as e:print(f" [!] Unexpected error during completion: {e}")raise ereturn ""65 unmodified lines"""Run one complete debugging episode. Returns result dict."""# Reset environmentreset_resp = requests.post(f"{ENV_BASE_URL}/reset", json={"task_id": task_id})reset_resp.raise_for_status()obs = reset_resp.json()28 unmodified linesraw = json.dumps(action)# Submit action to environmentstep_resp = requests.post(f"{ENV_BASE_URL}/step", json=action)step_resp.raise_for_status()result = step_resp.json()81 unmodified lines828384858687881 unmodified line9091929394959697989910065 unmodified lines16616716816917017117228 unmodified lines20120220320420520620781 unmodified linesreturn completion.choices[0].message.contentexcept (RateLimitError, APIConnectionError, APITimeoutError) as e:if attempt == max_retries - 1:return ""wait_time = (2 ** attempt) + random.random()print(f" [!] API Error ({type(e).__name__}). Retrying in {wait_time:.1f}s... (Attempt {attempt+1}/{max_retries})")time.sleep(wait_time)1 unmodified line# For general API errors, log and potentially retry if it's a 5xxprint(f" [!] OpenAI API Error: {e}")if attempt == max_retries - 1:return ""time.sleep(2)except Exception as e:print(f" [!] Unexpected error during completion: {e}")return ""return ""65 unmodified lines"""Run one complete debugging episode. Returns result dict."""# Reset environmentreset_resp = requests.post(f"{ENV_BASE_URL}/reset", json={"task_id": task_id}, timeout=60)reset_resp.raise_for_status()obs = reset_resp.json()28 unmodified linesraw = json.dumps(action)# Submit action to environmentstep_resp = requests.post(f"{ENV_BASE_URL}/step", json=action, timeout=60)step_resp.raise_for_status()result = step_resp.json()
Dockerfile+1-1
inference.py+5-5