An Azure service that provides access to OpenAI’s GPT-3 models with enterprise capabilities.
Please 'Upvote'(Thumbs-up) and 'Accept' as answer if the reply was helpful. This will be benefitting other community members who face the same issue.Hello Jhonatan Oliveira,
Welcome to Microsoft Q&A and Thank you for reaching out.
Thank you for sharing the detailed scenario and reproduction steps.
When multiple tools are made available in a single request, the model may prioritize tool selection differently depending on the request context. In scenarios that involve file or code edits, keeping the request scope narrow has shown more predictable results.
The below suggested workarounds are based on the practical steps to maintain stable workflows which focus on reducing ambiguity in tool selection and preserving continuity in code-editing workflows, based on current tool-enabled request behaviour.
- Consider separating code editing and custom tool usage into distinct requests to maintain consistent behaviour.
- Use one request that includes only the built‑in apply_patch tool when code changes are required
- Then perform all file creation, updates, or deletions within this request
- Send a follow‑up request for any custom tool execution, after code edits are completed
- This separation helps ensure the editing tool is clearly available for code‑related tasks.
2.Please keep the code‑editing requests scoped only to apply_patch for requests that involve modifying files.Include only the apply_patch built‑in tool while excluding the custom or function‑based tools.This allows the model to focus solely on generating structured diffs.This minimizes tool selection ambiguity during edit operations.
3. As a general best practice, please confirm whether the requests are sent using a currently supported GA API version.
- Please avoid using deprecated or preview API versions
- Consider aligning requests with the versions listed in the official API lifecycle documentation to ensure compatibility with the latest supported features.
4. As a validation step verify tool declaration structure follows the documented schema.
- Please Declare built‑in and custom tools using the standard tools array
- Please avoid mixing legacy function formats with newer tool definitions
- Please avoid forcing tool selection during mixed‑tool testing
- This helps rule out payload inconsistencies during troubleshooting.
References:
- azure.ai.agentserver.core.models.openai.ResponseApplyPatchToolCall class | Microsoft Learn
- azure.ai.agentserver.core.models.openai.ApplyPatchTool class | Microsoft Learn
- Azure OpenAI in Microsoft Foundry Models v1 API - Microsoft Foundry | Microsoft Learn
- Azure OpenAI in Microsoft Foundry Models v1 REST API reference - Microsoft Foundry | Microsoft Learn
Thank you!
Please 'Upvote'(Thumbs-up) and 'Accept' as answer if the reply was helpful. This will be benefitting other community members who face the same issue.