⚡️ improved codellama edit prompt
This commit is contained in:
parent
ef6273371a
commit
3bd939910c
3 changed files with 13 additions and 6 deletions
|
|
@ -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",
|
||||
|
|
|
|||
|
|
@ -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 "</modified_code_to_edit>" in line or "</code_to_edit>" in line
|
||||
return (
|
||||
"</modified_code_to_edit>" in line
|
||||
or "</code_to_edit>" 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)
|
||||
return UserInputObservation(user_input=self.user_input)
|
||||
|
|
|
|||
|
|
@ -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]"""
|
||||
)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue