| 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 | import { ModelRecommendations } from '/snippets/ModelRecommendations.jsx' |
| 10 | |
| 11 | |
| 12 | 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. |
| 13 | |
| 14 | 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`. |
| 15 | |
| 16 | ## Recommended Autocomplete models |
| 17 | |
| 18 | <ModelRecommendations role="autocomplete" /> |
| 19 | |
| 20 | Visit the [Autocomplete Deep Dive](../deep-dives/autocomplete) for detailed setup instructions and configuration options. |
| 21 | |
| 22 | ## Prompt templating |
| 23 | |
| 24 | 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. |
| 25 | |
| 26 | Available variables for the apply template: |
| 27 | |
| 28 | - `{{{prefix}}}` - the code before your cursor |
| 29 | - `{{{suffix}}}` - the code after your cursor |
| 30 | - `{{{filename}}}` - the name of the file your cursor currently is |
| 31 | - `{{{reponame}}}` - the name of the folder where the codebase is |
| 32 | - `{{{language}}}` - the name of the programming language in full (ex. Typescript) |
| 33 | |
| 34 | Example: |
| 35 | |
| 36 | ```yaml |
| 37 | models: |
| 38 | - name: My Custom Autocomplete Template |
| 39 | provider: ollama |
| 40 | model: qwen2.5-coder:1.5b |
| 41 | promptTemplates: |
| 42 | autocomplete: | |
| 43 | ` |
| 44 | globalThis.importantFunc = importantFunc |
| 45 | <|fim_prefix|>{{{prefix}}}<|fim_suffix|>{{{suffix}}}<|fim_middle|> |
| 46 | ` |
| 47 | ``` |