File size: 829 Bytes
d26280a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
from abc import ABC, abstractmethod

from gpt_engineer.core.files_dict import FilesDict


class BaseAgent(ABC):
    """
    Abstract base class for an agent that interacts with code.

    This class defines the interface for agents capable of initializing and improving code
    based on a given prompt. Implementations of this class are expected to provide concrete
    methods for these actions.

    Methods
    -------
    init(prompt: str) -> Code:
        Initialize a new piece of code based on the given prompt.
    improve(prompt: str, code: Code) -> Code:
        Improve an existing piece of code based on the given prompt.
    """

    @abstractmethod
    def init(self, prompt: str) -> FilesDict:
        pass

    @abstractmethod
    def improve(self, files_dict: FilesDict, prompt: str) -> FilesDict:
        pass