From a93d9bdda0188becfb12be2b9ca02fb40c2f4fbf Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Sun, 4 Feb 2024 09:04:11 -0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=93=9D=20make=20custom=20edit=20template?= =?UTF-8?q?=20docs=20more=20clear?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/docs/model-setup/configuration.md | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/docs/docs/model-setup/configuration.md b/docs/docs/model-setup/configuration.md index 5337a7da1..a40911643 100644 --- a/docs/docs/model-setup/configuration.md +++ b/docs/docs/model-setup/configuration.md @@ -98,9 +98,9 @@ This exact function and a few other default implementations are available in [`c You also have access to customize the prompt used in the '/edit' slash command. We already have a well-engineered prompt for GPT-4 and sensible defaults for less powerful open-source models, but you might wish to play with the prompt and try to find a more reliable alternative if you are for example getting English as well as code in your output. -To customize the prompt, use the `promptTemplates` property of any model, which is a dictionary, and set the "edit" key to a template string with Mustache syntax. The 'filePrefix', 'fileSuffix', 'codeToEdit', 'language', 'contextItems', and 'userInput' variables are available in the template. Here is an example: +To customize the prompt, use the `promptTemplates` property of any model, which is a dictionary, and set the "edit" key to a template string with Mustache syntax. The 'filePrefix', 'fileSuffix', 'codeToEdit', 'language', 'contextItems', and 'userInput' variables are available in the template. Here is an example of how it can be set in `config.ts`: -```typescript +```typescript title="~/.continue/config.ts" const codellamaEditPrompt = `\`\`\`{{{language}}} {{{codeToEdit}}} \`\`\` @@ -109,13 +109,9 @@ const codellamaEditPrompt = `\`\`\`{{{language}}} Your answer should be given inside of a code block. It should use the same kind of indentation as above. [/INST] Sure! Here's the rewritten code you requested: \`\`\`{{{language}}}`; -``` -It can then be used like this in `config.ts`: - -```typescript title="~/.continue/config.ts" function modifyConfig(config: Config): Config { - config.models[0].promptTemplates["edit"] = ""; + config.models[0].promptTemplates["edit"] = codellamaEditPrompt; return config; } ```