Skip to content

Commit 291e195

Browse files
committed
Enable parallel tool calls by default
- Remove multipleNativeToolCalls experiment - Set parallelToolCalls default to true across all providers - Remove didAlreadyUseTool enforcement in presentAssistantMessage - Update convertOpenAIToolChoiceToAnthropic to enable parallel by default - Update all tests to expect parallel tool calling - Remove MULTIPLE_NATIVE_TOOL_CALLS from i18n locale files
1 parent c30924e commit 291e195

File tree

66 files changed

+158
-587
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+158
-587
lines changed

packages/types/src/experiment.ts

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,7 @@ import type { Keys, Equals, AssertEqual } from "./type-fu.js"
66
* ExperimentId
77
*/
88

9-
export const experimentIds = [
10-
"preventFocusDisruption",
11-
"imageGeneration",
12-
"runSlashCommand",
13-
"multipleNativeToolCalls",
14-
"customTools",
15-
] as const
9+
export const experimentIds = ["preventFocusDisruption", "imageGeneration", "runSlashCommand", "customTools"] as const
1610

1711
export const experimentIdsSchema = z.enum(experimentIds)
1812

@@ -26,7 +20,6 @@ export const experimentsSchema = z.object({
2620
preventFocusDisruption: z.boolean().optional(),
2721
imageGeneration: z.boolean().optional(),
2822
runSlashCommand: z.boolean().optional(),
29-
multipleNativeToolCalls: z.boolean().optional(),
3023
customTools: z.boolean().optional(),
3124
})
3225

