diff --git a/dotnet/samples/GettingStarted/AgentProviders/Agent_With_OpenAIAssistants/Program.cs b/dotnet/samples/GettingStarted/AgentProviders/Agent_With_OpenAIAssistants/Program.cs index 9a91e43d37..b39a21f71f 100644 --- a/dotnet/samples/GettingStarted/AgentProviders/Agent_With_OpenAIAssistants/Program.cs +++ b/dotnet/samples/GettingStarted/AgentProviders/Agent_With_OpenAIAssistants/Program.cs @@ -5,6 +5,8 @@ // WARNING: The Assistants API is deprecated and will be shut down. // For more information see the OpenAI documentation: https://platform.openai.com/docs/assistants/migration +#pragma warning disable CS0618 // Type or member is obsolete - OpenAI Assistants API is deprecated but still used in this sample + using Microsoft.Agents.AI; using OpenAI; diff --git a/dotnet/src/Microsoft.Agents.AI.OpenAI/Extensions/OpenAIAssistantClientExtensions.cs b/dotnet/src/Microsoft.Agents.AI.OpenAI/Extensions/OpenAIAssistantClientExtensions.cs index fb464fdc39..f103a7fc1c 100644 --- a/dotnet/src/Microsoft.Agents.AI.OpenAI/Extensions/OpenAIAssistantClientExtensions.cs +++ b/dotnet/src/Microsoft.Agents.AI.OpenAI/Extensions/OpenAIAssistantClientExtensions.cs @@ -30,6 +30,7 @@ public static class OpenAIAssistantClientExtensions /// Provides a way to customize the creation of the underlying used by the agent. /// An optional to use for resolving services required by the instances being invoked. /// A instance that can be used to perform operations on the assistant. + [Obsolete("The Assistants API has been deprecated. Please use the Responses API instead.")] public static ChatClientAgent GetAIAgent( this AssistantClient assistantClient, ClientResult assistantClientResult, @@ -54,6 +55,7 @@ public static ChatClientAgent GetAIAgent( /// Provides a way to customize the creation of the underlying used by the agent. /// An optional to use for resolving services required by the instances being invoked. /// A instance that can be used to perform operations on the assistant. + [Obsolete("The Assistants API has been deprecated. Please use the Responses API instead.")] public static ChatClientAgent GetAIAgent( this AssistantClient assistantClient, Assistant assistantMetadata, @@ -102,6 +104,7 @@ public static ChatClientAgent GetAIAgent( /// An optional to use for resolving services required by the instances being invoked. /// The to monitor for cancellation requests. The default is . /// A instance that can be used to perform operations on the assistant agent. + [Obsolete("The Assistants API has been deprecated. Please use the Responses API instead.")] public static ChatClientAgent GetAIAgent( this AssistantClient assistantClient, string agentId, @@ -134,6 +137,7 @@ public static ChatClientAgent GetAIAgent( /// An optional to use for resolving services required by the instances being invoked. /// The to monitor for cancellation requests. The default is . /// A instance that can be used to perform operations on the assistant agent. + [Obsolete("The Assistants API has been deprecated. Please use the Responses API instead.")] public static async Task GetAIAgentAsync( this AssistantClient assistantClient, string agentId, @@ -166,6 +170,7 @@ public static async Task GetAIAgentAsync( /// An optional to use for resolving services required by the instances being invoked. /// A instance that can be used to perform operations on the assistant. /// or is . + [Obsolete("The Assistants API has been deprecated. Please use the Responses API instead.")] public static ChatClientAgent GetAIAgent( this AssistantClient assistantClient, ClientResult assistantClientResult, @@ -191,6 +196,7 @@ public static ChatClientAgent GetAIAgent( /// An optional to use for resolving services required by the instances being invoked. /// A instance that can be used to perform operations on the assistant. /// or is . + [Obsolete("The Assistants API has been deprecated. Please use the Responses API instead.")] public static ChatClientAgent GetAIAgent( this AssistantClient assistantClient, Assistant assistantMetadata, @@ -252,6 +258,7 @@ public static ChatClientAgent GetAIAgent( /// A instance that can be used to perform operations on the assistant agent. /// or is . /// is empty or whitespace. + [Obsolete("The Assistants API has been deprecated. Please use the Responses API instead.")] public static ChatClientAgent GetAIAgent( this AssistantClient assistantClient, string agentId, @@ -291,6 +298,7 @@ public static ChatClientAgent GetAIAgent( /// A instance that can be used to perform operations on the assistant agent. /// or is . /// is empty or whitespace. + [Obsolete("The Assistants API has been deprecated. Please use the Responses API instead.")] public static async Task GetAIAgentAsync( this AssistantClient assistantClient, string agentId, @@ -333,6 +341,7 @@ public static async Task GetAIAgentAsync( /// An instance backed by the OpenAI Assistant service. /// Thrown when or is . /// Thrown when is empty or whitespace. + [Obsolete("The Assistants API has been deprecated. Please use the Responses API instead.")] public static ChatClientAgent CreateAIAgent( this AssistantClient client, string model, @@ -371,6 +380,7 @@ public static ChatClientAgent CreateAIAgent( /// An instance backed by the OpenAI Assistant service. /// Thrown when or or is . /// Thrown when is empty or whitespace. + [Obsolete("The Assistants API has been deprecated. Please use the Responses API instead.")] public static ChatClientAgent CreateAIAgent( this AssistantClient client, string model, @@ -437,6 +447,7 @@ public static ChatClientAgent CreateAIAgent( /// An instance backed by the OpenAI Assistant service. /// Thrown when or is . /// Thrown when is empty or whitespace. + [Obsolete("The Assistants API has been deprecated. Please use the Responses API instead.")] public static async Task CreateAIAgentAsync( this AssistantClient client, string model, @@ -477,6 +488,7 @@ await client.CreateAIAgentAsync(model, /// An instance backed by the OpenAI Assistant service. /// Thrown when or is . /// Thrown when is empty or whitespace. + [Obsolete("The Assistants API has been deprecated. Please use the Responses API instead.")] public static async Task CreateAIAgentAsync( this AssistantClient client, string model, diff --git a/dotnet/tests/Microsoft.Agents.AI.OpenAI.UnitTests/Extensions/OpenAIAssistantClientExtensionsTests.cs b/dotnet/tests/Microsoft.Agents.AI.OpenAI.UnitTests/Extensions/OpenAIAssistantClientExtensionsTests.cs index 26f855d59e..c75d72cf34 100644 --- a/dotnet/tests/Microsoft.Agents.AI.OpenAI.UnitTests/Extensions/OpenAIAssistantClientExtensionsTests.cs +++ b/dotnet/tests/Microsoft.Agents.AI.OpenAI.UnitTests/Extensions/OpenAIAssistantClientExtensionsTests.cs @@ -1,5 +1,7 @@ // Copyright (c) Microsoft. All rights reserved. +#pragma warning disable CS0618 // Type or member is obsolete - This is intentional as we are testing deprecated methods + using System; using System.ClientModel; using System.ClientModel.Primitives; diff --git a/dotnet/tests/OpenAIAssistant.IntegrationTests/OpenAIAssistantClientExtensionsTests.cs b/dotnet/tests/OpenAIAssistant.IntegrationTests/OpenAIAssistantClientExtensionsTests.cs index f1373bd98b..0c8d6b80dd 100644 --- a/dotnet/tests/OpenAIAssistant.IntegrationTests/OpenAIAssistantClientExtensionsTests.cs +++ b/dotnet/tests/OpenAIAssistant.IntegrationTests/OpenAIAssistantClientExtensionsTests.cs @@ -1,5 +1,7 @@ // Copyright (c) Microsoft. All rights reserved. +#pragma warning disable CS0618 // Type or member is obsolete - Testing deprecated OpenAI Assistants API extension methods + using System; using System.Diagnostics; using System.IO;