Apply Role
When 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.
Generally speaking, models proficient in chat and edit can also be used for applying code.
Explore apply models in the hub.
Prompt templating
You can customize the prompt template used for applying code changes by setting the promptTemplates.apply
property in your model configuration. Continue uses Handlebars syntax for templating.
Available variables for the apply template:
{{{original_code}}}
- The original code before changes{{{new_code}}}
- The new code after changes
Example:
models:
- name: My Custom Apply Template
provider: anthropic
model: claude-3-5-sonnet-latest
promptTemplates:
apply: |
Original: {{{original_code}}}
New: {{{new_code}}}
Please generate the final code without any markers or explanations.