From 3bd939910c006a0019cc80c49c0717cf7fd78b32 Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Sat, 4 Nov 2023 10:32:29 -0700 Subject: [PATCH] =?UTF-8?q?=E2=9A=A1=EF=B8=8F=20improved=20codellama=20edi?= =?UTF-8?q?t=20prompt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gui/src/util/modelData.ts | 7 +++++-- server/continuedev/core/steps.py | 10 +++++++--- server/continuedev/libs/llm/prompts/edit.py | 2 +- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/gui/src/util/modelData.ts b/gui/src/util/modelData.ts index 5a77a9495..a3ac0590b 100644 --- a/gui/src/util/modelData.ts +++ b/gui/src/util/modelData.ts @@ -112,7 +112,7 @@ const completionParamsInputs = [ FrequencyPenaltyInput, ]; -const serverUrlInput = { +const serverUrlInput: InputDescriptor = { inputType: CollectInputType.text, key: "server_url", label: "Server URL", @@ -462,7 +462,10 @@ export const MODEL_INFO: { [key: string]: ModelInfo } = { icon: "ollama.png", tags: [ModelProviderTag["Local"], ModelProviderTag["Open-Source"]], packages: osModels, - collectInputFor: [...completionParamsInputs, serverUrlInput], + collectInputFor: [ + ...completionParamsInputs, + { ...serverUrlInput, defaultValue: "http://localhost:11434" }, + ], }, together: { title: "TogetherAI", diff --git a/server/continuedev/core/steps.py b/server/continuedev/core/steps.py index e4f5c8aca..f49690101 100644 --- a/server/continuedev/core/steps.py +++ b/server/continuedev/core/steps.py @@ -356,7 +356,11 @@ Please output the code to be inserted at the cursor in order to fulfill the user return prompt def is_end_line(self, line: str) -> bool: - return "" in line or "" in line + return ( + "" in line + or "" in line + or "[/CODE]" in line + ) def line_to_be_ignored(self, line: str, is_first_line: bool = False) -> bool: return ( @@ -598,7 +602,7 @@ Please output the code to be inserted at the cursor in order to fulfill the user messages = rendered params = {"prompt": rendered} - if isinstance(template, PromptTemplate): + if template.__class__.__name__ == "PromptTemplate": params.update(template.dict(exclude={"prompt"})) params.update( @@ -865,4 +869,4 @@ class UserInputStep(Step): ChatMessage(role="user", content=self.user_input, summary=self.user_input) ) self.description = self.user_input - return UserInputObservation(user_input=self.user_input) \ No newline at end of file + return UserInputObservation(user_input=self.user_input) diff --git a/server/continuedev/libs/llm/prompts/edit.py b/server/continuedev/libs/llm/prompts/edit.py index 22c334867..43816bed0 100644 --- a/server/continuedev/libs/llm/prompts/edit.py +++ b/server/continuedev/libs/llm/prompts/edit.py @@ -37,7 +37,7 @@ _codellama_edit_prompt = dedent( You are an expert programmer and personal assistant, here is your task: "Rewrite the above code in order to {{{user_input}}}" Your answer should start with a [CODE] tag and end with a [/CODE] tag. - [/INST] + [/INST] Sure! Here's the code you requested: [CODE]""" )