Bug: OpenAI Deep Research Model Fails - Tool Choice Error
Hey everyone,
I'm writing about a bug I encountered while using the OpenAI deep research model in Cherry Studio. I wanted to share the details and see if anyone else has experienced something similar. Let's dive in!
Issue Checklist
Before we get started, I've made sure to check all the boxes:
- [x] I understand that issues are for feedback and problem-solving, not for complaining in the comment section, and will provide as much information as possible to help solve the problem.
 - [x] My issue is not listed in the FAQ.
 - [x] I've looked at pinned issues and searched for existing Open Issues, Closed Issues, and Discussions, no similar issue or discussion was found.
 - [x] I've filled in short, clear headings so that developers can quickly identify a rough idea of what to expect when flipping through the list of issues. And not "a suggestion", "stuck", etc.
 - [x] I've confirmed that I am using the latest version of Cherry Studio.
 
Platform
I'm running Cherry Studio on Windows.
Version
I'm using version v1.6.6.
Bug Description
When I try to use the OpenAI deep research model (like o3-deep-research or o4-mini-deep-research), I get this error message:
Tool choice 'function' not found in 'tools' parameter.
请求错误,请检查请求参数是否正确。如果修改了模型设置,请重置到默认设置
This basically means the tool choice 'function' isn't being found in the 'tools' parameter. Seems like a configuration issue somewhere.
Deep Dive into the OpenAI Deep Research Model Bug
The error message "Tool choice 'function' not found in 'tools' parameter" indicates a mismatch between the tool being called and the tools available within the configuration of the OpenAI deep research model in Cherry Studio. Specifically, the system is trying to use a 'function' tool, but this tool is not listed or recognized in the 'tools' parameter that's passed to the OpenAI API. To resolve this, you need to ensure that the 'tools' parameter includes the 'function' tool, and that it's correctly defined with all the necessary properties and configurations that the OpenAI API expects. This involves checking the API call's structure, verifying the tool's definition, and aligning it with OpenAI's requirements. Furthermore, it’s crucial to examine the request body to identify any discrepancies, such as missing fields or incorrect values, and to ensure that all components are correctly set up to align with OpenAI's specifications. A meticulous approach to these checks will help pinpoint the precise cause of the error and facilitate a quick and effective resolution.
Understanding the Role of Tools and Functions in the OpenAI API
In the context of the OpenAI API, particularly with models like the deep research models, 'tools' are external functionalities or resources that the model can use to enhance its capabilities. These can range from web search tools to specialized computation functions. When a model is configured to use a tool, it needs to be explicitly defined in the 'tools' parameter of the API request. This parameter is an array of tool objects, each specifying the type of tool and its properties. The 'tool_choice' parameter then tells the model which tool to use for a specific request. The error we're seeing, "Tool choice 'function' not found in 'tools' parameter," indicates that the model is trying to use a 'function' tool (likely a custom function designed for a specific task), but this function hasn't been properly defined or included in the 'tools' array. This mismatch leads to the API rejecting the request because it can't find the tool it's supposed to use. Ensuring that all tools, especially custom functions, are correctly defined and included in the 'tools' parameter is essential for the proper functioning of the OpenAI API, particularly when leveraging the advanced capabilities of deep research models.
Implications of the Tool Choice Error on Deep Research Models
The "Tool choice 'function' not found in 'tools' parameter" error can significantly hamper the functionality of deep research models like o3-deep-research and o4-mini-deep-research within Cherry Studio. These models are designed to perform complex tasks that often require the use of specialized tools and functions. When a tool is not correctly defined or included in the 'tools' parameter, the model cannot access the necessary resources to complete its tasks. This can lead to failed requests, incomplete research, and inaccurate results. For instance, if the model needs to perform a web search to gather information but the web search tool is not properly configured, it will fail to retrieve the required data, affecting the overall quality of the research. Similarly, if the model relies on a custom function to process or analyze data, the absence of this function will prevent it from generating meaningful insights. Therefore, addressing this error is crucial to ensure that deep research models can operate effectively and provide the accurate, comprehensive results that users expect. This requires a thorough understanding of the tools and functions being used, as well as careful configuration of the 'tools' parameter to align with the model's requirements.
Steps To Reproduce
Here's how you can reproduce the issue:
- Configure OpenAI in Cherry Studio.
 - Choose a deep research model, like o4-mini-deep-research or o3-deep-research.
 - Send a request to the model.
 - The request will fail with the error message.
 
