Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions verifiers/v1/utils/sandbox_program_utils.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from pathlib import Path
from __future__ import annotations

import json
Expand Down Expand Up @@ -369,7 +370,7 @@ def model_name(state):


def load_tool_defs(protocol):
defs = json.loads(open(TOOL_DEFS_BY_PROTOCOL_PATH).read())
defs = json.loads(Path(TOOL_DEFS_BY_PROTOCOL_PATH).read_text())
return defs.get(protocol) or []


Expand Down Expand Up @@ -567,7 +568,7 @@ async def create_model_message(state, messages, client):
async def run_base(task, state, client):
prompt_messages = [*(state.get("system_prompt") or []), *(state.get("prompt") or [])]
messages = list(prompt_messages)
config = json.loads(open(RUNNER_CONFIG_PATH).read())
config = json.loads(Path(RUNNER_CONFIG_PATH).read_text())
max_turns = int(config["max_turns"])
turn = 0
while max_turns <= 0 or turn < max_turns:
Expand Down Expand Up @@ -613,8 +614,8 @@ async def run_base(task, state, client):

async def main():
mode = sys.argv[1]
task = json.loads(open(TASK_PATH).read())
state = json.loads(open(STATE_INPUT_PATH).read())
task = json.loads(Path(TASK_PATH).read_text())
state = json.loads(Path(STATE_INPUT_PATH).read_text())
original_state = json.loads(json.dumps(state))
client = Client(state)
try:
Expand Down