Elffuss BraidHub

kikocis/continue public

2cf8097f3ed4 · 2.5 KiBRawPermalink
1---
2title: Edit Role
3description: Edit model role
4keywords: [edit, editing, model, role]
5sidebar_position: 3
6---
7import { ModelRecommendations } from '/snippets/ModelRecommendations.jsx'
8
9It's often useful to select a different model to respond to Edit prompts than for chat prompts, as Edits are often more code-specific and may require less conversational readability.
10
11In 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<Tabs>
14 <Tab title="YAML">
15 Use model roles.
16 ```yaml title="config.yaml"
17 models:
18 - name: Claude 3.5 Sonnet
19 provider: anthropic
20 model: claude-3-5-sonnet-latest
21 apiKey: <YOUR_ANTHROPIC_API_KEY>
22 roles:
23 - edit
24 ```
25 </Tab>
26 <Tab title="JSON">
27 Set the `experimental.modelRoles.inlineEdit` property in `config.json`.
28 ```json title="config.json"
29 {
30 "models": {
31 "name": "Claude 3.5 Sonnet",
32 "provider": "anthropic",
33 "model": "claude-3-5-sonnet-latest",
34 "apiKey": "<YOUR_ANTHROPIC_API_KEY>"
35 },
36 "experimental": {
37 "modelRoles": {
38 "inlineEdit": "Claude 3.5 Sonnet",
39 }
40 }
41 }
42 ```
43 </Tab>
44</Tabs>
45
46Explore edit models in [the hub](https://hub.continue.dev/explore/models?roles=edit). Generally, our recommendations for Edit overlap with recommendations for Chat.
47
48## Model Recommendations
49
50<ModelRecommendations role="chat_edit" />
51
52## Prompt templating
53
54You 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.
55
56Available variables for the edit template:
57
58- `{{{userInput}}}` - The user's edit request/instruction
59- `{{{language}}}` - The programming language of the code
60- `{{{codeToEdit}}}` - The code that's being edited
61- `{{{prefix}}}` - Content before the edit area
62- `{{{suffix}}}` - Content after the edit area
63- `{{{supportsCompletions}}}` - Whether the model supports completions API
64- `{{{supportsPrefill}}}` - Whether the model supports prefill capability
65
66Example:
67
68```yaml
69models:
70 - name: My Custom Edit Template
71 provider: openai
72 model: gpt-4o
73 promptTemplates:
74 edit: |
75 `Here is the code before editing:
76 \`\`\`{{{language}}}
77 {{{codeToEdit}}}
78 \`\`\`
79
80 Here is the edit requested:
81 "{{{userInput}}}"
82
83 Here is the code after editing:`
84```