diff options
author | Nate Sesti <sestinj@gmail.com> | 2023-09-01 22:08:27 -0700 |
---|---|---|
committer | Nate Sesti <sestinj@gmail.com> | 2023-09-01 22:08:27 -0700 |
commit | 8967e2d53f4f6ff744c408ae1042caffb25627f9 (patch) | |
tree | 32b1c4d79936a97d9d016c6f5670809c8d447b35 /continuedev/src/continuedev/core | |
parent | 2f792f46026a6bb3c3580f2521b01ecb8c68117c (diff) | |
download | sncontinue-8967e2d53f4f6ff744c408ae1042caffb25627f9.tar.gz sncontinue-8967e2d53f4f6ff744c408ae1042caffb25627f9.tar.bz2 sncontinue-8967e2d53f4f6ff744c408ae1042caffb25627f9.zip |
refactor: :recycle: refactoring LLM to avoid repetition
Diffstat (limited to 'continuedev/src/continuedev/core')
-rw-r--r-- | continuedev/src/continuedev/core/abstract_sdk.py | 4 | ||||
-rw-r--r-- | continuedev/src/continuedev/core/autopilot.py | 2 | ||||
-rw-r--r-- | continuedev/src/continuedev/core/sdk.py | 13 |
3 files changed, 2 insertions, 17 deletions
diff --git a/continuedev/src/continuedev/core/abstract_sdk.py b/continuedev/src/continuedev/core/abstract_sdk.py index 98730d38..fdb99d47 100644 --- a/continuedev/src/continuedev/core/abstract_sdk.py +++ b/continuedev/src/continuedev/core/abstract_sdk.py @@ -71,10 +71,6 @@ class AbstractContinueSDK(ABC): async def delete_directory(self, path: str): pass - @abstractmethod - async def get_user_secret(self, env_var: str) -> str: - pass - config: ContinueConfig @abstractmethod diff --git a/continuedev/src/continuedev/core/autopilot.py b/continuedev/src/continuedev/core/autopilot.py index bae82739..de0b8c53 100644 --- a/continuedev/src/continuedev/core/autopilot.py +++ b/continuedev/src/continuedev/core/autopilot.py @@ -507,7 +507,7 @@ class Autopilot(ContinueBaseModel): if self.session_info is None: async def create_title(): - title = await self.continue_sdk.models.medium.complete( + title = await self.continue_sdk.models.medium._complete( f'Give a short title to describe the current chat session. Do not put quotes around the title. The first message was: "{user_input}". Do not use more than 10 words. The title is: ', max_tokens=20, ) diff --git a/continuedev/src/continuedev/core/sdk.py b/continuedev/src/continuedev/core/sdk.py index 37992b67..9b1c2cd0 100644 --- a/continuedev/src/continuedev/core/sdk.py +++ b/continuedev/src/continuedev/core/sdk.py @@ -94,14 +94,7 @@ class ContinueSDK(AbstractContinueSDK): self.history.timeline[self.history.current_index].logs.append(message) async def start_model(self, llm: LLM): - kwargs = {} - if llm.requires_api_key: - kwargs["api_key"] = await self.get_user_secret(llm.requires_api_key) - if llm.requires_unique_id: - kwargs["unique_id"] = self.ide.unique_id - if llm.requires_write_log: - kwargs["write_log"] = self.write_log - await llm.start(**kwargs) + await llm.start(unique_id=self.ide.unique_id, write_log=self.write_log) async def _ensure_absolute_path(self, path: str) -> str: if os.path.isabs(path): @@ -211,10 +204,6 @@ class ContinueSDK(AbstractContinueSDK): path = await self._ensure_absolute_path(path) return await self.run_step(FileSystemEditStep(edit=DeleteDirectory(path=path))) - async def get_user_secret(self, env_var: str) -> str: - # TODO support error prompt dynamically set on env_var - return await self.ide.getUserSecret(env_var) - _last_valid_config: ContinueConfig = None def _load_config_dot_py(self) -> ContinueConfig: |