From ff26d163295b329f6dfb97578c57c9feff924d82 Mon Sep 17 00:00:00 2001 From: mq200 Date: Mon, 21 Apr 2025 09:05:14 -0700 Subject: [PATCH] add standalone template parameter in yaml model config --- core/config/yaml/models.ts | 1 + packages/config-yaml/src/schemas/models.ts | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/core/config/yaml/models.ts b/core/config/yaml/models.ts index 7b5994317..f810a2cdb 100644 --- a/core/config/yaml/models.ts +++ b/core/config/yaml/models.ts @@ -63,6 +63,7 @@ async function modelConfigToBaseLLM({ logger: llmLogger, uniqueId, title: model.name, + template: model.template, promptTemplates: model.promptTemplates, baseChatSystemMessage: model.chatOptions?.baseSystemMessage, capabilities: { diff --git a/packages/config-yaml/src/schemas/models.ts b/packages/config-yaml/src/schemas/models.ts index ad3318a15..8332d873f 100644 --- a/packages/config-yaml/src/schemas/models.ts +++ b/packages/config-yaml/src/schemas/models.ts @@ -68,6 +68,27 @@ const promptTemplatesSchema = z.object({ }); export type PromptTemplates = z.infer; +const templateSchema = z.enum([ + "llama2", + "alpaca", + "zephyr", + "phi2", + "phind", + "anthropic", + "chatml", + "none", + "openchat", + "deepseek", + "xwin-coder", + "neural-chat", + "codellama-70b", + "llava", + "gemma", + "granite", + "llama3", +]); +export type Template = z.infer; + const baseModelFields = { name: z.string(), model: z.string(), @@ -80,6 +101,7 @@ const baseModelFields = { embedOptions: embedOptionsSchema.optional(), chatOptions: chatOptionsSchema.optional(), promptTemplates: promptTemplatesSchema.optional(), + template: templateSchema.optional(), useLegacyCompletionsEndpoint: z.boolean().optional(), env: z .record(z.string(), z.union([z.string(), z.boolean(), z.number()]))