src/api/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,8 @@ export interface ApiHandlerCreateMessageMetadata {
8484
tool_choice?: OpenAI.Chat.ChatCompletionCreateParams["tool_choice"]
8585
/**
8686
* Controls whether the model can return multiple tool calls in a single response.
87-
* When true, parallel tool calls are enabled (OpenAI's parallel_tool_calls=true).
88-
* When false (default), only one tool call is returned per response.
87+
* When true (default), parallel tool calls are enabled (OpenAI's parallel_tool_calls=true).
88+
* When false, only one tool call is returned per response.
8989
*/
9090
parallelToolCalls?: boolean
9191
/**

src/api/providers/__tests__/anthropic-vertex.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1197,7 +1197,7 @@ describe("VertexHandler", () => {
11971197
}),
11981198
}),
11991199
]),
1200-
tool_choice: { type: "auto", disable_parallel_tool_use: true },
1200+
tool_choice: { type: "auto", disable_parallel_tool_use: false },
12011201
}),
12021202
undefined,
12031203
)

src/api/providers/__tests__/anthropic.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -514,7 +514,7 @@ describe("AnthropicHandler", () => {
514514

515515
expect(mockCreate).toHaveBeenCalledWith(
516516
expect.objectContaining({
517-
tool_choice: { type: "auto", disable_parallel_tool_use: true },
517+
tool_choice: { type: "auto", disable_parallel_tool_use: false },
518518
}),
519519
expect.anything(),
520520
)
@@ -535,7 +535,7 @@ describe("AnthropicHandler", () => {
535535

536536
expect(mockCreate).toHaveBeenCalledWith(
537537
expect.objectContaining({
538-
tool_choice: { type: "any", disable_parallel_tool_use: true },
538+
tool_choice: { type: "any", disable_parallel_tool_use: false },
539539
}),
540540
expect.anything(),
541541
)
@@ -581,7 +581,7 @@ describe("AnthropicHandler", () => {
581581

582582
expect(mockCreate).toHaveBeenCalledWith(
583583
expect.objectContaining({
584-
tool_choice: { type: "tool", name: "get_weather", disable_parallel_tool_use: true },
584+
tool_choice: { type: "tool", name: "get_weather", disable_parallel_tool_use: false },
585585
}),
586586
expect.anything(),
587587
)

src/api/providers/__tests__/deepinfra.spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -214,9 +214,9 @@ describe("DeepInfraHandler", () => {
214214
]),
215215
}),
216216
)
217-
// parallel_tool_calls should be false when not explicitly set
217+
// parallel_tool_calls should be true by default when not explicitly set
218218
const callArgs = mockCreate.mock.calls[0][0]
219-
expect(callArgs).toHaveProperty("parallel_tool_calls", false)
219+
expect(callArgs).toHaveProperty("parallel_tool_calls", true)
220220
})
221221

222222
it("should include tool_choice when provided", async () => {
@@ -264,8 +264,8 @@ describe("DeepInfraHandler", () => {
264264
// Tools are now always present (minimum 6 from ALWAYS_AVAILABLE_TOOLS)
265265
expect(callArgs).toHaveProperty("tools")
266266
expect(callArgs).toHaveProperty("tool_choice")
267-
// parallel_tool_calls should be false when not explicitly set
268-
expect(callArgs).toHaveProperty("parallel_tool_calls", false)
267+
// parallel_tool_calls should be true by default when not explicitly set
268+
expect(callArgs).toHaveProperty("parallel_tool_calls", true)
269269
})
270270

271271
it("should yield tool_call_partial chunks during streaming", async () => {

src/api/providers/__tests__/lmstudio-native-tools.spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,9 @@ describe("LmStudioHandler Native Tools", () => {
8282
]),
8383
}),
8484
)
85-
// parallel_tool_calls should be false when not explicitly set
85+
// parallel_tool_calls should be true by default when not explicitly set
8686
const callArgs = mockCreate.mock.calls[0][0]
87-
expect(callArgs).toHaveProperty("parallel_tool_calls", false)
87+
expect(callArgs).toHaveProperty("parallel_tool_calls", true)
8888
})
8989

9090
it("should include tool_choice when provided", async () => {
@@ -128,8 +128,8 @@ describe("LmStudioHandler Native Tools", () => {
128128
// Tools are now always present (minimum 6 from ALWAYS_AVAILABLE_TOOLS)
129129
expect(callArgs).toHaveProperty("tools")
130130
expect(callArgs).toHaveProperty("tool_choice")
131-
// parallel_tool_calls should be false when not explicitly set
132-
expect(callArgs).toHaveProperty("parallel_tool_calls", false)
131+
// parallel_tool_calls should be true by default when not explicitly set
132+
expect(callArgs).toHaveProperty("parallel_tool_calls", true)
133133
})
134134

135135
it("should yield tool_call_partial chunks during streaming", async () => {

src/api/providers/__tests__/openai-native-tools.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ describe("OpenAiHandler native tools", () => {
6161
function: expect.objectContaining({ name: "test_tool" }),
6262
}),
6363
]),
64-
parallel_tool_calls: false,
64+
parallel_tool_calls: true,
6565
}),
6666
expect.anything(),
6767
)

src/api/providers/__tests__/openai.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -635,7 +635,7 @@ describe("OpenAiHandler", () => {
635635
temperature: 0,
636636
tools: undefined,
637637
tool_choice: undefined,
638-
parallel_tool_calls: false,
638+
parallel_tool_calls: true,
639639
},
640640
{ path: "/models/chat/completions" },
641641
)
@@ -684,7 +684,7 @@ describe("OpenAiHandler", () => {
684684
],
685685
tools: undefined,
686686
tool_choice: undefined,
687-
parallel_tool_calls: false,
687+
parallel_tool_calls: true,
688688
},
689689
{ path: "/models/chat/completions" },
690690
)

src/api/providers/__tests__/qwen-code-native-tools.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ describe("QwenCodeHandler Native Tools", () => {
9999
}),
100100
}),
101101
]),
102-
parallel_tool_calls: false,
102+
parallel_tool_calls: true,
103103
}),
104104
)
105105
})
@@ -145,7 +145,7 @@ describe("QwenCodeHandler Native Tools", () => {
145145
const callArgs = mockCreate.mock.calls[mockCreate.mock.calls.length - 1][0]
146146
expect(callArgs).toHaveProperty("tools")
147147
expect(callArgs).toHaveProperty("tool_choice")
148-
expect(callArgs).toHaveProperty("parallel_tool_calls", false)
148+
expect(callArgs).toHaveProperty("parallel_tool_calls", true)
149149
})
150150

151151
it("should yield tool_call_partial chunks during streaming", async () => {

src/api/providers/__tests__/unbound.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ describe("UnboundHandler", () => {
375375
}),
376376
}),
377377
]),
378-
parallel_tool_calls: false,
378+
parallel_tool_calls: true,
379379
}),
380380
expect.objectContaining({
381381
headers: {
@@ -435,7 +435,7 @@ describe("UnboundHandler", () => {
435435
const callArgs = mockCreate.mock.calls[mockCreate.mock.calls.length - 1][0]
436436
expect(callArgs).toHaveProperty("tools")
437437
expect(callArgs).toHaveProperty("tool_choice")
438-
expect(callArgs).toHaveProperty("parallel_tool_calls", false)
438+
expect(callArgs).toHaveProperty("parallel_tool_calls", true)
439439
})
440440

441441
it("should yield tool_call_partial chunks during streaming", async () => {

0 commit comments

Comments
 (0)