docs: update prompt templating docs
This commit is contained in:
parent
7834d26633
commit
ec167301a0
4 changed files with 79 additions and 10 deletions
|
|
@ -13,3 +13,27 @@ When editing code, Chat and Edit model output often doesn't clearly align with e
|
|||
Generally speaking, models proficient in chat and edit can also be used for applying code.
|
||||
|
||||
Explore apply models in [the hub](https://hub.continue.dev/explore/models?roles=apply).
|
||||
|
||||
## 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](https://handlebarsjs.com/guide/) for templating.
|
||||
|
||||
Available variables for the apply template:
|
||||
|
||||
- `{{{original_code}}}` - The original code before changes
|
||||
- `{{{new_code}}}` - The new code after changes
|
||||
|
||||
Example:
|
||||
|
||||
```yaml
|
||||
models:
|
||||
- name: My Custom Applier
|
||||
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.
|
||||
```
|
||||
|
|
|
|||
|
|
@ -363,3 +363,26 @@ If your local machine can run a 16B parameter model, then we recommend running D
|
|||
## Other experiences
|
||||
|
||||
There are many more models and providers you can use with Chat beyond those mentioned above. Read more [here](../model-roles/chat.mdx)
|
||||
|
||||
## Prompt templating
|
||||
|
||||
You can customize the system prompt used for chat interactions by setting the `promptTemplates.baseSystemPrompt` property in your model configuration. Continue uses [Handlebars syntax](https://handlebarsjs.com/guide/) for templating.
|
||||
|
||||
Available variables for the chat template:
|
||||
|
||||
- `{{{history}}}` - The conversation history
|
||||
- `{{{system_message}}}` - The default system message (if provided)
|
||||
|
||||
Example:
|
||||
|
||||
```yaml
|
||||
models:
|
||||
- name: My Custom Chat Model
|
||||
provider: openai
|
||||
model: gpt-4o
|
||||
promptTemplates:
|
||||
baseSystemPrompt: |
|
||||
You are an expert coding assistant specialized in JavaScript development.
|
||||
Always provide code examples when explaining concepts.
|
||||
{{{system_message}}}
|
||||
```
|
||||
|
|
|
|||
|
|
@ -46,3 +46,33 @@ In Continue, you can add `edit` to a model's roles to specify that it can be use
|
|||
</Tabs>
|
||||
|
||||
Explore edit models in [the hub](https://hub.continue.dev/explore/models?roles=edit). Generally, our recommendations for Edit overlap with recommendations for Chat.
|
||||
|
||||
## Prompt templating
|
||||
|
||||
You can customize the prompt template used for editing code by setting the `promptTemplates.edit` property in your model configuration. Continue uses [Handlebars syntax](https://handlebarsjs.com/guide/) for templating.
|
||||
|
||||
Available variables for the edit template:
|
||||
|
||||
- `{{{userInput}}}` - The user's edit request/instruction
|
||||
- `{{{language}}}` - The programming language of the code
|
||||
- `{{{codeToEdit}}}` - The code that's being edited
|
||||
- `{{{prefix}}}` - Content before the edit area
|
||||
- `{{{suffix}}}` - Content after the edit area
|
||||
- `{{{supportsCompletions}}}` - Whether the model supports completions API
|
||||
- `{{{supportsPrefill}}}` - Whether the model supports prefill capability
|
||||
|
||||
Example:
|
||||
|
||||
````yaml
|
||||
models:
|
||||
- name: My Custom Editor
|
||||
provider: openai
|
||||
model: gpt-4o
|
||||
promptTemplates:
|
||||
edit: |
|
||||
Please modify this code:
|
||||
```{{{language}}}
|
||||
{{{codeToEdit}}}
|
||||
```
|
||||
According to this request: {{{userInput}}}
|
||||
````
|
||||
|
|
|
|||
|
|
@ -145,15 +145,11 @@ The `models` section defines the language models used in your configuration. Mod
|
|||
- `apiBase`: Can be used to override the default API base that is specified per model
|
||||
- `roles`: An array specifying the roles this model can fulfill, such as `chat`, `autocomplete`, `embed`, `rerank`, `edit`, `apply`, `summarize`. The default value is `[chat, edit, apply, summarize]`. Note that the `summarize` role is not currently used.
|
||||
- `capabilities`: Array of strings denoting model capabilities, which will overwrite Continue's autodetection based on provider and model. Supported capabilities include `tool_use` and `image_input`.
|
||||
- `promptTemplates`: Can be used to override the default prompt templates for different model roles. Valid values are [`edit`](./customize/model-roles/edit.mdx#prompt-templating), [`apply`](./customize/model-roles/apply.mdx#prompt-templating), and [`baseSystemPrompt`](./customize/model-roles/chat.mdx#prompt-templating) (used to override the system prompt in Chat and Agent). Handlebars syntax can be used to insert variables in your prompt.
|
||||
- `embedOptions`: If the model includes role `embed`, these settings apply for embeddings:
|
||||
|
||||
- `maxChunkSize`: Maximum tokens per document chunk. Minimum is 128 tokens.
|
||||
- `maxBatchSize`: Maximum number of chunks per request. Minimum is 1 chunk.
|
||||
|
||||
- `defaultCompletionOptions`: Default completion options for model settings.
|
||||
|
||||
**Properties:**
|
||||
|
||||
- `contextLength`: Maximum context length of the model, typically in tokens.
|
||||
- `maxTokens`: Maximum number of tokens to generate in a completion.
|
||||
- `temperature`: Controls the randomness of the completion. Values range from `0.0` (deterministic) to `1.0` (random).
|
||||
|
|
@ -161,11 +157,7 @@ The `models` section defines the language models used in your configuration. Mod
|
|||
- `topK`: Maximum number of tokens considered at each step.
|
||||
- `stop`: An array of stop tokens that will terminate the completion.
|
||||
- `n`: Number of completions to generate.
|
||||
|
||||
- `requestOptions`: HTTP request options specific to the model.
|
||||
|
||||
**Properties:**
|
||||
|
||||
- `timeout`: Timeout for each request to the language model.
|
||||
- `verifySsl`: Whether to verify SSL certificates for requests.
|
||||
- `caBundlePath`: Path to a custom CA bundle for HTTP requests.
|
||||
|
|
@ -178,7 +170,7 @@ The `models` section defines the language models used in your configuration. Mod
|
|||
- `key`: Path to the client certificate key file.
|
||||
- `passphrase`: Optional passphrase for the client certificate key file.
|
||||
|
||||
#### Example:
|
||||
#### Example
|
||||
|
||||
```yaml title="config.yaml"
|
||||
models:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue