From e877ffbca19a3872974897e5f79e9a5589984a9f Mon Sep 17 00:00:00 2001 From: Mark Wallace <127216156+markwallace-microsoft@users.noreply.github.com> Date: Wed, 30 Jul 2025 15:40:04 +0100 Subject: [PATCH] .NET: Move external MEAI classes to releasable packages (#279) * Move external MEAI classes to releaseable packages * Update dotnet/src/Microsoft.Extensions.AI.Agents.Abstractions/MEAI/NewHostedFileSearchTool.cs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update dotnet/src/Microsoft.Extensions.AI.Agents.Abstractions/MEAI/NewHostedCodeInterpreterTool.cs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update dotnet/src/Microsoft.Extensions.AI.Agents.AzureAI/NewPersistentAgentsChatClient.cs Co-authored-by: westey <164392973+westey-m@users.noreply.github.com> --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: westey <164392973+westey-m@users.noreply.github.com> --- dotnet/agent-framework-dotnet.slnx | 1 + .../samples/GettingStarted/External/README.md | 3 -- .../GettingStarted/GettingStarted.csproj | 1 + .../MEAI}/HostedFileContent.cs | 1 + .../MEAI}/HostedVectorStoreContent.cs | 1 + .../MEAI}/NewHostedCodeInterpreterTool.cs | 2 ++ .../MEAI}/NewHostedFileSearchTool.cs | 4 +++ ...t.Extensions.AI.Agents.Abstractions.csproj | 1 + ...rosoft.Extensions.AI.Agents.AzureAI.csproj | 2 ++ .../NewPersistentAgentsChatClient.cs | 3 ++ .../PersistentAgentsClientExtensions.cs | 3 -- .../ResponseExtensions.cs | 3 +- ...crosoft.Extensions.AI.Agents.OpenAI.csproj | 28 +++++++++++++++++++ .../NewOpenAIAssistantChatClient.cs | 0 14 files changed, 45 insertions(+), 8 deletions(-) delete mode 100644 dotnet/samples/GettingStarted/External/README.md rename dotnet/{samples/GettingStarted/External/MEAI.Abstractions => src/Microsoft.Extensions.AI.Agents.Abstractions/MEAI}/HostedFileContent.cs (99%) rename dotnet/{samples/GettingStarted/External/MEAI.Abstractions => src/Microsoft.Extensions.AI.Agents.Abstractions/MEAI}/HostedVectorStoreContent.cs (99%) rename dotnet/{samples/GettingStarted/External/MEAI.Abstractions => src/Microsoft.Extensions.AI.Agents.Abstractions/MEAI}/NewHostedCodeInterpreterTool.cs (96%) rename dotnet/{samples/GettingStarted/External/MEAI.Abstractions => src/Microsoft.Extensions.AI.Agents.Abstractions/MEAI}/NewHostedFileSearchTool.cs (89%) rename dotnet/{samples/GettingStarted/External/Azure.AI.Agents.Persistent => src/Microsoft.Extensions.AI.Agents.AzureAI}/NewPersistentAgentsChatClient.cs (99%) create mode 100644 dotnet/src/Microsoft.Extensions.AI.Agents.OpenAI/Microsoft.Extensions.AI.Agents.OpenAI.csproj rename dotnet/{samples/GettingStarted/External/MEAI.OpenAI => src/Microsoft.Extensions.AI.Agents.OpenAI}/NewOpenAIAssistantChatClient.cs (100%) diff --git a/dotnet/agent-framework-dotnet.slnx b/dotnet/agent-framework-dotnet.slnx index f26b08ba50..c75597230d 100644 --- a/dotnet/agent-framework-dotnet.slnx +++ b/dotnet/agent-framework-dotnet.slnx @@ -143,6 +143,7 @@ + diff --git a/dotnet/samples/GettingStarted/External/README.md b/dotnet/samples/GettingStarted/External/README.md deleted file mode 100644 index 7e1ab9d811..0000000000 --- a/dotnet/samples/GettingStarted/External/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# Proposed External references - -This directory contains proposed external references for the Agent Framework that are not yet available and may be considered and added in the future. \ No newline at end of file diff --git a/dotnet/samples/GettingStarted/GettingStarted.csproj b/dotnet/samples/GettingStarted/GettingStarted.csproj index 44f0befb85..c3175cc5ec 100644 --- a/dotnet/samples/GettingStarted/GettingStarted.csproj +++ b/dotnet/samples/GettingStarted/GettingStarted.csproj @@ -42,6 +42,7 @@ + diff --git a/dotnet/samples/GettingStarted/External/MEAI.Abstractions/HostedFileContent.cs b/dotnet/src/Microsoft.Extensions.AI.Agents.Abstractions/MEAI/HostedFileContent.cs similarity index 99% rename from dotnet/samples/GettingStarted/External/MEAI.Abstractions/HostedFileContent.cs rename to dotnet/src/Microsoft.Extensions.AI.Agents.Abstractions/MEAI/HostedFileContent.cs index 48fc89bcd6..5b24ec34c5 100644 --- a/dotnet/samples/GettingStarted/External/MEAI.Abstractions/HostedFileContent.cs +++ b/dotnet/src/Microsoft.Extensions.AI.Agents.Abstractions/MEAI/HostedFileContent.cs @@ -1,5 +1,6 @@ // Copyright (c) Microsoft. All rights reserved. +using System; using System.Diagnostics; using Microsoft.Shared.Diagnostics; diff --git a/dotnet/samples/GettingStarted/External/MEAI.Abstractions/HostedVectorStoreContent.cs b/dotnet/src/Microsoft.Extensions.AI.Agents.Abstractions/MEAI/HostedVectorStoreContent.cs similarity index 99% rename from dotnet/samples/GettingStarted/External/MEAI.Abstractions/HostedVectorStoreContent.cs rename to dotnet/src/Microsoft.Extensions.AI.Agents.Abstractions/MEAI/HostedVectorStoreContent.cs index cdf132f390..6b444308ff 100644 --- a/dotnet/samples/GettingStarted/External/MEAI.Abstractions/HostedVectorStoreContent.cs +++ b/dotnet/src/Microsoft.Extensions.AI.Agents.Abstractions/MEAI/HostedVectorStoreContent.cs @@ -1,5 +1,6 @@ // Copyright (c) Microsoft. All rights reserved. +using System; using System.Diagnostics; using Microsoft.Shared.Diagnostics; diff --git a/dotnet/samples/GettingStarted/External/MEAI.Abstractions/NewHostedCodeInterpreterTool.cs b/dotnet/src/Microsoft.Extensions.AI.Agents.Abstractions/MEAI/NewHostedCodeInterpreterTool.cs similarity index 96% rename from dotnet/samples/GettingStarted/External/MEAI.Abstractions/NewHostedCodeInterpreterTool.cs rename to dotnet/src/Microsoft.Extensions.AI.Agents.Abstractions/MEAI/NewHostedCodeInterpreterTool.cs index e3b7bdb604..59cb8c06a3 100644 --- a/dotnet/samples/GettingStarted/External/MEAI.Abstractions/NewHostedCodeInterpreterTool.cs +++ b/dotnet/src/Microsoft.Extensions.AI.Agents.Abstractions/MEAI/NewHostedCodeInterpreterTool.cs @@ -1,5 +1,7 @@ // Copyright (c) Microsoft. All rights reserved. +using System.Collections.Generic; + namespace Microsoft.Extensions.AI; /// diff --git a/dotnet/samples/GettingStarted/External/MEAI.Abstractions/NewHostedFileSearchTool.cs b/dotnet/src/Microsoft.Extensions.AI.Agents.Abstractions/MEAI/NewHostedFileSearchTool.cs similarity index 89% rename from dotnet/samples/GettingStarted/External/MEAI.Abstractions/NewHostedFileSearchTool.cs rename to dotnet/src/Microsoft.Extensions.AI.Agents.Abstractions/MEAI/NewHostedFileSearchTool.cs index a2535fa053..3efa49c60c 100644 --- a/dotnet/samples/GettingStarted/External/MEAI.Abstractions/NewHostedFileSearchTool.cs +++ b/dotnet/src/Microsoft.Extensions.AI.Agents.Abstractions/MEAI/NewHostedFileSearchTool.cs @@ -1,5 +1,9 @@ // Copyright (c) Microsoft. All rights reserved. +// Line removed as it is unnecessary due to ImplicitUsings being enabled. + +using System.Collections.Generic; + namespace Microsoft.Extensions.AI; /// diff --git a/dotnet/src/Microsoft.Extensions.AI.Agents.Abstractions/Microsoft.Extensions.AI.Agents.Abstractions.csproj b/dotnet/src/Microsoft.Extensions.AI.Agents.Abstractions/Microsoft.Extensions.AI.Agents.Abstractions.csproj index 335022ffd9..89492227c5 100644 --- a/dotnet/src/Microsoft.Extensions.AI.Agents.Abstractions/Microsoft.Extensions.AI.Agents.Abstractions.csproj +++ b/dotnet/src/Microsoft.Extensions.AI.Agents.Abstractions/Microsoft.Extensions.AI.Agents.Abstractions.csproj @@ -4,6 +4,7 @@ $(ProjectsTargetFrameworks) $(ProjectsDebugTargetFrameworks) Microsoft.Extensions.AI.Agents + $(NoWarn);CA1716;IDE0009; alpha diff --git a/dotnet/src/Microsoft.Extensions.AI.Agents.AzureAI/Microsoft.Extensions.AI.Agents.AzureAI.csproj b/dotnet/src/Microsoft.Extensions.AI.Agents.AzureAI/Microsoft.Extensions.AI.Agents.AzureAI.csproj index 93a39ef9a8..58008d7b35 100644 --- a/dotnet/src/Microsoft.Extensions.AI.Agents.AzureAI/Microsoft.Extensions.AI.Agents.AzureAI.csproj +++ b/dotnet/src/Microsoft.Extensions.AI.Agents.AzureAI/Microsoft.Extensions.AI.Agents.AzureAI.csproj @@ -4,6 +4,8 @@ $(ProjectsTargetFrameworks) $(ProjectsDebugTargetFrameworks) alpha + $(NoWarn);IDE0009; + enable diff --git a/dotnet/samples/GettingStarted/External/Azure.AI.Agents.Persistent/NewPersistentAgentsChatClient.cs b/dotnet/src/Microsoft.Extensions.AI.Agents.AzureAI/NewPersistentAgentsChatClient.cs similarity index 99% rename from dotnet/samples/GettingStarted/External/Azure.AI.Agents.Persistent/NewPersistentAgentsChatClient.cs rename to dotnet/src/Microsoft.Extensions.AI.Agents.AzureAI/NewPersistentAgentsChatClient.cs index 87cad52921..e86a75d0c9 100644 --- a/dotnet/samples/GettingStarted/External/Azure.AI.Agents.Persistent/NewPersistentAgentsChatClient.cs +++ b/dotnet/src/Microsoft.Extensions.AI.Agents.AzureAI/NewPersistentAgentsChatClient.cs @@ -58,6 +58,9 @@ namespace Azure.AI.Agents.Persistent _metadata = new(ProviderName); } + /// + /// Initializes a new instance of the class. + /// public NewPersistentAgentsChatClient() { } /// diff --git a/dotnet/src/Microsoft.Extensions.AI.Agents.AzureAI/PersistentAgentsClientExtensions.cs b/dotnet/src/Microsoft.Extensions.AI.Agents.AzureAI/PersistentAgentsClientExtensions.cs index fb2a4ed57d..1f9e217c55 100644 --- a/dotnet/src/Microsoft.Extensions.AI.Agents.AzureAI/PersistentAgentsClientExtensions.cs +++ b/dotnet/src/Microsoft.Extensions.AI.Agents.AzureAI/PersistentAgentsClientExtensions.cs @@ -1,8 +1,5 @@ // Copyright (c) Microsoft. All rights reserved. -using System; -using System.Threading; -using System.Threading.Tasks; using Microsoft.Extensions.AI; using Microsoft.Extensions.AI.Agents; diff --git a/dotnet/src/Microsoft.Extensions.AI.Agents.AzureAI/ResponseExtensions.cs b/dotnet/src/Microsoft.Extensions.AI.Agents.AzureAI/ResponseExtensions.cs index bc9446f163..517350da11 100644 --- a/dotnet/src/Microsoft.Extensions.AI.Agents.AzureAI/ResponseExtensions.cs +++ b/dotnet/src/Microsoft.Extensions.AI.Agents.AzureAI/ResponseExtensions.cs @@ -1,6 +1,5 @@ // Copyright (c) Microsoft. All rights reserved. -using System; using Microsoft.Extensions.AI; using Microsoft.Extensions.AI.Agents; @@ -48,7 +47,7 @@ internal static class PersistentAgentResponseExtensions } #pragma warning disable CA2000 // Dispose objects before losing scope - var chatClient = persistentAgentsClient.AsIChatClient(persistentAgentMetadata.Id); + var chatClient = new NewPersistentAgentsChatClient(persistentAgentsClient, persistentAgentMetadata.Id); #pragma warning restore CA2000 // Dispose objects before losing scope return new ChatClientAgent(chatClient, options: new() diff --git a/dotnet/src/Microsoft.Extensions.AI.Agents.OpenAI/Microsoft.Extensions.AI.Agents.OpenAI.csproj b/dotnet/src/Microsoft.Extensions.AI.Agents.OpenAI/Microsoft.Extensions.AI.Agents.OpenAI.csproj new file mode 100644 index 0000000000..826eead02c --- /dev/null +++ b/dotnet/src/Microsoft.Extensions.AI.Agents.OpenAI/Microsoft.Extensions.AI.Agents.OpenAI.csproj @@ -0,0 +1,28 @@ + + + + $(ProjectsTargetFrameworks) + $(ProjectsDebugTargetFrameworks) + alpha + $(NoWarn);IDE0009; + enable + true + + + + + + + + + + + + + + + Microsoft.Extensions.AI.Agents.OpenAI + Implementation of generative AI abstractions for OpenAI Agents. + + + \ No newline at end of file diff --git a/dotnet/samples/GettingStarted/External/MEAI.OpenAI/NewOpenAIAssistantChatClient.cs b/dotnet/src/Microsoft.Extensions.AI.Agents.OpenAI/NewOpenAIAssistantChatClient.cs similarity index 100% rename from dotnet/samples/GettingStarted/External/MEAI.OpenAI/NewOpenAIAssistantChatClient.cs rename to dotnet/src/Microsoft.Extensions.AI.Agents.OpenAI/NewOpenAIAssistantChatClient.cs