Elffuss BraidHub

kikocis/continue public

8eb3ae7b8d16 · 1.4 KiBRawPermalink
1import { 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 */
21export 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}