Skip to content

.Net: Common agent api review feedback 2 #11124

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions dotnet/src/Agents/Abstractions/AgentResponseItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,10 @@ public AgentResponseItem(TMessage message, AgentThread thread)
/// Gets the conversation thread associated with the response.
/// </summary>
public AgentThread Thread => this._thread;

/// <summary>
/// Implicitly converts an <see cref="AgentResponseItem{T}"/> to a <see cref="ChatMessageContent"/> or <see cref="StreamingChatMessageContent"/>.
/// </summary>
/// <param name="responseItem"></param>
public static implicit operator TMessage(AgentResponseItem<TMessage> responseItem) => responseItem.Message;
}
2 changes: 2 additions & 0 deletions dotnet/src/Agents/AzureAI/AzureAIAgentThread.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Runtime.CompilerServices;
using System.Threading;
using System.Threading.Tasks;
Expand Down Expand Up @@ -113,6 +114,7 @@ public override async Task OnNewMessageAsync(ChatMessageContent newMessage, Canc
}

/// <inheritdoc />
[Experimental("SKEXP0110")]
public async IAsyncEnumerable<ChatMessageContent> GetMessagesAsync([EnumeratorCancellation] CancellationToken cancellationToken = default)
{
if (this._isDeleted)
Expand Down
2 changes: 2 additions & 0 deletions dotnet/src/Agents/Core/ChatHistoryAgentThread.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Runtime.CompilerServices;
using System.Threading;
using System.Threading.Tasks;
Expand Down Expand Up @@ -94,6 +95,7 @@ public async override Task OnNewMessageAsync(ChatMessageContent newMessage, Canc
}

/// <inheritdoc />
[Experimental("SKEXP0110")]
public async IAsyncEnumerable<ChatMessageContent> GetMessagesAsync([EnumeratorCancellation] CancellationToken cancellationToken = default)
{
if (this._isDeleted)
Expand Down
2 changes: 2 additions & 0 deletions dotnet/src/Agents/OpenAI/OpenAIAssistantAgentThread.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Runtime.CompilerServices;
using System.Threading;
using System.Threading.Tasks;
Expand Down Expand Up @@ -105,6 +106,7 @@ public override async Task OnNewMessageAsync(ChatMessageContent newMessage, Canc
}

/// <inheritdoc />
[Experimental("SKEXP0110")]
public async IAsyncEnumerable<ChatMessageContent> GetMessagesAsync([EnumeratorCancellation] CancellationToken cancellationToken = default)
{
if (this._isDeleted)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Copyright (c) Microsoft. All rights reserved.

namespace SemanticKernel.IntegrationTests.Agents.CommonInterfaceConformance;
namespace SemanticKernel.IntegrationTests.Agents.CommonInterfaceConformance.InvokeConformance;

public class AzureAIAgentInvokeTests() : InvokeTests(() => new AzureAIAgentFixture())
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Copyright (c) Microsoft. All rights reserved.

namespace SemanticKernel.IntegrationTests.Agents.CommonInterfaceConformance;
namespace SemanticKernel.IntegrationTests.Agents.CommonInterfaceConformance.InvokeConformance;

public class ChatCompletionAgentInvokeTests() : InvokeTests(() => new ChatCompletionAgentFixture())
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
using Microsoft.SemanticKernel.Agents;
using Xunit;

namespace SemanticKernel.IntegrationTests.Agents.CommonInterfaceConformance;
namespace SemanticKernel.IntegrationTests.Agents.CommonInterfaceConformance.InvokeConformance;

/// <summary>
/// Base test class for testing the <see cref="Agent.InvokeAsync(ChatMessageContent, AgentThread?, AgentInvokeOptions?, System.Threading.CancellationToken)"/> method of agents.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Copyright (c) Microsoft. All rights reserved.

namespace SemanticKernel.IntegrationTests.Agents.CommonInterfaceConformance;
namespace SemanticKernel.IntegrationTests.Agents.CommonInterfaceConformance.InvokeConformance;

public class OpenAIAssistantAgentInvokeTests() : InvokeTests(() => new OpenAIAssistantAgentFixture())
{
Expand Down
Loading