diff --git a/dotnet/src/Agents/Abstractions/AgentInvokeOptions.cs b/dotnet/src/Agents/Abstractions/AgentInvokeOptions.cs index 6aff36e0fc64..57d27652ab02 100644 --- a/dotnet/src/Agents/Abstractions/AgentInvokeOptions.cs +++ b/dotnet/src/Agents/Abstractions/AgentInvokeOptions.cs @@ -5,7 +5,7 @@ namespace Microsoft.SemanticKernel.Agents; /// /// Optional parameters for agent invocation. /// -public class AgentInvokeOptions +public sealed class AgentInvokeOptions { /// /// Gets or sets optional arguments to pass to the agent's invocation, including any diff --git a/dotnet/src/Agents/Abstractions/AgentThread.cs b/dotnet/src/Agents/Abstractions/AgentThread.cs index 9fe3ba7fa6b7..e229db0088f3 100644 --- a/dotnet/src/Agents/Abstractions/AgentThread.cs +++ b/dotnet/src/Agents/Abstractions/AgentThread.cs @@ -30,8 +30,8 @@ public abstract class AgentThread /// Creates the thread and returns the thread id. /// /// The to monitor for cancellation requests. The default is . - /// The id of the new thread. - public virtual async Task CreateAsync(CancellationToken cancellationToken = default) + /// A task that completes when the thread has been created. + public virtual async Task CreateAsync(CancellationToken cancellationToken = default) { if (this.IsDeleted) { @@ -40,11 +40,10 @@ public virtual async Task CreateAsync(CancellationToken cancellationToke if (this.Id is not null) { - return this.Id; + return; } this.Id = await this.CreateInternalAsync(cancellationToken: cancellationToken).ConfigureAwait(false); - return this.Id; } /// @@ -98,8 +97,8 @@ public virtual async Task OnNewMessageAsync(ChatMessageContent newMessage, Cance /// Checks have already been completed in the method to ensure that the thread can be created. /// /// The to monitor for cancellation requests. The default is . - /// The id of the thread that was created. - protected abstract Task CreateInternalAsync(CancellationToken cancellationToken); + /// The id of the thread that was created if one is available. + protected abstract Task CreateInternalAsync(CancellationToken cancellationToken); /// /// Deletes the current thread. diff --git a/dotnet/src/Agents/AzureAI/AzureAIAgentThread.cs b/dotnet/src/Agents/AzureAI/AzureAIAgentThread.cs index 519dec3ec43d..39bbcce4fbba 100644 --- a/dotnet/src/Agents/AzureAI/AzureAIAgentThread.cs +++ b/dotnet/src/Agents/AzureAI/AzureAIAgentThread.cs @@ -62,7 +62,7 @@ public AzureAIAgentThread(AgentsClient client, string id) } /// - protected async override Task CreateInternalAsync(CancellationToken cancellationToken) + protected async override Task CreateInternalAsync(CancellationToken cancellationToken) { const string ErrorMessage = "The thread could not be created due to an error response from the service."; diff --git a/dotnet/src/Agents/Core/ChatHistoryAgentThread.cs b/dotnet/src/Agents/Core/ChatHistoryAgentThread.cs index 653f3b6e423f..313bdff31fcb 100644 --- a/dotnet/src/Agents/Core/ChatHistoryAgentThread.cs +++ b/dotnet/src/Agents/Core/ChatHistoryAgentThread.cs @@ -37,9 +37,9 @@ public ChatHistoryAgentThread(ChatHistory chatHistory, string? id = null) } /// - protected override Task CreateInternalAsync(CancellationToken cancellationToken) + protected override Task CreateInternalAsync(CancellationToken cancellationToken) { - return Task.FromResult(Guid.NewGuid().ToString("N")); + return Task.FromResult(Guid.NewGuid().ToString("N")); } /// diff --git a/dotnet/src/Agents/OpenAI/OpenAIAssistantAgentThread.cs b/dotnet/src/Agents/OpenAI/OpenAIAssistantAgentThread.cs index 37e95a763407..97952a8f1fed 100644 --- a/dotnet/src/Agents/OpenAI/OpenAIAssistantAgentThread.cs +++ b/dotnet/src/Agents/OpenAI/OpenAIAssistantAgentThread.cs @@ -48,7 +48,7 @@ public OpenAIAssistantAgentThread(AssistantClient client, string id) } /// - protected async override Task CreateInternalAsync(CancellationToken cancellationToken) + protected async override Task CreateInternalAsync(CancellationToken cancellationToken) { const string ErrorMessage = "The thread could not be created due to an error response from the service.";