Azure OpenAI ALWAYS Throwing an unhandled Error when submitting a Thread Run with parameter tool_choice set to "type":"file_search" on GPT4.1-mini

David Captur 160 Reputation points
2025-05-20T10:50:52.71+00:00

Hi there,

I am currently using Assistants/Threads/Runs to chat with a configured assistant in Azure OpenAI which has File Search enabled and some configured functions. I want it as much as possible to use the file search and get its answers from there, so when I post the Run, I am setting this body:

SQLCopy

{
   "assistant_id":"{{AssistantID}}",
   "tool_choice":{
      "type":"file_search"
   },
   "parallel_tool_calls":true,
}

When on the assistant side I set the model to be GPT4.1-mini, I am ALWAYS getting an unhandled server error as shown below:

User's image

Error text:

Copy

"last_error": {

    "code": "server_error",

    "message": "Sorry, something went wrong."

}

This is happening with all requests, even passing something as simple as "hello there". If I change models to GPT4o or GPT4o-mini, the problem does not occur!

Azure AI services
Azure AI services
A group of Azure services, SDKs, and APIs designed to make apps more intelligent, engaging, and discoverable.
3,602 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Divyesh Govaerdhanan 6,235 Reputation points
    2025-05-20T14:38:06.47+00:00

    Hello,

    Welcome to Microsoft Q&A,

    gpt-4.1-mini (or gpt-4.1-preview) has incomplete or unstable support for explicit tool routing when using the tool_choice setting, particularly when forcing file search.

    This issue is not officially documented in OpenAI or Azure OpenAI but has been observed by other users and acknowledged internally by OpenAI.

    https://community.openai.com/t/assistant-api-file-search-error-after-gpt-4-1-release/1231560

    As you already noted, the models gpt-4o or gpt-4o-mini work. These models are faster, cheaper, more capable, and fully support file_search and tool_choice. Please use this in the meantime while the issue is fixed.

    Please Upvote and accept the answer if it helps!!

    1 person found this answer helpful.
    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.