From 0f05f580ef2daec19319f3ff7f9b1799ba6169be Mon Sep 17 00:00:00 2001 From: Nate Date: Wed, 18 Dec 2024 20:06:15 -0800 Subject: [PATCH] don't use tools system message when tools off --- core/llm/constructMessages.ts | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/core/llm/constructMessages.ts b/core/llm/constructMessages.ts index 7b6a5151a..24f44279d 100644 --- a/core/llm/constructMessages.ts +++ b/core/llm/constructMessages.ts @@ -71,10 +71,16 @@ function constructSystemPrompt( provider: string, useTools: boolean, ): string | null { - if (CUSTOM_SYS_MSG_MODEL_FAMILIES.some((family) => model.includes(family))) { + if ( + useTools && + CUSTOM_SYS_MSG_MODEL_FAMILIES.some((family) => model.includes(family)) + ) { return SYSTEM_MESSAGE + "\n\n" + TOOL_USE_RULES; - } - if (useTools && modelSupportsTools(model, provider)) { + } else if ( + CUSTOM_SYS_MSG_MODEL_FAMILIES.some((family) => model.includes(family)) + ) { + return SYSTEM_MESSAGE; + } else if (useTools && modelSupportsTools(model, provider)) { return TOOL_USE_RULES; }