mirror of
https://github.com/microsoft/agent-framework.git
synced 2026-06-16 21:04:09 +08:00
Basic agent invocation sample (#175)
* Basic agent invocation sample * Simplify sample further. * Add additional comment. * Address code review comments. * Suppress CA2000 and remove using from most basic sample, since the IChatClient instances involved do not do any disposal.
This commit is contained in:
@@ -6,6 +6,7 @@ using Azure.AI.OpenAI;
|
||||
using Azure.Identity;
|
||||
using Microsoft.Extensions.AI;
|
||||
using Microsoft.Extensions.AI.Agents;
|
||||
using Microsoft.Shared.Diagnostics;
|
||||
using Microsoft.Shared.Samples;
|
||||
using OpenAI.Assistants;
|
||||
using OpenAI.Chat;
|
||||
@@ -31,13 +32,13 @@ public class AgentSample(ITestOutputHelper output) : BaseSample(output)
|
||||
AzureAIAgentsPersistent
|
||||
}
|
||||
|
||||
protected IChatClient GetChatClient(ChatClientProviders provider, ChatClientAgentOptions options)
|
||||
protected IChatClient GetChatClient(ChatClientProviders provider, ChatClientAgentOptions? options = null)
|
||||
=> provider switch
|
||||
{
|
||||
ChatClientProviders.OpenAIChatCompletion => GetOpenAIChatClient(),
|
||||
ChatClientProviders.OpenAIAssistant => GetOpenAIAssistantChatClient(options),
|
||||
ChatClientProviders.OpenAIAssistant => GetOpenAIAssistantChatClient(Throw.IfNull(options)),
|
||||
ChatClientProviders.AzureOpenAI => GetAzureOpenAIChatClient(),
|
||||
ChatClientProviders.AzureAIAgentsPersistent => GetAzureAIAgentPersistentClient(options),
|
||||
ChatClientProviders.AzureAIAgentsPersistent => GetAzureAIAgentPersistentClient(Throw.IfNull(options)),
|
||||
ChatClientProviders.OpenAIResponses or
|
||||
ChatClientProviders.OpenAIResponses_InMemoryMessageThread or
|
||||
ChatClientProviders.OpenAIResponses_ConversationIdThread
|
||||
|
||||
Reference in New Issue
Block a user