Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 1 addition & 8 deletions packages/types/src/experiment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,7 @@ import type { Keys, Equals, AssertEqual } from "./type-fu.js"
* ExperimentId
*/

export const experimentIds = [
"preventFocusDisruption",
"imageGeneration",
"runSlashCommand",
"multipleNativeToolCalls",
"customTools",
] as const
export const experimentIds = ["preventFocusDisruption", "imageGeneration", "runSlashCommand", "customTools"] as const

export const experimentIdsSchema = z.enum(experimentIds)

Expand All @@ -26,7 +20,6 @@ export const experimentsSchema = z.object({
preventFocusDisruption: z.boolean().optional(),
imageGeneration: z.boolean().optional(),
runSlashCommand: z.boolean().optional(),
multipleNativeToolCalls: z.boolean().optional(),
customTools: z.boolean().optional(),
})

Expand Down
4 changes: 2 additions & 2 deletions src/api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ export interface ApiHandlerCreateMessageMetadata {
tool_choice?: OpenAI.Chat.ChatCompletionCreateParams["tool_choice"]
/**
* Controls whether the model can return multiple tool calls in a single response.
* When true, parallel tool calls are enabled (OpenAI's parallel_tool_calls=true).
* When false (default), only one tool call is returned per response.
* When true (default), parallel tool calls are enabled (OpenAI's parallel_tool_calls=true).
* When false, only one tool call is returned per response.
*/
parallelToolCalls?: boolean
/**
Expand Down
2 changes: 1 addition & 1 deletion src/api/providers/__tests__/anthropic-vertex.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1197,7 +1197,7 @@ describe("VertexHandler", () => {
}),
}),
]),
tool_choice: { type: "auto", disable_parallel_tool_use: true },
tool_choice: { type: "auto", disable_parallel_tool_use: false },
}),
undefined,
)
Expand Down
6 changes: 3 additions & 3 deletions src/api/providers/__tests__/anthropic.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,7 @@ describe("AnthropicHandler", () => {

expect(mockCreate).toHaveBeenCalledWith(
expect.objectContaining({
tool_choice: { type: "auto", disable_parallel_tool_use: true },
tool_choice: { type: "auto", disable_parallel_tool_use: false },
}),
expect.anything(),
)
Expand All @@ -535,7 +535,7 @@ describe("AnthropicHandler", () => {

expect(mockCreate).toHaveBeenCalledWith(
expect.objectContaining({
tool_choice: { type: "any", disable_parallel_tool_use: true },
tool_choice: { type: "any", disable_parallel_tool_use: false },
}),
expect.anything(),
)
Expand Down Expand Up @@ -581,7 +581,7 @@ describe("AnthropicHandler", () => {

expect(mockCreate).toHaveBeenCalledWith(
expect.objectContaining({
tool_choice: { type: "tool", name: "get_weather", disable_parallel_tool_use: true },
tool_choice: { type: "tool", name: "get_weather", disable_parallel_tool_use: false },
}),
expect.anything(),
)
Expand Down
8 changes: 4 additions & 4 deletions src/api/providers/__tests__/deepinfra.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -214,9 +214,9 @@ describe("DeepInfraHandler", () => {
]),
}),
)
// parallel_tool_calls should be false when not explicitly set
// parallel_tool_calls should be true by default when not explicitly set
const callArgs = mockCreate.mock.calls[0][0]
expect(callArgs).toHaveProperty("parallel_tool_calls", false)
expect(callArgs).toHaveProperty("parallel_tool_calls", true)
})

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

it("should yield tool_call_partial chunks during streaming", async () => {
Expand Down
8 changes: 4 additions & 4 deletions src/api/providers/__tests__/lmstudio-native-tools.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,9 @@ describe("LmStudioHandler Native Tools", () => {
]),
}),
)
// parallel_tool_calls should be false when not explicitly set
// parallel_tool_calls should be true by default when not explicitly set
const callArgs = mockCreate.mock.calls[0][0]
expect(callArgs).toHaveProperty("parallel_tool_calls", false)
expect(callArgs).toHaveProperty("parallel_tool_calls", true)
})

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

it("should yield tool_call_partial chunks during streaming", async () => {
Expand Down
2 changes: 1 addition & 1 deletion src/api/providers/__tests__/openai-native-tools.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ describe("OpenAiHandler native tools", () => {
function: expect.objectContaining({ name: "test_tool" }),
}),
]),
parallel_tool_calls: false,
parallel_tool_calls: true,
}),
expect.anything(),
)
Expand Down
4 changes: 2 additions & 2 deletions src/api/providers/__tests__/openai.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -635,7 +635,7 @@ describe("OpenAiHandler", () => {
temperature: 0,
tools: undefined,
tool_choice: undefined,
parallel_tool_calls: false,
parallel_tool_calls: true,
},
{ path: "/models/chat/completions" },
)
Expand Down Expand Up @@ -684,7 +684,7 @@ describe("OpenAiHandler", () => {
],
tools: undefined,
tool_choice: undefined,
parallel_tool_calls: false,
parallel_tool_calls: true,
},
{ path: "/models/chat/completions" },
)
Expand Down
4 changes: 2 additions & 2 deletions src/api/providers/__tests__/qwen-code-native-tools.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ describe("QwenCodeHandler Native Tools", () => {
}),
}),
]),
parallel_tool_calls: false,
parallel_tool_calls: true,
}),
)
})
Expand Down Expand Up @@ -145,7 +145,7 @@ describe("QwenCodeHandler Native Tools", () => {
const callArgs = mockCreate.mock.calls[mockCreate.mock.calls.length - 1][0]
expect(callArgs).toHaveProperty("tools")
expect(callArgs).toHaveProperty("tool_choice")
expect(callArgs).toHaveProperty("parallel_tool_calls", false)
expect(callArgs).toHaveProperty("parallel_tool_calls", true)
})

it("should yield tool_call_partial chunks during streaming", async () => {
Expand Down
4 changes: 2 additions & 2 deletions src/api/providers/__tests__/unbound.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ describe("UnboundHandler", () => {
}),
}),
]),
parallel_tool_calls: false,
parallel_tool_calls: true,
}),
expect.objectContaining({
headers: {
Expand Down Expand Up @@ -435,7 +435,7 @@ describe("UnboundHandler", () => {
const callArgs = mockCreate.mock.calls[mockCreate.mock.calls.length - 1][0]
expect(callArgs).toHaveProperty("tools")
expect(callArgs).toHaveProperty("tool_choice")
expect(callArgs).toHaveProperty("parallel_tool_calls", false)
expect(callArgs).toHaveProperty("parallel_tool_calls", true)
})

it("should yield tool_call_partial chunks during streaming", async () => {
Expand Down
4 changes: 2 additions & 2 deletions src/api/providers/__tests__/vercel-ai-gateway.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ describe("VercelAiGatewayHandler", () => {
)
})

it("should include parallel_tool_calls: false by default", async () => {
it("should include parallel_tool_calls: true by default", async () => {
const handler = new VercelAiGatewayHandler(mockOptions)

const messageGenerator = handler.createMessage("test prompt", [], {
Expand All @@ -378,7 +378,7 @@ describe("VercelAiGatewayHandler", () => {
expect(mockCreate).toHaveBeenCalledWith(
expect.objectContaining({
tools: expect.any(Array),
parallel_tool_calls: false,
parallel_tool_calls: true,
}),
)
})
Expand Down
4 changes: 2 additions & 2 deletions src/api/providers/__tests__/xai.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ describe("XAIHandler", () => {
}),
}),
]),
parallel_tool_calls: false,
parallel_tool_calls: true,
}),
)
})
Expand Down Expand Up @@ -393,7 +393,7 @@ describe("XAIHandler", () => {
const callArgs = mockCreate.mock.calls[mockCreate.mock.calls.length - 1][0]
expect(callArgs).toHaveProperty("tools")
expect(callArgs).toHaveProperty("tool_choice")
expect(callArgs).toHaveProperty("parallel_tool_calls", false)
expect(callArgs).toHaveProperty("parallel_tool_calls", true)
})

it("should yield tool_call_partial chunks during streaming", async () => {
Expand Down
2 changes: 1 addition & 1 deletion src/api/providers/base-openai-compatible-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ export abstract class BaseOpenAiCompatibleProvider<ModelName extends string>
stream_options: { include_usage: true },
tools: this.convertToolsForOpenAI(metadata?.tools),
tool_choice: metadata?.tool_choice,
parallel_tool_calls: metadata?.parallelToolCalls ?? false,
parallel_tool_calls: metadata?.parallelToolCalls ?? true,
}

// Add thinking parameter if reasoning is enabled and model supports it
Expand Down
2 changes: 1 addition & 1 deletion src/api/providers/cerebras.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ export class CerebrasHandler extends BaseProvider implements SingleCompletionHan
// Native tool calling support
tools: this.convertToolsForOpenAI(metadata?.tools),
tool_choice: metadata?.tool_choice,
parallel_tool_calls: metadata?.parallelToolCalls ?? false,
parallel_tool_calls: metadata?.parallelToolCalls ?? true,
}

try {
Expand Down
2 changes: 1 addition & 1 deletion src/api/providers/deepinfra.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export class DeepInfraHandler extends RouterProvider implements SingleCompletion
prompt_cache_key,
tools: this.convertToolsForOpenAI(_metadata?.tools),
tool_choice: _metadata?.tool_choice,
parallel_tool_calls: _metadata?.parallelToolCalls ?? false,
parallel_tool_calls: _metadata?.parallelToolCalls ?? true,
} as OpenAI.Chat.Completions.ChatCompletionCreateParamsStreaming

if (this.supportsTemperature(modelId)) {
Expand Down
2 changes: 1 addition & 1 deletion src/api/providers/deepseek.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export class DeepSeekHandler extends OpenAiHandler {
...(isThinkingModel && { thinking: { type: "enabled" } }),
tools: this.convertToolsForOpenAI(metadata?.tools),
tool_choice: metadata?.tool_choice,
parallel_tool_calls: metadata?.parallelToolCalls ?? false,
parallel_tool_calls: metadata?.parallelToolCalls ?? true,
}

// Add max_tokens if needed
Expand Down
2 changes: 1 addition & 1 deletion src/api/providers/lm-studio.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ export class LmStudioHandler extends BaseProvider implements SingleCompletionHan
stream: true,
tools: this.convertToolsForOpenAI(metadata?.tools),
tool_choice: metadata?.tool_choice,
parallel_tool_calls: metadata?.parallelToolCalls ?? false,
parallel_tool_calls: metadata?.parallelToolCalls ?? true,
}

if (this.options.lmStudioSpeculativeDecodingEnabled && this.options.lmStudioDraftModelId) {
Expand Down
2 changes: 1 addition & 1 deletion src/api/providers/openai-codex.ts
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ export class OpenAiCodexHandler extends BaseProvider implements SingleCompletion
}
}),
tool_choice: metadata?.tool_choice,
parallel_tool_calls: metadata?.parallelToolCalls ?? false,
parallel_tool_calls: metadata?.parallelToolCalls ?? true,
}

return body
Expand Down
2 changes: 1 addition & 1 deletion src/api/providers/openai-native.ts
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ export class OpenAiNativeHandler extends BaseProvider implements SingleCompletio
}
}),
tool_choice: metadata?.tool_choice,
parallel_tool_calls: metadata?.parallelToolCalls ?? false,
parallel_tool_calls: metadata?.parallelToolCalls ?? true,
}

// Include text.verbosity only when the model explicitly supports it
Expand Down
8 changes: 4 additions & 4 deletions src/api/providers/openai.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ export class OpenAiHandler extends BaseProvider implements SingleCompletionHandl
...(reasoning && reasoning),
tools: this.convertToolsForOpenAI(metadata?.tools),
tool_choice: metadata?.tool_choice,
parallel_tool_calls: metadata?.parallelToolCalls ?? false,
parallel_tool_calls: metadata?.parallelToolCalls ?? true,
}

// Add max_tokens if needed
Expand Down Expand Up @@ -229,7 +229,7 @@ export class OpenAiHandler extends BaseProvider implements SingleCompletionHandl
// Tools are always present (minimum ALWAYS_AVAILABLE_TOOLS)
tools: this.convertToolsForOpenAI(metadata?.tools),
tool_choice: metadata?.tool_choice,
parallel_tool_calls: metadata?.parallelToolCalls ?? false,
parallel_tool_calls: metadata?.parallelToolCalls ?? true,
}

// Add max_tokens if needed
Expand Down Expand Up @@ -348,7 +348,7 @@ export class OpenAiHandler extends BaseProvider implements SingleCompletionHandl
// Tools are always present (minimum ALWAYS_AVAILABLE_TOOLS)
tools: this.convertToolsForOpenAI(metadata?.tools),
tool_choice: metadata?.tool_choice,
parallel_tool_calls: metadata?.parallelToolCalls ?? false,
parallel_tool_calls: metadata?.parallelToolCalls ?? true,
}

// O3 family models do not support the deprecated max_tokens parameter
Expand Down Expand Up @@ -382,7 +382,7 @@ export class OpenAiHandler extends BaseProvider implements SingleCompletionHandl
// Tools are always present (minimum ALWAYS_AVAILABLE_TOOLS)
tools: this.convertToolsForOpenAI(metadata?.tools),
tool_choice: metadata?.tool_choice,
parallel_tool_calls: metadata?.parallelToolCalls ?? false,
parallel_tool_calls: metadata?.parallelToolCalls ?? true,
}

// O3 family models do not support the deprecated max_tokens parameter
Expand Down
2 changes: 1 addition & 1 deletion src/api/providers/qwen-code.ts
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ export class QwenCodeHandler extends BaseProvider implements SingleCompletionHan
max_completion_tokens: model.info.maxTokens,
tools: this.convertToolsForOpenAI(metadata?.tools),
tool_choice: metadata?.tool_choice,
parallel_tool_calls: metadata?.parallelToolCalls ?? false,
parallel_tool_calls: metadata?.parallelToolCalls ?? true,
}

const stream = await this.callApiWithRetry(() => client.chat.completions.create(requestOptions))
Expand Down
2 changes: 1 addition & 1 deletion src/api/providers/unbound.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ export class UnboundHandler extends RouterProvider implements SingleCompletionHa
},
tools: this.convertToolsForOpenAI(metadata?.tools),
tool_choice: metadata?.tool_choice,
parallel_tool_calls: metadata?.parallelToolCalls ?? false,
parallel_tool_calls: metadata?.parallelToolCalls ?? true,
}

if (this.supportsTemperature(modelId)) {
Expand Down
2 changes: 1 addition & 1 deletion src/api/providers/vercel-ai-gateway.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export class VercelAiGatewayHandler extends RouterProvider implements SingleComp
stream_options: { include_usage: true },
tools: this.convertToolsForOpenAI(metadata?.tools),
tool_choice: metadata?.tool_choice,
parallel_tool_calls: metadata?.parallelToolCalls ?? false,
parallel_tool_calls: metadata?.parallelToolCalls ?? true,
}

const completion = await this.client.chat.completions.create(body)
Expand Down
2 changes: 1 addition & 1 deletion src/api/providers/xai.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export class XAIHandler extends BaseProvider implements SingleCompletionHandler
...(reasoning && reasoning),
tools: this.convertToolsForOpenAI(metadata?.tools),
tool_choice: metadata?.tool_choice,
parallel_tool_calls: metadata?.parallelToolCalls ?? false,
parallel_tool_calls: metadata?.parallelToolCalls ?? true,
}

let stream
Expand Down
2 changes: 1 addition & 1 deletion src/api/providers/zai.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ export class ZAiHandler extends BaseOpenAiCompatibleProvider<string> {
thinking: useReasoning ? { type: "enabled" } : { type: "disabled" },
tools: this.convertToolsForOpenAI(metadata?.tools),
tool_choice: metadata?.tool_choice,
parallel_tool_calls: metadata?.parallelToolCalls ?? false,
parallel_tool_calls: metadata?.parallelToolCalls ?? true,
}

return this.client.chat.completions.create(params)
Expand Down
Loading
Loading