diff --git a/gpt_engineer/applications/cli/cli_agent.py b/gpt_engineer/applications/cli/cli_agent.py index a3247cdd0c..3422d0cf5d 100644 --- a/gpt_engineer/applications/cli/cli_agent.py +++ b/gpt_engineer/applications/cli/cli_agent.py @@ -113,7 +113,8 @@ def init(self, prompt: str) -> FilesDict: entrypoint = gen_entrypoint( self.ai, files_dict, self.memory, self.preprompts_holder ) - files_dict = FilesDict(files_dict | entrypoint) + combined_dict = {**files_dict, **entrypoint} + files_dict = FilesDict(combined_dict) files_dict = self.process_code_fn( self.ai, self.execution_env, @@ -135,7 +136,8 @@ def improve( entrypoint = gen_entrypoint( self.ai, files_dict, self.memory, self.preprompts_holder ) - files_dict = FilesDict(files_dict | entrypoint) + combined_dict = {**files_dict, **entrypoint} + files_dict = FilesDict(combined_dict) files_dict = self.process_code_fn( self.ai, self.execution_env, diff --git a/gpt_engineer/benchmark/run.py b/gpt_engineer/benchmark/run.py index af2e4bffa6..277b95d945 100644 --- a/gpt_engineer/benchmark/run.py +++ b/gpt_engineer/benchmark/run.py @@ -1,13 +1,18 @@ import time +from typing import List, Optional + from gpt_engineer.benchmark.types import Assertable, Benchmark, TaskResult from gpt_engineer.core.base_agent import BaseAgent from gpt_engineer.core.default.disk_execution_env import DiskExecutionEnv def run( - agent: BaseAgent, benchmark: Benchmark, task_name: str | None = None, verbose=False -) -> list[TaskResult]: + agent: BaseAgent, + benchmark: Benchmark, + task_name: Optional[str] = None, + verbose=False, +) -> List[TaskResult]: task_results = [] for task in benchmark.tasks: t0 = time.time() diff --git a/gpt_engineer/benchmark/types.py b/gpt_engineer/benchmark/types.py index fd70fa7b8c..d8357c9320 100644 --- a/gpt_engineer/benchmark/types.py +++ b/gpt_engineer/benchmark/types.py @@ -1,6 +1,6 @@ from dataclasses import dataclass from subprocess import Popen -from typing import Callable +from typing import Callable, Dict, Optional from gpt_engineer.core.base_execution_env import BaseExecutionEnv from gpt_engineer.core.files_dict import FilesDict @@ -21,9 +21,9 @@ class Assertable: files: FilesDict env: BaseExecutionEnv - process: Popen | None - stdout: str | None - stderr: str | None + process: Optional[Popen] + stdout: Optional[str] + stderr: Optional[str] Assertion = Callable[[Assertable], bool] @@ -32,10 +32,10 @@ class Assertable: @dataclass class Task: name: str - initial_code: FilesDict | None - command: str | None + initial_code: Optional[FilesDict] + command: Optional[str] prompt: str - assertions: dict[str, Assertion] | None + assertions: Optional[Dict[str, Assertion]] @dataclass @@ -44,7 +44,7 @@ class Benchmark: name: str tasks: list[Task] - timeout: int | None = None + timeout: Optional[int] = None @dataclass diff --git a/gpt_engineer/core/default/simple_agent.py b/gpt_engineer/core/default/simple_agent.py index 795b46864f..0965511514 100644 --- a/gpt_engineer/core/default/simple_agent.py +++ b/gpt_engineer/core/default/simple_agent.py @@ -56,7 +56,8 @@ def init(self, prompt: str) -> FilesDict: entrypoint = gen_entrypoint( self.ai, files_dict, self.memory, self.preprompts_holder ) - files_dict = FilesDict(files_dict | entrypoint) + combined_dict = {**files_dict, **entrypoint} + files_dict = FilesDict(combined_dict) return files_dict def improve(