Elffuss BraidHub

kikocis/continue public

627d7d0d1f85 · 1.6 KiBRawPermalink
1---
2title: Apply Role
3description: Apply model role
4keywords: [apply, model, role]
5sidebar_position: 4
6---
7
8When editing code, Chat and Edit model output often doesn't clearly align with existing code. A model with the `apply` role is used to generate a more precise diff to apply changes to a file.
9
10## Recommended Apply models
11
12We recommend [Morph Fast Apply](https://morphllm.com) or [Relace's Instant Apply model](https://hub.continue.dev/relace/instant-apply) for the fastest Apply experience. You can sign up for Morph's free tier [here](https://morphllm.com/dashboard) or get a Relace API key [here](https://app.relace.ai/settings/api-keys).
13
14However, most Chat models can also be used for applying code changes. We recommend smaller/cheaper models for the task, such as Claude 3.5 Haiku.
15
16<Info>
17 Explore all apply models in [the
18 Hub](https://hub.continue.dev/explore/models?roles=apply)
19</Info>
20
21## Prompt templating
22
23You can customize the prompt template used for applying code changes by setting the `promptTemplates.apply` property in your model configuration. Continue uses [Handlebars syntax](https://handlebarsjs.com/guide/) for templating.
24
25Available variables for the apply template:
26
27- `{{{original_code}}}` - The original code before changes
28- `{{{new_code}}}` - The new code after changes
29
30Example:
31
32```yaml
33models:
34 - name: My Custom Apply Template
35 provider: anthropic
36 model: claude-3-5-sonnet-latest
37 promptTemplates:
38 apply: |
39 Original: {{{original_code}}}
40 New: {{{new_code}}}
41
42 Please generate the final code without any markers or explanations.
43```