| 1 | --- |
| 2 | title: "Autocomplete Role in Continue Models" |
| 3 | sidebarTitle: "Autocomplete Role" |
| 4 | description: "Learn how the autocomplete role works in Continue, which models to use, and how to customize prompt templates for inline code suggestions." |
| 5 | keywords: [autocomplete, model, role] |
| 6 | sidebar_position: 2 |
| 7 | --- |
| 8 | |
| 9 | An "autocomplete model" is an LLM that is trained on a special format called fill-in-the-middle (FIM). This format is designed to be given the prefix and suffix of a code file and predict what goes between. This task is very specific, which on one hand means that the models can be smaller (even a 3B parameter model can perform well). On the other hand, this means that Chat models, though larger, will often perform poorly even with extensive prompting. |
| 10 | |
| 11 | In Continue, autocomplete models are used to display inline [Autocomplete](../../features/autocomplete/quick-start) suggestions as you type. Autocomplete models are designated by adding the `autocomplete` to the model's `roles` in `config.yaml`. |
| 12 | |
| 13 | ## Recommended Autocomplete models |
| 14 | |
| 15 | Visit the [Autocomplete Deep Dive](../deep-dives/autocomplete) for recommended models and more details. |
| 16 | |
| 17 | ## Prompt templating |
| 18 | |
| 19 | You can customize the prompt template used when autocomplete happens by setting the `promptTemplates.autocomplete` property in your model configuration. Continue uses [Handlebars syntax](https://handlebarsjs.com/guide/) for templating. |
| 20 | |
| 21 | Available variables for the apply template: |
| 22 | |
| 23 | - `{{{prefix}}}` - the code before your cursor |
| 24 | - `{{{suffix}}}` - the code after your cursor |
| 25 | - `{{{filename}}}` - the name of the file your cursor currently is |
| 26 | - `{{{reponame}}}` - the name of the folder where the codebase is |
| 27 | - `{{{language}}}` - the name of the programming language in full (ex. Typescript) |
| 28 | |
| 29 | Example: |
| 30 | |
| 31 | ```yaml |
| 32 | models: |
| 33 | - name: My Custom Autocomplete Template |
| 34 | provider: ollama |
| 35 | model: qwen2.5-coder:1.5b |
| 36 | promptTemplates: |
| 37 | autocomplete: | |
| 38 | ` |
| 39 | globalThis.importantFunc = importantFunc |
| 40 | <|fim_prefix|>{{{prefix}}}<|fim_suffix|>{{{suffix}}}<|fim_middle|> |
| 41 | ` |
| 42 | ``` |