Merge pull request #6818 from xiaohuanxiong3/add-tool-call-support-for-moonshot-models
feat: add tool call support for moonshot models
This commit is contained in:
commit
19ade99c49
2 changed files with 36 additions and 12 deletions
|
|
@ -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";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -291,6 +291,22 @@ export const PROVIDER_TOOL_SUPPORT: Record<string, (model: string) => 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;
|
||||
},
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue