Skip to content

Commit c10d516

Browse files
westey-mglorious-beard
authored andcommitted
.Net: Add date to obsolete messages for when to expect these methods to be deleted. (microsoft#11329)
### Motivation and Context We should warm users of the timeframe at which obsoleted methods will be deleted. microsoft#11315 ### Description Add a date to the obsolete messages for obsolete methods on the agent implementations. ### Contribution Checklist <!-- Before submitting this PR, please make sure: --> - [ ] The code builds clean without any errors or warnings - [ ] The PR follows the [SK Contribution Guidelines](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md) and the [pre-submission formatting script](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md#development-scripts) raises no violations - [ ] All unit tests pass, and I have added new tests where possible - [ ] I didn't break anyone 😄
1 parent 3b597fe commit c10d516

File tree

4 files changed

+27
-27
lines changed

4 files changed

+27
-27
lines changed

dotnet/src/Agents/AzureAI/AzureAIAgent.cs

+6-6
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ public AzureAIAgent(
106106
/// <remarks>
107107
/// Only supports messages with <see href="https://platform.openai.com/docs/api-reference/runs/createRun#runs-createrun-additional_messages">role = User or agent</see>.
108108
/// </remarks>
109-
[Obsolete("Pass messages directly to Invoke instead.")]
109+
[Obsolete("Pass messages directly to Invoke instead. This method will be removed after May 1st 2025.")]
110110
public Task AddChatMessageAsync(string threadId, ChatMessageContent message, CancellationToken cancellationToken = default)
111111
{
112112
return AgentThreadActions.CreateMessageAsync(this.Client, threadId, message, cancellationToken);
@@ -118,7 +118,7 @@ public Task AddChatMessageAsync(string threadId, ChatMessageContent message, Can
118118
/// <param name="threadId">The thread identifier.</param>
119119
/// <param name="cancellationToken">The <see cref="CancellationToken"/> to monitor for cancellation requests. The default is <see cref="CancellationToken.None"/>.</param>
120120
/// <returns>An asynchronous enumeration of messages.</returns>
121-
[Obsolete("Use the AzureAIAgentThread to retrieve messages instead.")]
121+
[Obsolete("Use the AzureAIAgentThread to retrieve messages instead. This method will be removed after May 1st 2025.")]
122122
public IAsyncEnumerable<ChatMessageContent> GetThreadMessagesAsync(string threadId, CancellationToken cancellationToken = default)
123123
{
124124
return AgentThreadActions.GetMessagesAsync(this.Client, threadId, null, cancellationToken);
@@ -135,7 +135,7 @@ public IAsyncEnumerable<ChatMessageContent> GetThreadMessagesAsync(string thread
135135
/// <remarks>
136136
/// The `arguments` parameter is not currently used by the agent, but is provided for future extensibility.
137137
/// </remarks>
138-
[Obsolete("Use InvokeAsync with AgentThread instead.")]
138+
[Obsolete("Use InvokeAsync with AgentThread instead. This method will be removed after May 1st 2025.")]
139139
public IAsyncEnumerable<ChatMessageContent> InvokeAsync(
140140
string threadId,
141141
KernelArguments? arguments = null,
@@ -236,7 +236,7 @@ async IAsyncEnumerable<ChatMessageContent> InternalInvokeAsync()
236236
/// <remarks>
237237
/// The `arguments` parameter is not currently used by the agent, but is provided for future extensibility.
238238
/// </remarks>
239-
[Obsolete("Use InvokeAsync with AgentThread instead.")]
239+
[Obsolete("Use InvokeAsync with AgentThread instead. This method will be removed after May 1st 2025.")]
240240
public IAsyncEnumerable<ChatMessageContent> InvokeAsync(
241241
string threadId,
242242
AzureAIInvocationOptions? options,
@@ -345,7 +345,7 @@ public async IAsyncEnumerable<AgentResponseItem<StreamingChatMessageContent>> In
345345
/// <remarks>
346346
/// The `arguments` parameter is not currently used by the agent, but is provided for future extensibility.
347347
/// </remarks>
348-
[Obsolete("Use InvokeStreamingAsync with AgentThread instead.")]
348+
[Obsolete("Use InvokeStreamingAsync with AgentThread instead. This method will be removed after May 1st 2025.")]
349349
public IAsyncEnumerable<StreamingChatMessageContent> InvokeStreamingAsync(
350350
string threadId,
351351
KernelArguments? arguments = null,
@@ -369,7 +369,7 @@ public IAsyncEnumerable<StreamingChatMessageContent> InvokeStreamingAsync(
369369
/// <remarks>
370370
/// The `arguments` parameter is not currently used by the agent, but is provided for future extensibility.
371371
/// </remarks>
372-
[Obsolete("Use InvokeStreamingAsync with AgentThread instead.")]
372+
[Obsolete("Use InvokeStreamingAsync with AgentThread instead. This method will be removed after May 1st 2025.")]
373373
public IAsyncEnumerable<StreamingChatMessageContent> InvokeStreamingAsync(
374374
string threadId,
375375
AzureAIInvocationOptions? options,

dotnet/src/Agents/Bedrock/BedrockAgent.cs

+4-4
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ public async IAsyncEnumerable<AgentResponseItem<ChatMessageContent>> InvokeAsync
215215
/// <param name="invokeAgentRequest">The request to send to the agent.</param>
216216
/// <param name="arguments">The arguments to use when invoking the agent.</param>
217217
/// <param name="cancellationToken">The <see cref="CancellationToken"/> to monitor for cancellation requests. The default is <see cref="CancellationToken.None"/>.</param>
218-
[Obsolete("Use InvokeAsync with AgentThread instead.")]
218+
[Obsolete("Use InvokeAsync with AgentThread instead. This method will be removed after May 1st 2025.")]
219219
public IAsyncEnumerable<ChatMessageContent> InvokeAsync(
220220
InvokeAgentRequest invokeAgentRequest,
221221
KernelArguments? arguments,
@@ -281,7 +281,7 @@ async IAsyncEnumerable<ChatMessageContent> InvokeInternal()
281281
/// <param name="agentAliasId">The alias id of the agent to use. The default is the working draft alias id.</param>
282282
/// <param name="cancellationToken">The <see cref="CancellationToken"/> to monitor for cancellation requests. The default is <see cref="CancellationToken.None"/>.</param>
283283
/// <returns>An <see cref="IAsyncEnumerable{T}"/> of <see cref="ChatMessageContent"/>.</returns>
284-
[Obsolete("Use InvokeAsync with AgentThread instead.")]
284+
[Obsolete("Use InvokeAsync with AgentThread instead. This method will be removed after May 1st 2025.")]
285285
public IAsyncEnumerable<ChatMessageContent> InvokeAsync(
286286
string sessionId,
287287
string message,
@@ -456,7 +456,7 @@ public async IAsyncEnumerable<AgentResponseItem<StreamingChatMessageContent>> In
456456
/// <param name="agentAliasId">The alias id of the agent to use. The default is the working draft alias id.</param>
457457
/// <param name="cancellationToken">The <see cref="CancellationToken"/> to monitor for cancellation requests. The default is <see cref="CancellationToken.None"/>.</param>
458458
/// <returns>An <see cref="IAsyncEnumerable{T}"/> of <see cref="ChatMessageContent"/>.</returns>
459-
[Obsolete("Use InvokeStreamingAsync with AgentThread instead.")]
459+
[Obsolete("Use InvokeStreamingAsync with AgentThread instead. This method will be removed after May 1st 2025.")]
460460
public IAsyncEnumerable<StreamingChatMessageContent> InvokeStreamingAsync(
461461
string sessionId,
462462
string message,
@@ -486,7 +486,7 @@ public IAsyncEnumerable<StreamingChatMessageContent> InvokeStreamingAsync(
486486
/// <param name="arguments">The arguments to use when invoking the agent.</param>
487487
/// <param name="cancellationToken">The <see cref="CancellationToken"/> to monitor for cancellation requests. The default is <see cref="CancellationToken.None"/>.</param>
488488
/// <returns>An <see cref="IAsyncEnumerable{T}"/> of <see cref="StreamingChatMessageContent"/>.</returns>
489-
[Obsolete("Use InvokeStreamingAsync with AgentThread instead.")]
489+
[Obsolete("Use InvokeStreamingAsync with AgentThread instead. This method will be removed after May 1st 2025.")]
490490
public IAsyncEnumerable<StreamingChatMessageContent> InvokeStreamingAsync(
491491
InvokeAgentRequest invokeAgentRequest,
492492
KernelArguments? arguments,

dotnet/src/Agents/Core/ChatCompletionAgent.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ public override async IAsyncEnumerable<AgentResponseItem<ChatMessageContent>> In
127127
}
128128

129129
/// <inheritdoc/>
130-
[Obsolete("Use InvokeAsync with AgentThread instead.")]
130+
[Obsolete("Use InvokeAsync with AgentThread instead. This method will be removed after May 1st 2025.")]
131131
public override IAsyncEnumerable<ChatMessageContent> InvokeAsync(
132132
ChatHistory history,
133133
KernelArguments? arguments = null,
@@ -187,7 +187,7 @@ public override async IAsyncEnumerable<AgentResponseItem<StreamingChatMessageCon
187187
}
188188

189189
/// <inheritdoc/>
190-
[Obsolete("Use InvokeStreamingAsync with AgentThread instead.")]
190+
[Obsolete("Use InvokeStreamingAsync with AgentThread instead. This method will be removed after May 1st 2025.")]
191191
public override IAsyncEnumerable<StreamingChatMessageContent> InvokeStreamingAsync(
192192
ChatHistory history,
193193
KernelArguments? arguments = null,

dotnet/src/Agents/OpenAI/OpenAIAssistantAgent.cs

+15-15
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ public OpenAIAssistantAgent(
8989
/// An assistant removed by other means will result in an exception when invoked.
9090
/// </remarks>
9191
[Experimental("SKEXP0110")]
92-
[Obsolete("Use the OpenAI.Assistants.AssistantClient to manage the Assistant definition lifecycle.")]
92+
[Obsolete("Use the OpenAI.Assistants.AssistantClient to manage the Assistant definition lifecycle. This method will be removed after May 1st 2025.")]
9393
public bool IsDeleted { get; private set; }
9494

9595
/// <summary>
@@ -114,7 +114,7 @@ public OpenAIAssistantAgent(
114114
/// <param name="cancellationToken">The <see cref="CancellationToken"/> to monitor for cancellation requests. The default is <see cref="CancellationToken.None"/>.</param>
115115
/// <returns>An <see cref="OpenAIAssistantAgent"/> instance.</returns>
116116
[Experimental("SKEXP0110")]
117-
[Obsolete("Use the OpenAI.Assistants.AssistantClient to create an assistant (CreateAssistantFromTemplateAsync).")]
117+
[Obsolete("Use the OpenAI.Assistants.AssistantClient to create an assistant (CreateAssistantFromTemplateAsync). This method will be removed after May 1st 2025.")]
118118
public static async Task<OpenAIAssistantAgent> CreateFromTemplateAsync(
119119
#pragma warning disable SKEXP0110 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.
120120
OpenAIClientProvider clientProvider,
@@ -164,7 +164,7 @@ public static async Task<OpenAIAssistantAgent> CreateFromTemplateAsync(
164164
/// <param name="cancellationToken">The <see cref="CancellationToken"/> to monitor for cancellation requests. The default is <see cref="CancellationToken.None"/>.</param>
165165
/// <returns>An <see cref="OpenAIAssistantAgent"/> instance.</returns>
166166
[Experimental("SKEXP0110")]
167-
[Obsolete("Use the OpenAI.Assistants.AssistantClient to create an assistant (CreateAssistantAsync).")]
167+
[Obsolete("Use the OpenAI.Assistants.AssistantClient to create an assistant (CreateAssistantAsync). This method will be removed after May 1st 2025.")]
168168
public static async Task<OpenAIAssistantAgent> CreateAsync(
169169
#pragma warning disable SKEXP0110 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.
170170
OpenAIClientProvider clientProvider,
@@ -202,7 +202,7 @@ public static async Task<OpenAIAssistantAgent> CreateAsync(
202202
/// <param name="cancellationToken">The <see cref="CancellationToken"/> to monitor for cancellation requests. The default is <see cref="CancellationToken.None"/>.</param>
203203
/// <returns>A list of <see cref="OpenAIAssistantDefinition"/> objects.</returns>
204204
[Experimental("SKEXP0110")]
205-
[Obsolete("Use the OpenAI.Assistants.AssistantClient to query for assistant definitions (GetAssistantsAsync).")]
205+
[Obsolete("Use the OpenAI.Assistants.AssistantClient to query for assistant definitions (GetAssistantsAsync). This method will be removed after May 1st 2025.")]
206206
public static async IAsyncEnumerable<OpenAIAssistantDefinition> ListDefinitionsAsync(
207207
#pragma warning disable SKEXP0110 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.
208208
OpenAIClientProvider clientProvider,
@@ -230,7 +230,7 @@ public static async IAsyncEnumerable<OpenAIAssistantDefinition> ListDefinitionsA
230230
/// <param name="cancellationToken">The <see cref="CancellationToken"/> to monitor for cancellation requests. The default is <see cref="CancellationToken.None"/>.</param>
231231
/// <returns>An <see cref="OpenAIAssistantAgent"/> instance.</returns>
232232
[Experimental("SKEXP0110")]
233-
[Obsolete("Use the OpenAI.Assistants.AssistantClient to retrieve an assistant definition (GetAssistantsAsync).")]
233+
[Obsolete("Use the OpenAI.Assistants.AssistantClient to retrieve an assistant definition (GetAssistantsAsync). This method will be removed after May 1st 2025.")]
234234
public static async Task<OpenAIAssistantAgent> RetrieveAsync(
235235
#pragma warning disable SKEXP0110 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.
236236
OpenAIClientProvider clientProvider,
@@ -274,7 +274,7 @@ public static async Task<OpenAIAssistantAgent> RetrieveAsync(
274274
/// <param name="cancellationToken">The <see cref="CancellationToken"/> to monitor for cancellation requests. The default is <see cref="CancellationToken.None"/>.</param>
275275
/// <returns>The thread identifier.</returns>
276276
[Experimental("SKEXP0110")]
277-
[Obsolete("Use the OpenAIAssistantAgentThread to create a thread or use invoke without a thread to create a new one.")]
277+
[Obsolete("Use the OpenAIAssistantAgentThread to create a thread or use invoke without a thread to create a new one. This method will be removed after May 1st 2025.")]
278278
public Task<string> CreateThreadAsync(CancellationToken cancellationToken = default)
279279
=> this.CreateThreadAsync(options: null, cancellationToken);
280280

@@ -285,7 +285,7 @@ public Task<string> CreateThreadAsync(CancellationToken cancellationToken = defa
285285
/// <param name="cancellationToken">The <see cref="CancellationToken"/> to monitor for cancellation requests. The default is <see cref="CancellationToken.None"/>.</param>
286286
/// <returns>The thread identifier.</returns>
287287
[Experimental("SKEXP0110")]
288-
[Obsolete("Use the OpenAIAssistantAgentThread to create a thread or use invoke without a thread to create a new one.")]
288+
[Obsolete("Use the OpenAIAssistantAgentThread to create a thread or use invoke without a thread to create a new one. This method will be removed after May 1st 2025.")]
289289
public Task<string> CreateThreadAsync(OpenAIThreadCreationOptions? options, CancellationToken cancellationToken = default)
290290
=> this.Client.CreateThreadAsync(
291291
options?.Messages,
@@ -301,7 +301,7 @@ public Task<string> CreateThreadAsync(OpenAIThreadCreationOptions? options, Canc
301301
/// <param name="cancellationToken">The <see cref="CancellationToken"/> to monitor for cancellation requests. The default is <see cref="CancellationToken.None"/>.</param>
302302
/// <returns>The thread identifier.</returns>
303303
[Experimental("SKEXP0110")]
304-
[Obsolete("Use the OpenAIAssistantAgentThread to delete an existing thread.")]
304+
[Obsolete("Use the OpenAIAssistantAgentThread to delete an existing thread. This method will be removed after May 1st 2025.")]
305305
public async Task<bool> DeleteThreadAsync(
306306
string threadId,
307307
CancellationToken cancellationToken = default)
@@ -323,7 +323,7 @@ public async Task<bool> DeleteThreadAsync(
323323
/// <remarks>
324324
/// This method only supports messages with <see href="https://platform.openai.com/docs/api-reference/runs/createRun#runs-createrun-additional_messages">role = User or Assistant</see>.
325325
/// </remarks>
326-
[Obsolete("Pass messages directly to Invoke instead.")]
326+
[Obsolete("Pass messages directly to Invoke instead. This method will be removed after May 1st 2025.")]
327327
public Task AddChatMessageAsync(string threadId, ChatMessageContent message, CancellationToken cancellationToken = default)
328328
{
329329
return AssistantThreadActions.CreateMessageAsync(this.Client, threadId, message, cancellationToken);
@@ -335,7 +335,7 @@ public Task AddChatMessageAsync(string threadId, ChatMessageContent message, Can
335335
/// <param name="threadId">The thread identifier.</param>
336336
/// <param name="cancellationToken">The <see cref="CancellationToken"/> to monitor for cancellation requests. The default is <see cref="CancellationToken.None"/>.</param>
337337
/// <returns>An asynchronous enumeration of messages.</returns>
338-
[Obsolete("Use the OpenAIAssistantAgentThread to retrieve messages instead.")]
338+
[Obsolete("Use the OpenAIAssistantAgentThread to retrieve messages instead. This method will be removed after May 1st 2025.")]
339339
public IAsyncEnumerable<ChatMessageContent> GetThreadMessagesAsync(string threadId, CancellationToken cancellationToken = default)
340340
{
341341
return AssistantThreadActions.GetMessagesAsync(this.Client, threadId, null, cancellationToken);
@@ -350,7 +350,7 @@ public IAsyncEnumerable<ChatMessageContent> GetThreadMessagesAsync(string thread
350350
/// An assistant-based agent is not usable after deletion.
351351
/// </remarks>
352352
[Experimental("SKEXP0110")]
353-
[Obsolete("Use the OpenAI.Assistants.AssistantClient to remove or otherwise modify the Assistant definition.")]
353+
[Obsolete("Use the OpenAI.Assistants.AssistantClient to remove or otherwise modify the Assistant definition. This method will be removed after May 1st 2025.")]
354354
public async Task<bool> DeleteAsync(CancellationToken cancellationToken = default)
355355
{
356356
if (!this.IsDeleted)
@@ -460,7 +460,7 @@ async IAsyncEnumerable<ChatMessageContent> InternalInvokeAsync()
460460
/// <remarks>
461461
/// The "arguments" parameter is not currently used by the agent, but is provided for future extensibility.
462462
/// </remarks>
463-
[Obsolete("Use InvokeAsync with AgentThread instead.")]
463+
[Obsolete("Use InvokeAsync with AgentThread instead. This method will be removed after May 1st 2025.")]
464464
public IAsyncEnumerable<ChatMessageContent> InvokeAsync(
465465
string threadId,
466466
KernelArguments? arguments = null,
@@ -480,7 +480,7 @@ public IAsyncEnumerable<ChatMessageContent> InvokeAsync(
480480
/// <remarks>
481481
/// The "arguments" parameter is not currently used by the agent, but is provided for future extensibility.
482482
/// </remarks>
483-
[Obsolete("Use InvokeAsync with AgentThread instead.")]
483+
[Obsolete("Use InvokeAsync with AgentThread instead. This method will be removed after May 1st 2025.")]
484484
public IAsyncEnumerable<ChatMessageContent> InvokeAsync(
485485
string threadId,
486486
RunCreationOptions? options,
@@ -597,7 +597,7 @@ public async IAsyncEnumerable<AgentResponseItem<StreamingChatMessageContent>> In
597597
/// <remarks>
598598
/// The "arguments" parameter is not currently used by the agent, but is provided for future extensibility.
599599
/// </remarks>
600-
[Obsolete("Use InvokeStreamingAsync with AgentThread instead.")]
600+
[Obsolete("Use InvokeStreamingAsync with AgentThread instead. This method will be removed after May 1st 2025.")]
601601
public IAsyncEnumerable<StreamingChatMessageContent> InvokeStreamingAsync(
602602
string threadId,
603603
KernelArguments? arguments = null,
@@ -619,7 +619,7 @@ public IAsyncEnumerable<StreamingChatMessageContent> InvokeStreamingAsync(
619619
/// <remarks>
620620
/// The "arguments" parameter is not currently used by the agent, but is provided for future extensibility.
621621
/// </remarks>
622-
[Obsolete("Use InvokeStreamingAsync with AgentThread instead.")]
622+
[Obsolete("Use InvokeStreamingAsync with AgentThread instead. This method will be removed after May 1st 2025.")]
623623
public IAsyncEnumerable<StreamingChatMessageContent> InvokeStreamingAsync(
624624
string threadId,
625625
RunCreationOptions? options,

0 commit comments

Comments
 (0)