.Net: Add OpenAI Responses Agent Samples (#83)

* Improved Merge logic

* Add modularization for Model Samples and Azure OpenAI

* Address PR feedback

* Warning fix

* Address PR comments

* Adding OpenAI Response Samples

* Clean up

* Revert to provider specific chat options

* Fix warnings

* Revert slnx changes
This commit is contained in:
Roger Barreto
2025-06-19 19:06:08 +01:00
committed by GitHub
Unverified
parent 47dcad6b49
commit 2cd77596c3
3 changed files with 97 additions and 5 deletions
@@ -25,6 +25,7 @@ public sealed class Step01_Running(ITestOutputHelper output) : AgentSample(outpu
[Theory]
[InlineData(ChatClientProviders.OpenAI)]
[InlineData(ChatClientProviders.AzureOpenAI)]
[InlineData(ChatClientProviders.OpenAIResponses)]
public async Task RunWithoutThread(ChatClientProviders provider)
{
// Get the chat client to use for the agent.
@@ -59,17 +60,23 @@ public sealed class Step01_Running(ITestOutputHelper output) : AgentSample(outpu
[Theory]
[InlineData(ChatClientProviders.OpenAI)]
[InlineData(ChatClientProviders.AzureOpenAI)]
public async Task RunWithConversationThread(ChatClientProviders provider)
[InlineData(ChatClientProviders.OpenAIResponses_InMemoryMessage)]
[InlineData(ChatClientProviders.OpenAIResponses_ConversationId)]
public async Task RunWithThread(ChatClientProviders provider)
{
// Get the chat client to use for the agent.
using var chatClient = base.GetChatClient(provider);
// Get chat options based on the store type, if needed.
var chatOptions = base.GetChatOptions(provider);
// Define the agent
ChatClientAgent agent =
new(chatClient, new()
{
Name = JokerName,
Instructions = JokerInstructions,
ChatOptions = chatOptions,
});
// Start a new thread for the agent conversation.
@@ -97,17 +104,23 @@ public sealed class Step01_Running(ITestOutputHelper output) : AgentSample(outpu
[Theory]
[InlineData(ChatClientProviders.OpenAI)]
[InlineData(ChatClientProviders.AzureOpenAI)]
public async Task StreamingRunWithConversationThread(ChatClientProviders provider)
[InlineData(ChatClientProviders.OpenAIResponses_InMemoryMessage)]
[InlineData(ChatClientProviders.OpenAIResponses_ConversationId)]
public async Task RunStreamingWithThread(ChatClientProviders provider)
{
// Get the chat client to use for the agent.
using var chatClient = base.GetChatClient(provider);
// Get chat options based on the store type, if needed.
var chatOptions = base.GetChatOptions(provider);
// Define the agent
ChatClientAgent agent =
new(chatClient, new()
{
Name = ParrotName,
Instructions = ParrotInstructions,
ChatOptions = chatOptions,
});
// Start a new thread for the agent conversation.