Hello David Captur,
Thank you for posting your question in the Microsoft Q&A forum.
The intermittent "server_error" you're encountering when forcing tool_choice: "file_search" while invoking functions in Azure OpenAI Assistants likely stems from a conflict between tool prioritization and function execution logic. When you explicitly demand file search, the model may struggle to reconcile this directive with function-calling requirements, especially if the function parameters or context don’t align cleanly with the file-based knowledge.
This issue often arises when:
- The function’s input schema clashes with file search results, causing the model to fail silently.
- Rate limits or backend throttling disrupt the run’s state transitions.
- The assistant’s instructions don’t gracefully handle hybrid scenarios (file search + functions).
The fact that retries or removing tool_choice resolves it suggests race conditions in Azure’s tool-routing logic.
For reliability you may want to look below:
- Audit function parameters for compatibility with file search outputs.
- Implement retry logic (exponential backoff) for transient errors.
- Use auto mode unless file search is absolutely critical, as it allows the model to dynamically balance tools.
If the problem persists, log the full run steps and share them with Microsoft support to identify backend bottlenecks.
If the above answer helped, please do not forget to "Accept Answer" as this may help other community members to refer the info if facing a similar issue. Your contribution to the Microsoft Q&A community is highly appreciated.