diff --git a/core/llm/llms/OpenAI.ts b/core/llm/llms/OpenAI.ts index e0acc961e..73bade7b0 100644 --- a/core/llm/llms/OpenAI.ts +++ b/core/llm/llms/OpenAI.ts @@ -267,7 +267,7 @@ class OpenAI extends BaseLLM { body.max_completion_tokens = undefined; } - if (body.tools?.length) { + if (body.tools?.length && !body.model?.startsWith("o3")) { // To ensure schema adherence: https://platform.openai.com/docs/guides/function-calling#parallel-function-calling-and-structured-outputs // In practice, setting this to true and asking for multiple tool calls // leads to "arguments" being something like '{"file": "test.ts"}{"file": "test.js"}' diff --git a/core/llm/toolSupport.ts b/core/llm/toolSupport.ts index dd8f72fb0..9b93fa279 100644 --- a/core/llm/toolSupport.ts +++ b/core/llm/toolSupport.ts @@ -13,7 +13,7 @@ export const PROVIDER_TOOL_SUPPORT: Record< }, openai: (model) => { // https://platform.openai.com/docs/guides/function-calling#models-supporting-function-calling - if (model.toLowerCase().startsWith("gpt-4")) { + if (model.toLowerCase().startsWith("gpt-4") || model.toLowerCase().startsWith("o3")) { return true; } },