Elffuss BraidHub

kikocis/continue public

f715a486549f · 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
17Explore all apply models in [the Hub](https://hub.continue.dev/explore/models?roles=apply)
18:::
19
20## Prompt templating
21
22You 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.
23
24Available variables for the apply template:
25
26- `{{{original_code}}}` - The original code before changes
27- `{{{new_code}}}` - The new code after changes
28
29Example:
30
31```yaml
32models:
33 - name: My Custom Apply Template
34 provider: anthropic
35 model: claude-3-5-sonnet-latest
36 promptTemplates:
37 apply: |
38 Original: {{{original_code}}}
39 New: {{{new_code}}}
40
41 Please generate the final code without any markers or explanations.
42```