Changesets · Branches · Tags · Compare
| Changeset | 8b25799b1f271ad4106a84a23b96cbf0a6baf2563d81287e658eb731441cf111 |
|---|---|
| Author | Aditya Mitra <61635505+uinstinct@users.noreply.github.com> · 2025-08-28 04:11 +05:30 |
| Committer | GitHub <noreply@github.com> · 2025-08-27 15:41 -07:00 |
| Parents | 149d394ab4c9 |
7 files changed
deleted core/config/shouldAutoEnableSystemMessageTools.ts +0 −31
| @@ -1,31 +0,0 @@ | ||
| 1 | -import { ModelDescription } from "../index.d"; | |
| 2 | - | |
| 3 | -/** | |
| 4 | - * Determines if system message tools should be auto-enabled for the given model. | |
| 5 | - * This is used to automatically enable system message tools for certain provider/model combinations | |
| 6 | - * where we have a strong preference, taking priority over user manual settings. | |
| 7 | - * | |
| 8 | - * System message tools are an alternative to native tool calling where tool definitions and calls | |
| 9 | - * are embedded in the system message as text rather than using the provider's native tool calling API. | |
| 10 | - * This can be beneficial for providers/models that don't support native tool calling or have | |
| 11 | - * poor tool calling performance. | |
| 12 | - * | |
| 13 | - * Current auto-enable rules: | |
| 14 | - * - OpenRouter provider: true for all models except those containing "claude" (since Claude models | |
| 15 | - * generally have good native tool calling support) | |
| 16 | - * - All other providers: undefined (no auto-preference, use manual setting) | |
| 17 | - * | |
| 18 | - * @param model The model description to check | |
| 19 | - * @returns true to force enable, false to force disable, undefined for no auto-preference | |
| 20 | - */ | |
| 21 | -export function shouldAutoEnableSystemMessageTools( | |
| 22 | - model: ModelDescription, | |
| 23 | -): boolean | undefined { | |
| 24 | - // Auto-enable for OpenRouter, but exclude Claude models which have good native tool calling | |
| 25 | - if (model.provider === "openrouter") { | |
| 26 | - return !model.model.toLowerCase().includes("claude"); | |
| 27 | - } | |
| 28 | - | |
| 29 | - // No auto-preference for all other providers - use manual setting | |
| 30 | - return undefined; | |
| 31 | -} |
deleted core/config/shouldAutoEnableSystemMessageTools.vitest.ts +0 −85
| @@ -1,85 +0,0 @@ | ||
| 1 | -import { describe, expect, test } from "vitest"; | |
| 2 | -import { ModelDescription } from "../index.d"; | |
| 3 | -import { shouldAutoEnableSystemMessageTools } from "./shouldAutoEnableSystemMessageTools"; | |
| 4 | - | |
| 5 | -describe("shouldAutoEnableSystemMessageTools", () => { | |
| 6 | - const createModel = (provider: string, model: string): ModelDescription => ({ | |
| 7 | - title: "Test Model", | |
| 8 | - provider, | |
| 9 | - underlyingProviderName: provider, | |
| 10 | - model, | |
| 11 | - }); | |
| 12 | - | |
| 13 | - test("should return true for OpenRouter models that don't contain 'claude'", () => { | |
| 14 | - expect( | |
| 15 | - shouldAutoEnableSystemMessageTools(createModel("openrouter", "gpt-4o")), | |
| 16 | - ).toBe(true); | |
| 17 | - expect( | |
| 18 | - shouldAutoEnableSystemMessageTools( | |
| 19 | - createModel("openrouter", "llama-3.3-70b-instruct"), | |
| 20 | - ), | |
| 21 | - ).toBe(true); | |
| 22 | - expect( | |
| 23 | - shouldAutoEnableSystemMessageTools( | |
| 24 | - createModel("openrouter", "qwen/qwen-2.5-72b-instruct"), | |
| 25 | - ), | |
| 26 | - ).toBe(true); | |
| 27 | - }); | |
| 28 | - | |
| 29 | - test("should return false for OpenRouter Claude models", () => { | |
| 30 | - expect( | |
| 31 | - shouldAutoEnableSystemMessageTools( | |
| 32 | - createModel("openrouter", "anthropic/claude-3-sonnet"), | |
| 33 | - ), | |
| 34 | - ).toBe(false); | |
| 35 | - expect( | |
| 36 | - shouldAutoEnableSystemMessageTools( | |
| 37 | - createModel("openrouter", "anthropic/claude-3.5-sonnet"), | |
| 38 | - ), | |
| 39 | - ).toBe(false); | |
| 40 | - expect( | |
| 41 | - shouldAutoEnableSystemMessageTools( | |
| 42 | - createModel("openrouter", "claude-3-haiku"), | |
| 43 | - ), | |
| 44 | - ).toBe(false); | |
| 45 | - }); | |
| 46 | - | |
| 47 | - test("should return undefined for all other providers", () => { | |
| 48 | - expect( | |
| 49 | - shouldAutoEnableSystemMessageTools(createModel("openai", "gpt-4o")), | |
| 50 | - ).toBe(undefined); | |
| 51 | - expect( | |
| 52 | - shouldAutoEnableSystemMessageTools( | |
| 53 | - createModel("anthropic", "claude-3.5-sonnet"), | |
| 54 | - ), | |
| 55 | - ).toBe(undefined); | |
| 56 | - expect( | |
| 57 | - shouldAutoEnableSystemMessageTools( | |
| 58 | - createModel("groq", "llama-3.3-70b-versatile"), | |
| 59 | - ), | |
| 60 | - ).toBe(undefined); | |
| 61 | - expect( | |
| 62 | - shouldAutoEnableSystemMessageTools( | |
| 63 | - createModel("together", "meta-llama/Meta-Llama-3.1-70B-Instruct-Turbo"), | |
| 64 | - ), | |
| 65 | - ).toBe(undefined); | |
| 66 | - }); | |
| 67 | - | |
| 68 | - test("should be case insensitive for 'claude' detection", () => { | |
| 69 | - expect( | |
| 70 | - shouldAutoEnableSystemMessageTools( | |
| 71 | - createModel("openrouter", "CLAUDE-models"), | |
| 72 | - ), | |
| 73 | - ).toBe(false); | |
| 74 | - expect( | |
| 75 | - shouldAutoEnableSystemMessageTools( | |
| 76 | - createModel("openrouter", "Claude-3.5"), | |
| 77 | - ), | |
| 78 | - ).toBe(false); | |
| 79 | - expect( | |
| 80 | - shouldAutoEnableSystemMessageTools( | |
| 81 | - createModel("openrouter", "some-model-Claude"), | |
| 82 | - ), | |
| 83 | - ).toBe(false); | |
| 84 | - }); | |
| 85 | -}); |
modified docs/features/agent/model-setup.mdx +0 −4
| @@ -12,10 +12,6 @@ | ||
| 12 | 12 | |
| 13 | 13 | ## How System Message Tools Work |
| 14 | 14 | |
| 15 | -<Info> | |
| 16 | - System message tools are experimental and may change in future releases. | |
| 17 | -</Info> | |
| 18 | - | |
| 19 | 15 | Continue implements an innovative approach called **system message tools** that ensures consistent tool functionality across all models, regardless of their native capabilities. This allows Agent mode to work seamlessly with a wider range of models and providers. |
| 20 | 16 | |
| 21 | 17 | ### How System Message Tools Function |
modified gui/src/components/ModeSelect/ModeSelect.tsx +9 −44
| @@ -5,14 +5,10 @@ | ||
| 5 | 5 | InformationCircleIcon, |
| 6 | 6 | } from "@heroicons/react/24/outline"; |
| 7 | 7 | import { MessageModes } from "core"; |
| 8 | -import { | |
| 9 | - isRecommendedAgentModel, | |
| 10 | - modelSupportsNativeTools, | |
| 11 | -} from "core/llm/toolSupport"; | |
| 8 | +import { isRecommendedAgentModel } from "core/llm/toolSupport"; | |
| 12 | 9 | import { capitalize } from "lodash"; |
| 13 | 10 | import { useCallback, useEffect, useMemo } from "react"; |
| 14 | 11 | import { useAppDispatch, useAppSelector } from "../../redux/hooks"; |
| 15 | -import { selectUseSystemMessageTools } from "../../redux/selectors/selectUseSystemMessageTools"; | |
| 16 | 12 | import { selectSelectedChatModel } from "../../redux/slices/configSlice"; |
| 17 | 13 | import { setMode } from "../../redux/slices/sessionSlice"; |
| 18 | 14 | import { getFontSize, getMetaKeyLabel } from "../../util"; |
| @@ -25,14 +21,6 @@ | ||
| 25 | 21 | const dispatch = useAppDispatch(); |
| 26 | 22 | const mode = useAppSelector((store) => store.session.mode); |
| 27 | 23 | const selectedModel = useAppSelector(selectSelectedChatModel); |
| 28 | - const useSystemTools = useAppSelector(selectUseSystemMessageTools); | |
| 29 | - | |
| 30 | - const isAgentSupported = useMemo(() => { | |
| 31 | - if (!selectedModel) { | |
| 32 | - return undefined; | |
| 33 | - } | |
| 34 | - return !!useSystemTools || modelSupportsNativeTools(selectedModel); | |
| 35 | - }, [selectedModel, useSystemTools]); | |
| 36 | 24 | |
| 37 | 25 | const isGoodAtAgentMode = useMemo(() => { |
| 38 | 26 | if (!selectedModel) { |
| @@ -46,16 +34,6 @@ | ||
| 46 | 34 | return getMetaKeyLabel(); |
| 47 | 35 | }, []); |
| 48 | 36 | |
| 49 | - // Switch to chat mode if agent mode is selected but not supported | |
| 50 | - useEffect(() => { | |
| 51 | - if (!selectedModel) { | |
| 52 | - return; | |
| 53 | - } | |
| 54 | - if (mode !== "chat" && !isAgentSupported) { | |
| 55 | - dispatch(setMode("chat")); | |
| 56 | - } | |
| 57 | - }, [mode, isAgentSupported, selectedModel]); | |
| 58 | - | |
| 59 | 37 | const cycleMode = useCallback(() => { |
| 60 | 38 | if (mode === "chat") { |
| 61 | 39 | dispatch(setMode("plan")); |
| @@ -95,7 +73,6 @@ | ||
| 95 | 73 | return () => document.removeEventListener("keydown", handleKeyDown); |
| 96 | 74 | }, [cycleMode]); |
| 97 | 75 | |
| 98 | - const notSupported = <span>(Not supported)</span>; | |
| 99 | 76 | const notGreatAtAgent = ( |
| 100 | 77 | <> |
| 101 | 78 | <ExclamationTriangleIcon |
| @@ -172,16 +149,10 @@ | ||
| 172 | 149 | Read-only/MCP tools available |
| 173 | 150 | </ToolTip> |
| 174 | 151 | </div> |
| 175 | - {isAgentSupported ? ( | |
| 176 | - <> | |
| 177 | - {!isGoodAtAgentMode && notGreatAtAgent} | |
| 178 | - <CheckIcon | |
| 179 | - className={`ml-auto h-3 w-3 ${mode === "plan" ? "" : "opacity-0"}`} | |
| 180 | - /> | |
| 181 | - </> | |
| 182 | - ) : ( | |
| 183 | - notSupported | |
| 184 | - )} | |
| 152 | + {!isGoodAtAgentMode && notGreatAtAgent} | |
| 153 | + <CheckIcon | |
| 154 | + className={`ml-auto h-3 w-3 ${mode === "plan" ? "" : "opacity-0"}`} | |
| 155 | + /> | |
| 185 | 156 | </ListboxOption> |
| 186 | 157 | |
| 187 | 158 | <ListboxOption value="agent" className={"gap-1"}> |
| @@ -201,16 +172,10 @@ | ||
| 201 | 172 | All tools available |
| 202 | 173 | </ToolTip> |
| 203 | 174 | </div> |
| 204 | - {isAgentSupported ? ( | |
| 205 | - <> | |
| 206 | - {!isGoodAtAgentMode && notGreatAtAgent} | |
| 207 | - <CheckIcon | |
| 208 | - className={`ml-auto h-3 w-3 ${mode === "agent" ? "" : "opacity-0"}`} | |
| 209 | - /> | |
| 210 | - </> | |
| 211 | - ) : ( | |
| 212 | - notSupported | |
| 213 | - )} | |
| 175 | + {!isGoodAtAgentMode && notGreatAtAgent} | |
| 176 | + <CheckIcon | |
| 177 | + className={`ml-auto h-3 w-3 ${mode === "agent" ? "" : "opacity-0"}`} | |
| 178 | + /> | |
| 214 | 179 | </ListboxOption> |
| 215 | 180 | |
| 216 | 181 | <div className="text-description-muted px-2 py-1"> |
deleted gui/src/redux/selectors/selectUseSystemMessageTools.test.ts +0 −112
| @@ -1,112 +0,0 @@ | ||
| 1 | -import { ModelDescription } from "core"; | |
| 2 | -import { describe, expect, test, vi } from "vitest"; | |
| 3 | -import { RootState } from "../store"; | |
| 4 | - | |
| 5 | -// Mock the shouldAutoEnableSystemMessageTools function | |
| 6 | -vi.mock("core/config/shouldAutoEnableSystemMessageTools", () => ({ | |
| 7 | - shouldAutoEnableSystemMessageTools: vi.fn((model: ModelDescription) => { | |
| 8 | - if (model.provider === "openrouter") { | |
| 9 | - return !model.model.toLowerCase().includes("claude"); | |
| 10 | - } | |
| 11 | - return undefined; // No auto-preference for other providers | |
| 12 | - }), | |
| 13 | -})); | |
| 14 | - | |
| 15 | -// Mock the selectSelectedChatModel selector - we'll control its return value in tests | |
| 16 | -vi.mock("../slices/configSlice", () => ({ | |
| 17 | - selectSelectedChatModel: vi.fn(), | |
| 18 | -})); | |
| 19 | - | |
| 20 | -// Import after mocking | |
| 21 | -import { selectSelectedChatModel } from "../slices/configSlice"; | |
| 22 | -import { selectUseSystemMessageTools } from "./selectUseSystemMessageTools"; | |
| 23 | - | |
| 24 | -describe("selectUseSystemMessageTools", () => { | |
| 25 | - const mockSelectSelectedChatModel = selectSelectedChatModel as any; | |
| 26 | - | |
| 27 | - const createMockState = (manualSetting?: boolean): RootState => { | |
| 28 | - return { | |
| 29 | - config: { | |
| 30 | - config: { | |
| 31 | - experimental: { | |
| 32 | - onlyUseSystemMessageTools: manualSetting, | |
| 33 | - }, | |
| 34 | - }, | |
| 35 | - }, | |
| 36 | - } as any; | |
| 37 | - }; | |
| 38 | - | |
| 39 | - const createModel = (provider: string, model: string): ModelDescription => ({ | |
| 40 | - title: "Test Model", | |
| 41 | - provider, | |
| 42 | - underlyingProviderName: provider, | |
| 43 | - model, | |
| 44 | - }); | |
| 45 | - | |
| 46 | - test("auto-detection takes priority: OpenRouter non-Claude returns true even with manual false", () => { | |
| 47 | - mockSelectSelectedChatModel.mockReturnValue( | |
| 48 | - createModel("openrouter", "gpt-4"), | |
| 49 | - ); | |
| 50 | - const state = createMockState(false); | |
| 51 | - expect(selectUseSystemMessageTools(state)).toBe(true); | |
| 52 | - }); | |
| 53 | - | |
| 54 | - test("auto-detection takes priority: OpenRouter Claude returns false even with manual true", () => { | |
| 55 | - mockSelectSelectedChatModel.mockReturnValue( | |
| 56 | - createModel("openrouter", "claude-3.5-sonnet"), | |
| 57 | - ); | |
| 58 | - const state = createMockState(true); | |
| 59 | - expect(selectUseSystemMessageTools(state)).toBe(false); | |
| 60 | - }); | |
| 61 | - | |
| 62 | - test("falls back to manual setting when no auto-preference: manual true", () => { | |
| 63 | - mockSelectSelectedChatModel.mockReturnValue(createModel("openai", "gpt-4")); | |
| 64 | - const state = createMockState(true); | |
| 65 | - expect(selectUseSystemMessageTools(state)).toBe(true); | |
| 66 | - }); | |
| 67 | - | |
| 68 | - test("falls back to manual setting when no auto-preference: manual false", () => { | |
| 69 | - mockSelectSelectedChatModel.mockReturnValue( | |
| 70 | - createModel("anthropic", "claude-3.5-sonnet"), | |
| 71 | - ); | |
| 72 | - const state = createMockState(false); | |
| 73 | - expect(selectUseSystemMessageTools(state)).toBe(false); | |
| 74 | - }); | |
| 75 | - | |
| 76 | - test("defaults to false when no auto-preference and no manual setting", () => { | |
| 77 | - mockSelectSelectedChatModel.mockReturnValue( | |
| 78 | - createModel("groq", "llama-3.3-70b"), | |
| 79 | - ); | |
| 80 | - const state = createMockState(undefined); | |
| 81 | - expect(selectUseSystemMessageTools(state)).toBe(false); | |
| 82 | - }); | |
| 83 | - | |
| 84 | - test("handles missing selected model: uses manual setting", () => { | |
| 85 | - mockSelectSelectedChatModel.mockReturnValue(undefined); | |
| 86 | - const state = createMockState(true); | |
| 87 | - expect(selectUseSystemMessageTools(state)).toBe(true); | |
| 88 | - }); | |
| 89 | - | |
| 90 | - test("handles missing selected model: defaults to false when no manual setting", () => { | |
| 91 | - mockSelectSelectedChatModel.mockReturnValue(undefined); | |
| 92 | - const state = createMockState(undefined); | |
| 93 | - expect(selectUseSystemMessageTools(state)).toBe(false); | |
| 94 | - }); | |
| 95 | - | |
| 96 | - test("auto-enable works for various OpenRouter models", () => { | |
| 97 | - mockSelectSelectedChatModel.mockReturnValue( | |
| 98 | - createModel("openrouter", "gpt-4o"), | |
| 99 | - ); | |
| 100 | - expect(selectUseSystemMessageTools(createMockState(false))).toBe(true); | |
| 101 | - | |
| 102 | - mockSelectSelectedChatModel.mockReturnValue( | |
| 103 | - createModel("openrouter", "llama-3.3-70b"), | |
| 104 | - ); | |
| 105 | - expect(selectUseSystemMessageTools(createMockState(false))).toBe(true); | |
| 106 | - | |
| 107 | - mockSelectSelectedChatModel.mockReturnValue( | |
| 108 | - createModel("openrouter", "claude-haiku"), | |
| 109 | - ); | |
| 110 | - expect(selectUseSystemMessageTools(createMockState(true))).toBe(false); | |
| 111 | - }); | |
| 112 | -}); |
deleted gui/src/redux/selectors/selectUseSystemMessageTools.ts +0 −37
| @@ -1,37 +0,0 @@ | ||
| 1 | -import { shouldAutoEnableSystemMessageTools } from "core/config/shouldAutoEnableSystemMessageTools"; | |
| 2 | -import { selectSelectedChatModel } from "../slices/configSlice"; | |
| 3 | -import { RootState } from "../store"; | |
| 4 | - | |
| 5 | -/** | |
| 6 | - * Selector that determines if system message tools should be used. | |
| 7 | - * This prioritizes auto-detection over manual configuration where we have a strong preference. | |
| 8 | - * | |
| 9 | - * Priority order: | |
| 10 | - * 1. Auto-detection (if it returns true/false) | |
| 11 | - * 2. Manual user configuration (if auto-detection returns undefined) | |
| 12 | - * 3. Default to false | |
| 13 | - * | |
| 14 | - * @param state The Redux root state | |
| 15 | - * @returns true if system message tools should be used, false otherwise | |
| 16 | - */ | |
| 17 | -export function selectUseSystemMessageTools(state: RootState): boolean { | |
| 18 | - const selectedModel = selectSelectedChatModel(state); | |
| 19 | - const manualSetting = | |
| 20 | - state.config.config.experimental?.onlyUseSystemMessageTools; | |
| 21 | - | |
| 22 | - // If no model is selected, fall back to manual setting or default | |
| 23 | - if (!selectedModel) { | |
| 24 | - return manualSetting ?? false; | |
| 25 | - } | |
| 26 | - | |
| 27 | - // Check auto-detection first | |
| 28 | - const autoSetting = shouldAutoEnableSystemMessageTools(selectedModel); | |
| 29 | - | |
| 30 | - // If auto-detection has a preference, use it (takes priority) | |
| 31 | - if (autoSetting !== undefined) { | |
| 32 | - return autoSetting; | |
| 33 | - } | |
| 34 | - | |
| 35 | - // If no auto-preference, use manual setting or default to false | |
| 36 | - return manualSetting ?? false; | |
| 37 | -} |
modified gui/src/redux/thunks/streamNormalInput.ts +5 −6
| @@ -3,7 +3,6 @@ | ||
| 3 | 3 | import { getRuleId } from "core/llm/rules/getSystemMessageWithRules"; |
| 4 | 4 | import { ToCoreProtocol } from "core/protocol"; |
| 5 | 5 | import { selectActiveTools } from "../selectors/selectActiveTools"; |
| 6 | -import { selectUseSystemMessageTools } from "../selectors/selectUseSystemMessageTools"; | |
| 7 | 6 | import { selectSelectedChatModel } from "../slices/configSlice"; |
| 8 | 7 | import { |
| 9 | 8 | abortStream, |
| @@ -105,12 +104,12 @@ | ||
| 105 | 104 | // Get tools and filter them based on the selected model |
| 106 | 105 | const activeTools = selectActiveTools(state); |
| 107 | 106 | |
| 108 | - const supportsNativeTools = modelSupportsNativeTools(selectedChatModel); | |
| 109 | - | |
| 110 | 107 | // Use the centralized selector to determine if system message tools should be used |
| 111 | - const useSystemTools = selectUseSystemMessageTools(state); | |
| 112 | - const useNativeTools = !useSystemTools && supportsNativeTools; | |
| 113 | - const systemToolsFramework = useSystemTools | |
| 108 | + const useNativeTools = state.config.config.experimental | |
| 109 | + ?.onlyUseSystemMessageTools | |
| 110 | + ? false | |
| 111 | + : modelSupportsNativeTools(selectedChatModel); | |
| 112 | + const systemToolsFramework = !useNativeTools | |
| 114 | 113 | ? new SystemMessageToolCodeblocksFramework() |
| 115 | 114 | : undefined; |
| 116 | 115 |