-
Notifications
You must be signed in to change notification settings - Fork 583
Add some OpenAI and Foundry extension methods #225
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
Add some OpenAI and Foundry extension methods #225
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds extension methods to simplify creating AI agents from OpenAI clients and Azure AI Foundry persistent agents, improving developer experience by providing convenient factory methods.
- Adds OpenAI client extension methods for creating AI agents with both Chat Completion and Response APIs
- Refactors Azure AI persistent agent methods with better naming and consolidated creation workflow
- Updates sample code to demonstrate the new extension methods and agent patterns
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| PersistentAgentsClientExtensions.cs | Renames GetRunnableAgentAsync to GetAIAgentAsync and adds CreateAIAgentAsync method |
| ChatClientAgent_With_OpenAIClient.cs | New sample demonstrating OpenAI client extension methods with multiple API patterns |
| ChatClientAgent_With_OpenAIChatCompletion.cs | Removed file - functionality moved to new OpenAI client sample |
| ChatClientAgent_With_AzureOpenAIChatCompletion.cs | Updates variable type declaration for consistency |
| ChatClientAgent_With_AzureAIAgentsPersistent.cs | Refactored to use new CreateAIAgentAsync method and simplified workflow |
| OpenAIClientExtensions.cs | New extension methods for creating AI agents from OpenAI clients and chat clients |
| OpenAIAgentExtensions.cs | Internal extensions for OpenAI message conversion and agent interaction |
| AgentRunResponseExtensions.cs | Extensions to extract native OpenAI response objects from agent responses |
Comments suppressed due to low confidence (1)
dotnet/src/Microsoft.Extensions.AI.Agents.AzureAI/PersistentAgentsClientExtensions.cs:84
- The 'description' parameter is not being passed to the CreateAgentAsync method call. This will cause the description to be ignored when creating the agent.
instructions,
dotnet/samples/GettingStarted/External/MEAI.OpenAI/AgentRunResponseExtensions.cs
Outdated
Show resolved
Hide resolved
dotnet/samples/GettingStarted/External/MEAI.OpenAI/AgentRunResponseExtensions.cs
Outdated
Show resolved
Hide resolved
dotnet/samples/GettingStarted/External/MEAI.OpenAI/OpenAIAgentExtensions.cs
Outdated
Show resolved
Hide resolved
dotnet/samples/GettingStarted/External/MEAI.OpenAI/AgentRunResponseExtensions.cs
Outdated
Show resolved
Hide resolved
dotnet/samples/GettingStarted/External/MEAI.OpenAI/OpenAIAgentExtensions.cs
Outdated
Show resolved
Hide resolved
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
dotnet/src/Microsoft.Extensions.AI.Agents.OpenAI/OpenAIChatClientAgent.cs
Outdated
Show resolved
Hide resolved
dotnet/src/Microsoft.Extensions.AI.Agents.OpenAI/OpenAIChatClientAgent.cs
Outdated
Show resolved
Hide resolved
dotnet/src/Microsoft.Extensions.AI.Agents.OpenAI/OpenAIChatClientAgent.cs
Outdated
Show resolved
Hide resolved
dotnet/src/Microsoft.Extensions.AI.Agents.OpenAI/AIAgentWithOpenAIExtensions.cs
Outdated
Show resolved
Hide resolved
dotnet/src/Microsoft.Extensions.AI.Agents.OpenAI/AIAgentWithOpenAIExtensions.cs
Outdated
Show resolved
Hide resolved
dotnet/src/Microsoft.Extensions.AI.Agents.OpenAI/AgentRunResponseExtensions.cs
Outdated
Show resolved
Hide resolved
dotnet/src/Microsoft.Extensions.AI.Agents.OpenAI/AgentRunResponseExtensions.cs
Show resolved
Hide resolved
e7cdb7f to
786b5e3
Compare
Motivation and Context
Proposed extension methods to make it easier to create an
AIAgentinstance from anOpenAIClientorPersistentAgentsClient.Description
Contribution Checklist