Merge pull request #5236 from mq200/feat/yaml_support_template

add standalone template parameter in yaml model config
This commit is contained in:
Nate Sesti 2025-04-29 09:51:47 -07:00 • committed by GitHub
commit 9223acee1a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 23 additions and 1 deletions

View file

@ -60,6 +60,7 @@ async function modelConfigToBaseLLM({
logger: llmLogger,
uniqueId,
title: model.name,
template: model.promptTemplates?.chatTemplate,
promptTemplates: model.promptTemplates,
baseChatSystemMessage: model.chatOptions?.baseSystemMessage,
capabilities: {

View file

@ -167,7 +167,7 @@ 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 [autocomplete](./customize/model-roles/autocomplete.md#prompt-templating)
- `promptTemplates`: Can be used to override the default prompt templates for different model roles. Valid values are `chatTemplate`, [`edit`](./customize/model-roles/edit.mdx#prompt-templating), [`apply`](./customize/model-roles/apply.mdx#prompt-templating) and [`autocomplete`](./customize/model-roles/autocomplete.md#prompt-templating). The `chatTemplate` property must be a valid template name, such as `llama3` or `anthropic`.
- `chatOptions`: If the model includes role `chat`, these settings apply for Chat and Agent mode:
- `baseSystemMessage`: Can be used to override the default system prompt.
- `embedOptions`: If the model includes role `embed`, these settings apply for embeddings:

View file

@ -69,9 +69,30 @@ export const chatOptionsSchema = z.object({
});
export type ChatOptions = z.infer<typeof chatOptionsSchema>;
const templateSchema = z.enum([
"llama2",
"alpaca",
"zephyr",
"phi2",
"phind",
"anthropic",
"chatml",
"none",
"openchat",
"deepseek",
"xwin-coder",
"neural-chat",
"codellama-70b",
"llava",
"gemma",
"granite",
"llama3",
]);
/** Prompt templates use Handlebars syntax */
const promptTemplatesSchema = z.object({
apply: z.string().optional(),
chatTemplate: templateSchema.optional(),
edit: z.string().optional(),
autocomplete: z.string().optional()
});