Expected Behavior
The OpenAI deep research model should process the request without errors and provide a relevant response.
Relevant Log Output
Here's the log output I'm seeing:
错误名称: AI_APICallError
错误信息: Tool choice 'function' not found in 'tools' parameter.
堆栈信息: AI_APICallError: Tool choice 'function' not found in 'tools' parameter.
    at file:///C:/Users/user/AppData/Local/Programs/Cherry%20Studio/resources/app.asar/out/renderer/assets/dist-Z22I-dxU.js:4482:11
    at async postToApi (file:///C:/Users/user/AppData/Local/Programs/Cherry%20Studio/resources/app.asar/out/renderer/assets/dist-Z22I-dxU.js:4378:24)
    at async OpenAIResponsesLanguageModel.doStream (file:///C:/Users/user/AppData/Local/Programs/Cherry%20Studio/resources/app.asar/out/renderer/assets/store-Bo1rRusY.js:53141:48)
    at async fn (file:///C:/Users/user/AppData/Local/Programs/Cherry%20Studio/resources/app.asar/out/renderer/assets/store-Bo1rRusY.js:39970:17)
    at async file:///C:/Users/user/AppData/Local/Programs/Cherry%20Studio/resources/app.asar/out/renderer/assets/store-Bo1rRusY.js:37372:19
    at async _retryWithExponentialBackoff (file:///C:/Users/user/AppData/Local/Programs/Cherry%20Studio/resources/app.asar/out/renderer/assets/store-Bo1rRusY.js:37474:10)
    at async streamStep (file:///C:/Users/user/AppData/Local/Programs/Cherry%20Studio/resources/app.asar/out/renderer/assets/store-Bo1rRusY.js:39938:108)
    at async fn (file:///C:/Users/user/AppData/Local/Programs/Cherry%20Studio/resources/app.asar/out/renderer/assets/store-Bo1rRusY.js:40217:5)
    at async file:///C:/Users/user/AppData/Local/Programs/Cherry%20Studio/resources/app.asar/out/renderer/assets/store-Bo1rRusY.js:37372:19
错误原因: "[undefined]"
状态码: 400
请求路径: https://api.openai.com/v1/responses
请求体: {
  "model": "o3-deep-research-2025-06-26",
  "input": [
    {
      "role": "user",
      "content": [
        {
          "type": "input_text",
          "text": "什么是大模型?"
        }
      ]
    }
  ],
  "temperature": "[undefined]",
  "top_p": "[undefined]",
  "max_output_tokens": 8192,
  "max_tool_calls": "[undefined]",
  "metadata": "[undefined]",
  "parallel_tool_calls": "[undefined]",
  "previous_response_id": "[undefined]",
  "store": "[undefined]",
  "user": "[undefined]",
  "instructions": "[undefined]",
  "service_tier": "auto",
  "include": [
    "web_search_call.action.sources"
  ],
  "prompt_cache_key": "[undefined]",
  "safety_identifier": "[undefined]",
  "top_logprobs": "[undefined]",
  "reasoning": {
    "effort": "medium"
  },
  "tools": [
    {
      "type": "web_search",
      "filters": "[undefined]",
      "search_context_size": "medium",
      "user_location": "[undefined]"
    }
  ],
  "tool_choice": {
    "type": "function",
    "name": "builtin_knowledge_search"
  },
  "stream": true
}
响应首部: {
  "alt-svc": "h3=\":443\"; ma=86400",
  "cf-cache-status": "DYNAMIC",
  "cf-ray": "999199432868a8cb-FRA",
  "content-length": "175",
  "content-type": "application/json",
  "date": "Tue, 04 Nov 2025 05:09:20 GMT",
  "openai-organization": "org",
  "openai-processing-ms": "29",
  "openai-project": "proj_ArGlLt9TzF7Jm9nthz9rqsxb",
  "openai-version": "2020-10-01",
  "server": "cloudflare",
  "strict-transport-security": "max-age=31536000; includeSubDomains; preload",
  "x-content-type-options": "nosniff",
  "x-envoy-upstream-service-time": "33",
  "x-request-id": "req_23ae47f8e8b54f01a3efa9c25af64847"
}
响应内容: {
  "error": {
    "message": "Tool choice 'function' not found in 'tools' parameter.",
    "type": "invalid_request_error",
    "param": "tool_choice",
    "code": null
  }
}
数据: {
  "error": {
    "message": "Tool choice 'function' not found in 'tools' parameter.",
    "type": "invalid_request_error",
    "param": "tool_choice",
    "code": null
  }
}
From the logs, it's clear that the tool_choice is set to function, but the tools parameter only includes web_search. This seems to be the root of the problem.
Analyzing the Request Body for Configuration Errors
The request body in the log output provides valuable clues about the configuration errors leading to the "Tool choice 'function' not found in 'tools' parameter" error. Let's break it down:
- model: "o3-deep-research-2025-06-26" - Specifies the OpenAI deep research model being used.
 - input: Contains the user's query: "什么是大模型?" (What is a large model?).
 - tools: Includes only one tool: 
web_search. This tool allows the model to search the web for information. - tool_choice: Specifies that the model should use a 
functionnamedbuiltin_knowledge_search. 
The error arises because the tool_choice parameter is set to use a function, but the tools array does not include any functions. It only includes the web_search tool. To fix this, you need to ensure that the tools array includes the builtin_knowledge_search function or change the tool_choice to use the available web_search tool. This involves modifying the configuration settings in Cherry Studio to correctly define and include the necessary functions in the tools parameter. The request body highlights the importance of aligning the tool_choice with the available tools to avoid this error.
Additional Context
This issue seems related to #10624.
Has anyone else run into this? Any ideas on how to fix it? Let me know in the comments!
Thanks for reading, and let's get this bug squashed!