diff --git a/core/llm/autodetect.ts b/core/llm/autodetect.ts index 92693456d..571a7a700 100644 --- a/core/llm/autodetect.ts +++ b/core/llm/autodetect.ts @@ -155,6 +155,24 @@ function llmCanGenerateInParallel(provider: string, model: string): boolean { return PARALLEL_PROVIDERS.includes(provider); } +function isProviderHandlesTemplatingOrNoTemplateTypeRequired( + modelName: string, +): boolean { + return ( + modelName.includes("gpt") || + modelName.includes("command") || + modelName.includes("aya") || + modelName.includes("chat-bison") || + modelName.includes("pplx") || + modelName.includes("gemini") || + modelName.includes("grok") || + modelName.includes("moonshot") || + modelName.includes("kimi") || + modelName.includes("mercury") || + /^o\d/.test(modelName) + ); +} + function autodetectTemplateType(model: string): TemplateType | undefined { const lower = model.toLowerCase(); @@ -162,20 +180,10 @@ function autodetectTemplateType(model: string): TemplateType | undefined { return "codellama-70b"; } - if ( - lower.includes("gpt") || - lower.includes("command") || - lower.includes("aya") || - lower.includes("chat-bison") || - lower.includes("pplx") || - lower.includes("gemini") || - lower.includes("grok") || - lower.includes("moonshot") || - lower.includes("mercury") || - /^o\d/.test(lower) - ) { + if (isProviderHandlesTemplatingOrNoTemplateTypeRequired(lower)) { return undefined; } + if (lower.includes("llama3") || lower.includes("llama-3")) { return "llama3"; } diff --git a/core/llm/toolSupport.ts b/core/llm/toolSupport.ts index 530d47327..87d3bb3fd 100644 --- a/core/llm/toolSupport.ts +++ b/core/llm/toolSupport.ts @@ -291,6 +291,22 @@ export const PROVIDER_TOOL_SUPPORT: Record boolean> = } } + return false; + }, + moonshot: (model) => { + // support moonshot models + // https://platform.moonshot.ai/docs/pricing/chat#concepts + if ( + model.toLowerCase().startsWith("kimi") && + model.toLowerCase() !== "kimi-thinking-preview" + ) { + return true; + } + + if (model.toLowerCase().startsWith("moonshot")) { + return true; + } + return false; }, };