Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 4, 2025

Motivation and Context

The OpenAI Assistants API has been deprecated by OpenAI in favor of the Responses API. All public extension methods in OpenAIAssistantClientExtensions should be marked as obsolete to guide users toward the newer API.

Description

Added [Obsolete("The Assistants API has been deprecated. Please use the Responses API instead.")] to all 12 public methods:

  • GetAIAgent (6 overloads)
  • GetAIAgentAsync (2 overloads)
  • CreateAIAgent (2 overloads)
  • CreateAIAgentAsync (2 overloads)

Also added #pragma warning disable CS0618 to the following files to suppress obsolete warnings when using/testing the deprecated methods:

  • dotnet/samples/GettingStarted/AgentProviders/Agent_With_OpenAIAssistants/Program.cs - Sample code demonstrating the deprecated API
  • dotnet/tests/OpenAIAssistant.IntegrationTests/OpenAIAssistantClientExtensionsTests.cs - Integration tests for the deprecated extension methods
  • dotnet/tests/Microsoft.Agents.AI.OpenAI.UnitTests/Extensions/OpenAIAssistantClientExtensionsTests.cs - Unit tests for the deprecated extension methods
[Obsolete("The Assistants API has been deprecated. Please use the Responses API instead.")]
public static ChatClientAgent GetAIAgent(
    this AssistantClient assistantClient,
    ClientResult<Assistant> assistantClientResult,
    ChatOptions? chatOptions = null,
    Func<IChatClient, IChatClient>? clientFactory = null,
    IServiceProvider? services = null)

Contribution Checklist

  • The code builds clean without any errors or warnings
  • The PR follows the Contribution Guidelines
  • All unit tests pass, and I have added new tests where possible
  • Is this a breaking change? If yes, add "[BREAKING]" prefix to the title of the PR.
Original prompt

Annotate all public methods of the OpenAIAssistantClientExtensions class with the [Obsolete("The OpenAI Assistants API has been deprecated. Please use OpenAI Responses API instead.")]


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI changed the title [WIP] Annotate OpenAIAssistantClientExtensions methods as obsolete Annotate all public methods of OpenAIAssistantClientExtensions with Obsolete attribute Dec 4, 2025
Copilot AI requested a review from SergeyMenshykh December 4, 2025 18:11
@github-actions github-actions bot changed the title Annotate all public methods of OpenAIAssistantClientExtensions with Obsolete attribute .NET: Annotate all public methods of OpenAIAssistantClientExtensions with Obsolete attribute Dec 4, 2025
@SergeyMenshykh
Copy link
Member

@copilot fix the build

Copy link
Contributor Author

Copilot AI commented Dec 4, 2025

@copilot fix the build

Fixed in d1ac53d. Added #pragma warning disable CS0618 to the sample file (Agent_With_OpenAIAssistants/Program.cs) and the integration test file (OpenAIAssistantClientExtensionsTests.cs) to suppress the obsolete warnings from using the deprecated OpenAI Assistants API methods.

Copy link
Contributor

Copilot AI left a 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 marks all 12 public extension methods in OpenAIAssistantClientExtensions as obsolete with the [Obsolete] attribute to guide users away from the deprecated OpenAI Assistants API. The changes also suppress obsolete warnings in existing test files and sample code that continue to use these methods.

Key Changes:

  • Added [Obsolete] attributes to all 12 public methods (6 GetAIAgent, 2 GetAIAgentAsync, 2 CreateAIAgent, and 2 CreateAIAgentAsync overloads)
  • Suppressed CS0618 warnings with #pragma warning disable in test files and sample code that still reference these methods

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 12 comments.

File Description
dotnet/src/Microsoft.Agents.AI.OpenAI/Extensions/OpenAIAssistantClientExtensions.cs Added [Obsolete] attributes to all 12 public extension methods
dotnet/tests/OpenAIAssistant.IntegrationTests/OpenAIAssistantClientExtensionsTests.cs Added pragma directive to suppress obsolete warnings in integration tests
dotnet/tests/Microsoft.Agents.AI.OpenAI.UnitTests/Extensions/OpenAIAssistantClientExtensionsTests.cs Added pragma directive to suppress obsolete warnings in unit tests
dotnet/samples/GettingStarted/AgentProviders/Agent_With_OpenAIAssistants/Program.cs Added pragma directive to suppress obsolete warnings in sample code

@SergeyMenshykh
Copy link
Member

@copilot Use the "The Assistants API has been deprecated. Please use the Responses API instead." text for the Obsolete attribute

Copy link
Contributor Author

Copilot AI commented Dec 5, 2025

@copilot Use the "The Assistants API has been deprecated. Please use the Responses API instead." text for the Obsolete attribute

Updated in dd56f50. All 12 [Obsolete] attributes now use the message: "The Assistants API has been deprecated. Please use the Responses API instead."

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

5 participants