| 1 | --- |
| 2 | title: Edit Role |
| 3 | description: Edit model role |
| 4 | keywords: [edit, editing, model, role] |
| 5 | sidebar_position: 3 |
| 6 | --- |
| 7 | import { ModelRecommendations } from '/snippets/ModelRecommendations.jsx' |
| 8 | |
| 9 | It's often useful to select a different model to respond to Edit instructions than for Chat instructions, as Edits are often more code-specific and may require less conversational readability. |
| 10 | |
| 11 | In Continue, you can add `edit` to a model's roles to specify that it can be used for Edit requests. If no edit models are specified, the selected `chat` model is used. |
| 12 | |
| 13 | ```yaml title="config.yaml" |
| 14 | models: |
| 15 | - name: Claude 4 Sonnet |
| 16 | provider: anthropic |
| 17 | model: claude-3-5-sonnet-latest |
| 18 | apiKey: <YOUR_ANTHROPIC_API_KEY> |
| 19 | roles: |
| 20 | - edit |
| 21 | ``` |
| 22 | |
| 23 | Explore edit models in [the hub](https://hub.continue.dev/explore/models?roles=edit). Generally, our recommendations for Edit overlap with recommendations for Chat. |
| 24 | |
| 25 | ## Model Recommendations |
| 26 | |
| 27 | <ModelRecommendations role="chat_edit" /> |
| 28 | |
| 29 | ## Prompt templating |
| 30 | |
| 31 | You can customize the prompt template used for editing code by setting the `promptTemplates.edit` property in your model configuration. Continue uses [Handlebars syntax](https://handlebarsjs.com/guide/) for templating. |
| 32 | |
| 33 | Available variables for the edit template: |
| 34 | |
| 35 | - `{{{userInput}}}` - The user's edit request/instruction |
| 36 | - `{{{language}}}` - The programming language of the code |
| 37 | - `{{{codeToEdit}}}` - The code that's being edited |
| 38 | - `{{{prefix}}}` - Content before the edit area |
| 39 | - `{{{suffix}}}` - Content after the edit area |
| 40 | - `{{{supportsCompletions}}}` - Whether the model supports completions API |
| 41 | - `{{{supportsPrefill}}}` - Whether the model supports prefill capability |
| 42 | |
| 43 | Example: |
| 44 | |
| 45 | ```yaml |
| 46 | models: |
| 47 | - name: My Custom Edit Template |
| 48 | provider: openai |
| 49 | model: gpt-4o |
| 50 | promptTemplates: |
| 51 | edit: | |
| 52 | `Here is the code before editing: |
| 53 | \`\`\`{{{language}}} |
| 54 | {{{codeToEdit}}} |
| 55 | \`\`\` |
| 56 | |
| 57 | Here is the edit requested: |
| 58 | "{{{userInput}}}" |
| 59 | |
| 60 | Here is the code after editing:` |
| 61 | ``` |