Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.Net: Avoid sending duplicate function tools when creating a thread #10413

Conversation

markwallace-microsoft
Copy link
Member

@markwallace-microsoft markwallace-microsoft commented Feb 5, 2025

Motivation and Context

  • When create an AzureAIAgent tools can be specified including function tools. These become part of the Agent definition.
  • When creating a thread for an AzureAIAgent we are taking KernelFunction's and adding them to the list of tool overrides for the Agent. The Kernel must have all functions that agent can call so it will include function defined when the agent was created. This was leading to an 400 error because the request included duplicate function tools.
    Message: 
      Azure.RequestFailedException : Function tools must have unique names.
      Status: 400 (Bad Request)
      
      Content:
      {
        "error": {
          "message": "Function tools must have unique names.",
          "type": "invalid_request_error",
          "param": "tools[9]",
          "code": null
        }
      }
    
  • This PR checks for and eliminates any duplicates.
  • This PR also adds a namespace for OpenAI Assistant and Azure AI Agent getting started samples so they are clearly separated in the Visual Studio Test Explorer

Description

Contribution Checklist

@markwallace-microsoft markwallace-microsoft requested a review from a team as a code owner February 5, 2025 11:01
@markwallace-microsoft markwallace-microsoft added the .NET Issue or Pull requests regarding .NET code label Feb 5, 2025
@github-actions github-actions bot changed the title Avoid sending duplicate function tools when creating a thread .Net: Avoid sending duplicate function tools when creating a thread Feb 5, 2025
@markwallace-microsoft markwallace-microsoft force-pushed the users/markwallace/azureaiagent_functiontools branch from 8eca04c to 22a8ead Compare February 5, 2025 12:38
@crickman crickman self-assigned this Feb 5, 2025
@crickman crickman added experimental Associated with an experimental feature agents labels Feb 5, 2025
@crickman
Copy link
Contributor

crickman commented Feb 5, 2025

Note: I suspect this issue also exists for assistant API. Because we proxy assistant creation, the path isn't quite as available; although, the exact same dynamic could occur if specifying the agent identifier for an assistant created outside of the framework.

@markwallace-microsoft
Copy link
Member Author

Note: I suspect this issue also exists for assistant API. Because we proxy assistant creation, the path isn't quite as available; although, the exact same dynamic could occur if specifying the agent identifier for an assistant created outside of the framework.

This is one of the investigations for the declarative file format specification so I'll test this out.

@markwallace-microsoft markwallace-microsoft added this pull request to the merge queue Feb 5, 2025
Merged via the queue into microsoft:main with commit a6edd98 Feb 5, 2025
17 checks passed
@markwallace-microsoft markwallace-microsoft deleted the users/markwallace/azureaiagent_functiontools branch February 5, 2025 19:57
github-merge-queue bot pushed a commit that referenced this pull request Feb 6, 2025
…10436)

### Motivation and Context

Same issue that was fixed here
#10413 but this time
the fix is for OpenAI Assistants.

### Description

<!-- Describe your changes, the overall approach, the underlying design.
These notes will help understanding how your code works. Thanks! -->

### Contribution Checklist

<!-- Before submitting this PR, please make sure: -->

- [ ] The code builds clean without any errors or warnings
- [ ] The PR follows the [SK Contribution
Guidelines](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md)
and the [pre-submission formatting
script](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md#development-scripts)
raises no violations
- [ ] All unit tests pass, and I have added new tests where possible
- [ ] I didn't break anyone 😄
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
agents experimental Associated with an experimental feature .NET Issue or Pull requests regarding .NET code
Projects
Status: Sprint: Done
Development

Successfully merging this pull request may close these issues.

3 participants