INNER CODE UNIT · Python
max_tokens
OSU-NLP-Group/ScienceAgentBench · agent.py:72
max_tokens=self.context_cutoff - 2000
)[0]["content"]
if len(trimmed_sys_msg) < len(sys_msg):
sys_msg = trimmed_sys_msg + "..."
return sys_msg
def write_program(self, assistant_output, out_fname):
old_program = ""
if Path(out_fname).exists():
with open(out_fname, "r", encoding="utf-8") as f:
old_program = f.read()
match = re.search(r"```python(.*?)```", assistant_output, re.DOTALL)
if match:
result = match.group(1).strip()
else: