diff options
author | Nate Sesti <sestinj@gmail.com> | 2023-05-27 00:11:28 -0400 |
---|---|---|
committer | Nate Sesti <sestinj@gmail.com> | 2023-05-27 00:11:28 -0400 |
commit | 1e9bd40415488760a52957cbb015a1c3c4e1383a (patch) | |
tree | d6d6ba2ccce339e578976aa8bed2f77d90c34959 /continuedev/src/continuedev/libs/sdk.py | |
parent | 741f85b6b2b26e5e007ebf92b336a832af6af5d4 (diff) | |
download | sncontinue-1e9bd40415488760a52957cbb015a1c3c4e1383a.tar.gz sncontinue-1e9bd40415488760a52957cbb015a1c3c4e1383a.tar.bz2 sncontinue-1e9bd40415488760a52957cbb015a1c3c4e1383a.zip |
Refactoring to deal with circularity
Diffstat (limited to 'continuedev/src/continuedev/libs/sdk.py')
-rw-r--r-- | continuedev/src/continuedev/libs/sdk.py | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/continuedev/src/continuedev/libs/sdk.py b/continuedev/src/continuedev/libs/sdk.py new file mode 100644 index 00000000..0295bf35 --- /dev/null +++ b/continuedev/src/continuedev/libs/sdk.py @@ -0,0 +1,39 @@ +from typing import Coroutine, Union +from ..models.filesystem_edit import FileSystemEdit +from .llm import LLM +from .observation import Observation +from ..server.ide_protocol import AbstractIdeProtocolServer +from .core import History, Step +from .steps.core.core import * + + +class Agent: + pass + + +class ContinueSDK: + """The SDK provided as parameters to a step""" + llm: LLM + ide: AbstractIdeProtocolServer + __agent: Agent + + def __init__(self, agent: Agent, llm: Union[LLM, None] = None): + if llm is None: + self.llm = agent.llm + else: + self.llm = llm + self.ide = agent.ide + self.__agent = agent + + @property + def history(self) -> History: + return self.__agent.history + + async def run_step(self, step: Step) -> Coroutine[Observation, None, None]: + return await self.__agent._run_singular_step(step) + + async def apply_filesystem_edit(self, edit: FileSystemEdit): + await self.run_step(FileSystemEditStep(edit=edit)) + + async def wait_for_user_input(self) -> str: + return await self.__agent.wait_for_user_input() |