mirror of
https://github.com/microsoft/agent-framework.git
synced 2026-06-16 21:04:09 +08:00
.NET: Python: [BREAKING] Renamed Github to GitHub (#3486)
* Renamed Github to GitHub * Small fix * Updated package versions
This commit is contained in:
@@ -65,7 +65,7 @@
|
||||
<Project Path="samples/GettingStarted/AgentProviders/Agent_With_AzureOpenAIChatCompletion/Agent_With_AzureOpenAIChatCompletion.csproj" />
|
||||
<Project Path="samples/GettingStarted/AgentProviders/Agent_With_AzureOpenAIResponses/Agent_With_AzureOpenAIResponses.csproj" />
|
||||
<Project Path="samples/GettingStarted/AgentProviders/Agent_With_CustomImplementation/Agent_With_CustomImplementation.csproj" />
|
||||
<Project Path="samples/GettingStarted/AgentProviders/Agent_With_GithubCopilot/Agent_With_GithubCopilot.csproj" />
|
||||
<Project Path="samples/GettingStarted/AgentProviders/Agent_With_GitHubCopilot/Agent_With_GitHubCopilot.csproj" />
|
||||
<Project Path="samples/GettingStarted/AgentProviders/Agent_With_GoogleGemini/Agent_With_GoogleGemini.csproj" />
|
||||
<Project Path="samples/GettingStarted/AgentProviders/Agent_With_Ollama/Agent_With_Ollama.csproj" />
|
||||
<Project Path="samples/GettingStarted/AgentProviders/Agent_With_ONNX/Agent_With_ONNX.csproj" />
|
||||
@@ -397,7 +397,7 @@
|
||||
<Project Path="src/Microsoft.Agents.AI.Abstractions/Microsoft.Agents.AI.Abstractions.csproj" />
|
||||
<Project Path="src/Microsoft.Agents.AI.AGUI/Microsoft.Agents.AI.AGUI.csproj" />
|
||||
<Project Path="src/Microsoft.Agents.AI.Anthropic/Microsoft.Agents.AI.Anthropic.csproj" />
|
||||
<Project Path="src/Microsoft.Agents.AI.GithubCopilot/Microsoft.Agents.AI.GithubCopilot.csproj" />
|
||||
<Project Path="src/Microsoft.Agents.AI.GitHub.Copilot/Microsoft.Agents.AI.GitHub.Copilot.csproj" />
|
||||
<Project Path="src/Microsoft.Agents.AI.AzureAI.Persistent/Microsoft.Agents.AI.AzureAI.Persistent.csproj" />
|
||||
<Project Path="src/Microsoft.Agents.AI.AzureAI/Microsoft.Agents.AI.AzureAI.csproj" />
|
||||
<Project Path="src/Microsoft.Agents.AI.CopilotStudio/Microsoft.Agents.AI.CopilotStudio.csproj" />
|
||||
@@ -427,7 +427,7 @@
|
||||
<Project Path="tests/AzureAI.IntegrationTests/AzureAI.IntegrationTests.csproj" />
|
||||
<Project Path="tests/AzureAIAgentsPersistent.IntegrationTests/AzureAIAgentsPersistent.IntegrationTests.csproj" />
|
||||
<Project Path="tests/CopilotStudio.IntegrationTests/CopilotStudio.IntegrationTests.csproj" />
|
||||
<Project Path="tests/Microsoft.Agents.AI.GithubCopilot.IntegrationTests/Microsoft.Agents.AI.GithubCopilot.IntegrationTests.csproj" />
|
||||
<Project Path="tests/Microsoft.Agents.AI.GitHub.Copilot.IntegrationTests/Microsoft.Agents.AI.GitHub.Copilot.IntegrationTests.csproj" />
|
||||
<Project Path="tests/Microsoft.Agents.AI.DurableTask.IntegrationTests/Microsoft.Agents.AI.DurableTask.IntegrationTests.csproj" />
|
||||
<Project Path="tests/Microsoft.Agents.AI.Hosting.AGUI.AspNetCore.IntegrationTests/Microsoft.Agents.AI.Hosting.AGUI.AspNetCore.IntegrationTests.csproj" />
|
||||
<Project Path="tests/Microsoft.Agents.AI.Hosting.AzureFunctions.IntegrationTests/Microsoft.Agents.AI.Hosting.AzureFunctions.IntegrationTests.csproj" />
|
||||
@@ -442,7 +442,7 @@
|
||||
<Project Path="tests/Microsoft.Agents.AI.Abstractions.UnitTests/Microsoft.Agents.AI.Abstractions.UnitTests.csproj" />
|
||||
<Project Path="tests/Microsoft.Agents.AI.AGUI.UnitTests/Microsoft.Agents.AI.AGUI.UnitTests.csproj" />
|
||||
<Project Path="tests/Microsoft.Agents.AI.Anthropic.UnitTests/Microsoft.Agents.AI.Anthropic.UnitTests.csproj" />
|
||||
<Project Path="tests/Microsoft.Agents.AI.GithubCopilot.UnitTests/Microsoft.Agents.AI.GithubCopilot.UnitTests.csproj" />
|
||||
<Project Path="tests/Microsoft.Agents.AI.GitHub.Copilot.UnitTests/Microsoft.Agents.AI.GitHub.Copilot.UnitTests.csproj" />
|
||||
<Project Path="tests/Microsoft.Agents.AI.AzureAI.Persistent.UnitTests/Microsoft.Agents.AI.AzureAI.Persistent.UnitTests.csproj" />
|
||||
<Project Path="tests/Microsoft.Agents.AI.AzureAI.UnitTests/Microsoft.Agents.AI.AzureAI.UnitTests.csproj" />
|
||||
<Project Path="tests/Microsoft.Agents.AI.CosmosNoSql.UnitTests/Microsoft.Agents.AI.CosmosNoSql.UnitTests.csproj" />
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
"src\\Microsoft.Agents.AI.Abstractions\\Microsoft.Agents.AI.Abstractions.csproj",
|
||||
"src\\Microsoft.Agents.AI.AGUI\\Microsoft.Agents.AI.AGUI.csproj",
|
||||
"src\\Microsoft.Agents.AI.Anthropic\\Microsoft.Agents.AI.Anthropic.csproj",
|
||||
"src\\Microsoft.Agents.AI.GithubCopilot\\Microsoft.Agents.AI.GithubCopilot.csproj",
|
||||
"src\\Microsoft.Agents.AI.GitHub.Copilot\\Microsoft.Agents.AI.GitHub.Copilot.csproj",
|
||||
"src\\Microsoft.Agents.AI.AzureAI.Persistent\\Microsoft.Agents.AI.AzureAI.Persistent.csproj",
|
||||
"src\\Microsoft.Agents.AI.AzureAI\\Microsoft.Agents.AI.AzureAI.csproj",
|
||||
"src\\Microsoft.Agents.AI.CopilotStudio\\Microsoft.Agents.AI.CopilotStudio.csproj",
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
<PropertyGroup>
|
||||
<!-- Central version prefix - applies to all nuget packages. -->
|
||||
<VersionPrefix>1.0.0</VersionPrefix>
|
||||
<PackageVersion Condition="'$(VersionSuffix)' != ''">$(VersionPrefix)-$(VersionSuffix).260127.1</PackageVersion>
|
||||
<PackageVersion Condition="'$(VersionSuffix)' == ''">$(VersionPrefix)-preview.260127.1</PackageVersion>
|
||||
<GitTag>1.0.0-preview.260127.1</GitTag>
|
||||
<PackageVersion Condition="'$(VersionSuffix)' != ''">$(VersionPrefix)-$(VersionSuffix).260128.1</PackageVersion>
|
||||
<PackageVersion Condition="'$(VersionSuffix)' == ''">$(VersionPrefix)-preview.260128.1</PackageVersion>
|
||||
<GitTag>1.0.0-preview.260128.1</GitTag>
|
||||
|
||||
<Configurations>Debug;Release;Publish</Configurations>
|
||||
<IsPackable>true</IsPackable>
|
||||
|
||||
+1
-1
@@ -13,7 +13,7 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\..\src\Microsoft.Agents.AI.GithubCopilot\Microsoft.Agents.AI.GithubCopilot.csproj" />
|
||||
<ProjectReference Include="..\..\..\..\src\Microsoft.Agents.AI.GitHub.Copilot\Microsoft.Agents.AI.GitHub.Copilot.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -22,7 +22,7 @@ See the README.md for each sample for the prerequisites for that sample.
|
||||
|[Creating an AIAgent with Azure OpenAI ChatCompletion](./Agent_With_AzureOpenAIChatCompletion/)|This sample demonstrates how to create an AIAgent using Azure OpenAI ChatCompletion as the underlying inference service|
|
||||
|[Creating an AIAgent with Azure OpenAI Responses](./Agent_With_AzureOpenAIResponses/)|This sample demonstrates how to create an AIAgent using Azure OpenAI Responses as the underlying inference service|
|
||||
|[Creating an AIAgent with a custom implementation](./Agent_With_CustomImplementation/)|This sample demonstrates how to create an AIAgent with a custom implementation|
|
||||
|[Creating an AIAgent with GitHub Copilot](./Agent_With_GithubCopilot/)|This sample demonstrates how to create an AIAgent using GitHub Copilot SDK as the underlying inference service|
|
||||
|[Creating an AIAgent with GitHub Copilot](./Agent_With_GitHubCopilot/)|This sample demonstrates how to create an AIAgent using GitHub Copilot SDK as the underlying inference service|
|
||||
|[Creating an AIAgent with Ollama](./Agent_With_Ollama/)|This sample demonstrates how to create an AIAgent using Ollama as the underlying inference service|
|
||||
|[Creating an AIAgent with ONNX](./Agent_With_ONNX/)|This sample demonstrates how to create an AIAgent using ONNX as the underlying inference service|
|
||||
|[Creating an AIAgent with OpenAI Assistants](./Agent_With_OpenAIAssistants/)|This sample demonstrates how to create an AIAgent using OpenAI Assistants as the underlying inference service.</br>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|
|
||||
|
||||
+4
-4
@@ -2,7 +2,7 @@
|
||||
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.Agents.AI;
|
||||
using Microsoft.Agents.AI.GithubCopilot;
|
||||
using Microsoft.Agents.AI.GitHub.Copilot;
|
||||
using Microsoft.Extensions.AI;
|
||||
using Microsoft.Shared.Diagnostics;
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace GitHub.Copilot.SDK;
|
||||
/// <para>
|
||||
/// They allow developers to easily create AI agents that can interact
|
||||
/// with GitHub Copilot by handling the conversion from Copilot clients to
|
||||
/// <see cref="GithubCopilotAgent"/> instances that implement the <see cref="AIAgent"/> interface.
|
||||
/// <see cref="GitHubCopilotAgent"/> instances that implement the <see cref="AIAgent"/> interface.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
public static class CopilotClientExtensions
|
||||
@@ -43,7 +43,7 @@ public static class CopilotClientExtensions
|
||||
{
|
||||
Throw.IfNull(client);
|
||||
|
||||
return new GithubCopilotAgent(client, sessionConfig, ownsClient, id, name, description);
|
||||
return new GitHubCopilotAgent(client, sessionConfig, ownsClient, id, name, description);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -68,6 +68,6 @@ public static class CopilotClientExtensions
|
||||
{
|
||||
Throw.IfNull(client);
|
||||
|
||||
return new GithubCopilotAgent(client, ownsClient, id, name, description, tools, instructions);
|
||||
return new GitHubCopilotAgent(client, ownsClient, id, name, description, tools, instructions);
|
||||
}
|
||||
}
|
||||
+10
-10
@@ -13,12 +13,12 @@ using GitHub.Copilot.SDK;
|
||||
using Microsoft.Extensions.AI;
|
||||
using Microsoft.Shared.Diagnostics;
|
||||
|
||||
namespace Microsoft.Agents.AI.GithubCopilot;
|
||||
namespace Microsoft.Agents.AI.GitHub.Copilot;
|
||||
|
||||
/// <summary>
|
||||
/// Represents an <see cref="AIAgent"/> that uses the GitHub Copilot SDK to provide agentic capabilities.
|
||||
/// </summary>
|
||||
public sealed class GithubCopilotAgent : AIAgent, IAsyncDisposable
|
||||
public sealed class GitHubCopilotAgent : AIAgent, IAsyncDisposable
|
||||
{
|
||||
private const string DefaultName = "GitHub Copilot Agent";
|
||||
private const string DefaultDescription = "An AI agent powered by GitHub Copilot";
|
||||
@@ -31,7 +31,7 @@ public sealed class GithubCopilotAgent : AIAgent, IAsyncDisposable
|
||||
private readonly bool _ownsClient;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="GithubCopilotAgent"/> class.
|
||||
/// Initializes a new instance of the <see cref="GitHubCopilotAgent"/> class.
|
||||
/// </summary>
|
||||
/// <param name="copilotClient">The Copilot client to use for interacting with GitHub Copilot.</param>
|
||||
/// <param name="sessionConfig">Optional session configuration for the agent.</param>
|
||||
@@ -39,7 +39,7 @@ public sealed class GithubCopilotAgent : AIAgent, IAsyncDisposable
|
||||
/// <param name="id">The unique identifier for the agent.</param>
|
||||
/// <param name="name">The name of the agent.</param>
|
||||
/// <param name="description">The description of the agent.</param>
|
||||
public GithubCopilotAgent(
|
||||
public GitHubCopilotAgent(
|
||||
CopilotClient copilotClient,
|
||||
SessionConfig? sessionConfig = null,
|
||||
bool ownsClient = false,
|
||||
@@ -58,7 +58,7 @@ public sealed class GithubCopilotAgent : AIAgent, IAsyncDisposable
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="GithubCopilotAgent"/> class.
|
||||
/// Initializes a new instance of the <see cref="GitHubCopilotAgent"/> class.
|
||||
/// </summary>
|
||||
/// <param name="copilotClient">The Copilot client to use for interacting with GitHub Copilot.</param>
|
||||
/// <param name="ownsClient">Whether the agent owns the client and should dispose it. Default is false.</param>
|
||||
@@ -67,7 +67,7 @@ public sealed class GithubCopilotAgent : AIAgent, IAsyncDisposable
|
||||
/// <param name="description">The description of the agent.</param>
|
||||
/// <param name="tools">The tools to make available to the agent.</param>
|
||||
/// <param name="instructions">Optional instructions to append as a system message.</param>
|
||||
public GithubCopilotAgent(
|
||||
public GitHubCopilotAgent(
|
||||
CopilotClient copilotClient,
|
||||
bool ownsClient = false,
|
||||
string? id = null,
|
||||
@@ -87,7 +87,7 @@ public sealed class GithubCopilotAgent : AIAgent, IAsyncDisposable
|
||||
|
||||
/// <inheritdoc/>
|
||||
public sealed override ValueTask<AgentSession> GetNewSessionAsync(CancellationToken cancellationToken = default)
|
||||
=> new(new GithubCopilotAgentSession());
|
||||
=> new(new GitHubCopilotAgentSession());
|
||||
|
||||
/// <summary>
|
||||
/// Get a new <see cref="AgentSession"/> instance using an existing session id, to continue that conversation.
|
||||
@@ -95,14 +95,14 @@ public sealed class GithubCopilotAgent : AIAgent, IAsyncDisposable
|
||||
/// <param name="sessionId">The session id to continue.</param>
|
||||
/// <returns>A new <see cref="AgentSession"/> instance.</returns>
|
||||
public ValueTask<AgentSession> GetNewSessionAsync(string sessionId)
|
||||
=> new(new GithubCopilotAgentSession() { SessionId = sessionId });
|
||||
=> new(new GitHubCopilotAgentSession() { SessionId = sessionId });
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override ValueTask<AgentSession> DeserializeSessionAsync(
|
||||
JsonElement serializedSession,
|
||||
JsonSerializerOptions? jsonSerializerOptions = null,
|
||||
CancellationToken cancellationToken = default)
|
||||
=> new(new GithubCopilotAgentSession(serializedSession, jsonSerializerOptions));
|
||||
=> new(new GitHubCopilotAgentSession(serializedSession, jsonSerializerOptions));
|
||||
|
||||
/// <inheritdoc/>
|
||||
protected override Task<AgentResponse> RunCoreAsync(
|
||||
@@ -123,7 +123,7 @@ public sealed class GithubCopilotAgent : AIAgent, IAsyncDisposable
|
||||
|
||||
// Ensure we have a valid session
|
||||
session ??= await this.GetNewSessionAsync(cancellationToken).ConfigureAwait(false);
|
||||
if (session is not GithubCopilotAgentSession typedSession)
|
||||
if (session is not GitHubCopilotAgentSession typedSession)
|
||||
{
|
||||
throw new InvalidOperationException(
|
||||
$"The provided session type {session.GetType()} is not compatible with the agent. Only GitHub Copilot agent created sessions are supported.");
|
||||
+7
-7
@@ -2,12 +2,12 @@
|
||||
|
||||
using System.Text.Json;
|
||||
|
||||
namespace Microsoft.Agents.AI.GithubCopilot;
|
||||
namespace Microsoft.Agents.AI.GitHub.Copilot;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a session for a GitHub Copilot agent conversation.
|
||||
/// </summary>
|
||||
public sealed class GithubCopilotAgentSession : AgentSession
|
||||
public sealed class GitHubCopilotAgentSession : AgentSession
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the session ID for the GitHub Copilot conversation.
|
||||
@@ -15,18 +15,18 @@ public sealed class GithubCopilotAgentSession : AgentSession
|
||||
public string? SessionId { get; internal set; }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="GithubCopilotAgentSession"/> class.
|
||||
/// Initializes a new instance of the <see cref="GitHubCopilotAgentSession"/> class.
|
||||
/// </summary>
|
||||
internal GithubCopilotAgentSession()
|
||||
internal GitHubCopilotAgentSession()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="GithubCopilotAgentSession"/> class from serialized data.
|
||||
/// Initializes a new instance of the <see cref="GitHubCopilotAgentSession"/> class from serialized data.
|
||||
/// </summary>
|
||||
/// <param name="serializedThread">The serialized thread data.</param>
|
||||
/// <param name="jsonSerializerOptions">Optional JSON serialization options.</param>
|
||||
internal GithubCopilotAgentSession(JsonElement serializedThread, JsonSerializerOptions? jsonSerializerOptions = null)
|
||||
internal GitHubCopilotAgentSession(JsonElement serializedThread, JsonSerializerOptions? jsonSerializerOptions = null)
|
||||
{
|
||||
// The JSON serialization uses camelCase
|
||||
if (serializedThread.TryGetProperty("sessionId", out JsonElement sessionIdElement))
|
||||
@@ -45,7 +45,7 @@ public sealed class GithubCopilotAgentSession : AgentSession
|
||||
|
||||
return JsonSerializer.SerializeToElement(
|
||||
state,
|
||||
GithubCopilotJsonUtilities.DefaultOptions.GetTypeInfo(typeof(State)));
|
||||
GitHubCopilotJsonUtilities.DefaultOptions.GetTypeInfo(typeof(State)));
|
||||
}
|
||||
|
||||
internal sealed class State
|
||||
+3
-3
@@ -5,12 +5,12 @@ using System.Text.Encodings.Web;
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Microsoft.Agents.AI.GithubCopilot;
|
||||
namespace Microsoft.Agents.AI.GitHub.Copilot;
|
||||
|
||||
/// <summary>
|
||||
/// Provides utility methods and configurations for JSON serialization operations within the GitHub Copilot agent implementation.
|
||||
/// </summary>
|
||||
internal static partial class GithubCopilotJsonUtilities
|
||||
internal static partial class GitHubCopilotJsonUtilities
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the default <see cref="JsonSerializerOptions"/> instance used for JSON serialization operations.
|
||||
@@ -42,7 +42,7 @@ internal static partial class GithubCopilotJsonUtilities
|
||||
UseStringEnumConverter = true,
|
||||
DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull,
|
||||
NumberHandling = JsonNumberHandling.AllowReadingFromString)]
|
||||
[JsonSerializable(typeof(GithubCopilotAgentSession.State))]
|
||||
[JsonSerializable(typeof(GitHubCopilotAgentSession.State))]
|
||||
[ExcludeFromCodeCoverage]
|
||||
private sealed partial class JsonContext : JsonSerializerContext;
|
||||
}
|
||||
+13
-13
@@ -7,9 +7,9 @@ using System.Threading.Tasks;
|
||||
using GitHub.Copilot.SDK;
|
||||
using Microsoft.Extensions.AI;
|
||||
|
||||
namespace Microsoft.Agents.AI.GithubCopilot.IntegrationTests;
|
||||
namespace Microsoft.Agents.AI.GitHub.Copilot.IntegrationTests;
|
||||
|
||||
public class GithubCopilotAgentTests
|
||||
public class GitHubCopilotAgentTests
|
||||
{
|
||||
private const string SkipReason = "Integration tests require GitHub Copilot CLI installed. For local execution only.";
|
||||
|
||||
@@ -23,7 +23,7 @@ public class GithubCopilotAgentTests
|
||||
await using CopilotClient client = new(new CopilotClientOptions());
|
||||
await client.StartAsync();
|
||||
|
||||
await using GithubCopilotAgent agent = new(client, sessionConfig: null);
|
||||
await using GitHubCopilotAgent agent = new(client, sessionConfig: null);
|
||||
|
||||
// Act
|
||||
AgentResponse response = await agent.RunAsync("What is 2 + 2? Answer with just the number.");
|
||||
@@ -41,7 +41,7 @@ public class GithubCopilotAgentTests
|
||||
await using CopilotClient client = new(new CopilotClientOptions());
|
||||
await client.StartAsync();
|
||||
|
||||
await using GithubCopilotAgent agent = new(client, sessionConfig: null);
|
||||
await using GitHubCopilotAgent agent = new(client, sessionConfig: null);
|
||||
|
||||
// Act
|
||||
List<AgentResponseUpdate> updates = [];
|
||||
@@ -71,7 +71,7 @@ public class GithubCopilotAgentTests
|
||||
await using CopilotClient client = new(new CopilotClientOptions());
|
||||
await client.StartAsync();
|
||||
|
||||
await using GithubCopilotAgent agent = new(
|
||||
await using GitHubCopilotAgent agent = new(
|
||||
client,
|
||||
tools: [weatherTool],
|
||||
instructions: "You are a helpful weather agent. Use the GetWeather tool to answer weather questions.");
|
||||
@@ -92,7 +92,7 @@ public class GithubCopilotAgentTests
|
||||
await using CopilotClient client = new(new CopilotClientOptions());
|
||||
await client.StartAsync();
|
||||
|
||||
await using GithubCopilotAgent agent = new(
|
||||
await using GitHubCopilotAgent agent = new(
|
||||
client,
|
||||
instructions: "You are a helpful assistant. Keep your answers short.");
|
||||
|
||||
@@ -119,21 +119,21 @@ public class GithubCopilotAgentTests
|
||||
await using CopilotClient client1 = new(new CopilotClientOptions());
|
||||
await client1.StartAsync();
|
||||
|
||||
await using GithubCopilotAgent agent1 = new(
|
||||
await using GitHubCopilotAgent agent1 = new(
|
||||
client1,
|
||||
instructions: "You are a helpful assistant. Keep your answers short.");
|
||||
|
||||
AgentSession session1 = await agent1.GetNewSessionAsync();
|
||||
await agent1.RunAsync("Remember this number: 42.", session1);
|
||||
|
||||
sessionId = ((GithubCopilotAgentSession)session1).SessionId;
|
||||
sessionId = ((GitHubCopilotAgentSession)session1).SessionId;
|
||||
Assert.NotNull(sessionId);
|
||||
|
||||
// Act - Second agent instance resumes the session
|
||||
await using CopilotClient client2 = new(new CopilotClientOptions());
|
||||
await client2.StartAsync();
|
||||
|
||||
await using GithubCopilotAgent agent2 = new(
|
||||
await using GitHubCopilotAgent agent2 = new(
|
||||
client2,
|
||||
instructions: "You are a helpful assistant. Keep your answers short.");
|
||||
|
||||
@@ -157,7 +157,7 @@ public class GithubCopilotAgentTests
|
||||
OnPermissionRequest = OnPermissionRequestAsync,
|
||||
};
|
||||
|
||||
await using GithubCopilotAgent agent = new(client, sessionConfig);
|
||||
await using GitHubCopilotAgent agent = new(client, sessionConfig);
|
||||
|
||||
// Act
|
||||
AgentResponse response = await agent.RunAsync("Run a shell command to print 'hello world'");
|
||||
@@ -180,7 +180,7 @@ public class GithubCopilotAgentTests
|
||||
OnPermissionRequest = OnPermissionRequestAsync,
|
||||
};
|
||||
|
||||
await using GithubCopilotAgent agent = new(client, sessionConfig);
|
||||
await using GitHubCopilotAgent agent = new(client, sessionConfig);
|
||||
|
||||
// Act
|
||||
AgentResponse response = await agent.RunAsync(
|
||||
@@ -213,7 +213,7 @@ public class GithubCopilotAgentTests
|
||||
},
|
||||
};
|
||||
|
||||
await using GithubCopilotAgent agent = new(client, sessionConfig);
|
||||
await using GitHubCopilotAgent agent = new(client, sessionConfig);
|
||||
|
||||
// Act
|
||||
AgentResponse response = await agent.RunAsync("List the files in the current directory");
|
||||
@@ -245,7 +245,7 @@ public class GithubCopilotAgentTests
|
||||
},
|
||||
};
|
||||
|
||||
await using GithubCopilotAgent agent = new(client, sessionConfig);
|
||||
await using GitHubCopilotAgent agent = new(client, sessionConfig);
|
||||
|
||||
// Act
|
||||
AgentResponse response = await agent.RunAsync("Search Microsoft Learn for 'Azure Functions' and summarize the top result");
|
||||
+1
-1
@@ -6,7 +6,7 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\src\Microsoft.Agents.AI.GithubCopilot\Microsoft.Agents.AI.GithubCopilot.csproj" />
|
||||
<ProjectReference Include="..\..\src\Microsoft.Agents.AI.GitHub.Copilot\Microsoft.Agents.AI.GitHub.Copilot.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
+7
-7
@@ -5,7 +5,7 @@ using System.Collections.Generic;
|
||||
using GitHub.Copilot.SDK;
|
||||
using Microsoft.Extensions.AI;
|
||||
|
||||
namespace Microsoft.Agents.AI.GithubCopilot.UnitTests;
|
||||
namespace Microsoft.Agents.AI.GitHub.Copilot.UnitTests;
|
||||
|
||||
/// <summary>
|
||||
/// Unit tests for the <see cref="CopilotClientExtensions"/> class.
|
||||
@@ -13,7 +13,7 @@ namespace Microsoft.Agents.AI.GithubCopilot.UnitTests;
|
||||
public sealed class CopilotClientExtensionsTests
|
||||
{
|
||||
[Fact]
|
||||
public void AsAIAgent_WithAllParameters_ReturnsGithubCopilotAgentWithSpecifiedProperties()
|
||||
public void AsAIAgent_WithAllParameters_ReturnsGitHubCopilotAgentWithSpecifiedProperties()
|
||||
{
|
||||
// Arrange
|
||||
CopilotClient copilotClient = new(new CopilotClientOptions { AutoStart = false });
|
||||
@@ -27,14 +27,14 @@ public sealed class CopilotClientExtensionsTests
|
||||
|
||||
// Assert
|
||||
Assert.NotNull(agent);
|
||||
Assert.IsType<GithubCopilotAgent>(agent);
|
||||
Assert.IsType<GitHubCopilotAgent>(agent);
|
||||
Assert.Equal(TestId, agent.Id);
|
||||
Assert.Equal(TestName, agent.Name);
|
||||
Assert.Equal(TestDescription, agent.Description);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void AsAIAgent_WithMinimalParameters_ReturnsGithubCopilotAgent()
|
||||
public void AsAIAgent_WithMinimalParameters_ReturnsGitHubCopilotAgent()
|
||||
{
|
||||
// Arrange
|
||||
CopilotClient copilotClient = new(new CopilotClientOptions { AutoStart = false });
|
||||
@@ -44,7 +44,7 @@ public sealed class CopilotClientExtensionsTests
|
||||
|
||||
// Assert
|
||||
Assert.NotNull(agent);
|
||||
Assert.IsType<GithubCopilotAgent>(agent);
|
||||
Assert.IsType<GitHubCopilotAgent>(agent);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -68,7 +68,7 @@ public sealed class CopilotClientExtensionsTests
|
||||
|
||||
// Assert
|
||||
Assert.NotNull(agent);
|
||||
Assert.IsType<GithubCopilotAgent>(agent);
|
||||
Assert.IsType<GitHubCopilotAgent>(agent);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -83,6 +83,6 @@ public sealed class CopilotClientExtensionsTests
|
||||
|
||||
// Assert
|
||||
Assert.NotNull(agent);
|
||||
Assert.IsType<GithubCopilotAgent>(agent);
|
||||
Assert.IsType<GitHubCopilotAgent>(agent);
|
||||
}
|
||||
}
|
||||
+12
-12
@@ -6,12 +6,12 @@ using System.Threading.Tasks;
|
||||
using GitHub.Copilot.SDK;
|
||||
using Microsoft.Extensions.AI;
|
||||
|
||||
namespace Microsoft.Agents.AI.GithubCopilot.UnitTests;
|
||||
namespace Microsoft.Agents.AI.GitHub.Copilot.UnitTests;
|
||||
|
||||
/// <summary>
|
||||
/// Unit tests for the <see cref="GithubCopilotAgent"/> class.
|
||||
/// Unit tests for the <see cref="GitHubCopilotAgent"/> class.
|
||||
/// </summary>
|
||||
public sealed class GithubCopilotAgentTests
|
||||
public sealed class GitHubCopilotAgentTests
|
||||
{
|
||||
[Fact]
|
||||
public void Constructor_WithCopilotClient_InitializesPropertiesCorrectly()
|
||||
@@ -23,7 +23,7 @@ public sealed class GithubCopilotAgentTests
|
||||
const string TestDescription = "test-description";
|
||||
|
||||
// Act
|
||||
var agent = new GithubCopilotAgent(copilotClient, ownsClient: false, id: TestId, name: TestName, description: TestDescription, tools: null);
|
||||
var agent = new GitHubCopilotAgent(copilotClient, ownsClient: false, id: TestId, name: TestName, description: TestDescription, tools: null);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(TestId, agent.Id);
|
||||
@@ -35,7 +35,7 @@ public sealed class GithubCopilotAgentTests
|
||||
public void Constructor_WithNullCopilotClient_ThrowsArgumentNullException()
|
||||
{
|
||||
// Act & Assert
|
||||
Assert.Throws<ArgumentNullException>(() => new GithubCopilotAgent(copilotClient: null!, sessionConfig: null));
|
||||
Assert.Throws<ArgumentNullException>(() => new GitHubCopilotAgent(copilotClient: null!, sessionConfig: null));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -45,7 +45,7 @@ public sealed class GithubCopilotAgentTests
|
||||
CopilotClient copilotClient = new(new CopilotClientOptions { AutoStart = false });
|
||||
|
||||
// Act
|
||||
var agent = new GithubCopilotAgent(copilotClient, ownsClient: false, tools: null);
|
||||
var agent = new GitHubCopilotAgent(copilotClient, ownsClient: false, tools: null);
|
||||
|
||||
// Assert
|
||||
Assert.NotNull(agent.Id);
|
||||
@@ -55,18 +55,18 @@ public sealed class GithubCopilotAgentTests
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task GetNewSessionAsync_ReturnsGithubCopilotAgentSessionAsync()
|
||||
public async Task GetNewSessionAsync_ReturnsGitHubCopilotAgentSessionAsync()
|
||||
{
|
||||
// Arrange
|
||||
CopilotClient copilotClient = new(new CopilotClientOptions { AutoStart = false });
|
||||
var agent = new GithubCopilotAgent(copilotClient, ownsClient: false, tools: null);
|
||||
var agent = new GitHubCopilotAgent(copilotClient, ownsClient: false, tools: null);
|
||||
|
||||
// Act
|
||||
var session = await agent.GetNewSessionAsync();
|
||||
|
||||
// Assert
|
||||
Assert.NotNull(session);
|
||||
Assert.IsType<GithubCopilotAgentSession>(session);
|
||||
Assert.IsType<GitHubCopilotAgentSession>(session);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -74,7 +74,7 @@ public sealed class GithubCopilotAgentTests
|
||||
{
|
||||
// Arrange
|
||||
CopilotClient copilotClient = new(new CopilotClientOptions { AutoStart = false });
|
||||
var agent = new GithubCopilotAgent(copilotClient, ownsClient: false, tools: null);
|
||||
var agent = new GitHubCopilotAgent(copilotClient, ownsClient: false, tools: null);
|
||||
const string TestSessionId = "test-session-id";
|
||||
|
||||
// Act
|
||||
@@ -82,7 +82,7 @@ public sealed class GithubCopilotAgentTests
|
||||
|
||||
// Assert
|
||||
Assert.NotNull(session);
|
||||
var typedSession = Assert.IsType<GithubCopilotAgentSession>(session);
|
||||
var typedSession = Assert.IsType<GitHubCopilotAgentSession>(session);
|
||||
Assert.Equal(TestSessionId, typedSession.SessionId);
|
||||
}
|
||||
|
||||
@@ -94,7 +94,7 @@ public sealed class GithubCopilotAgentTests
|
||||
List<AITool> tools = [AIFunctionFactory.Create(() => "test", "TestFunc", "Test function")];
|
||||
|
||||
// Act
|
||||
var agent = new GithubCopilotAgent(copilotClient, tools: tools);
|
||||
var agent = new GitHubCopilotAgent(copilotClient, tools: tools);
|
||||
|
||||
// Assert
|
||||
Assert.NotNull(agent);
|
||||
+1
-1
@@ -6,7 +6,7 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\src\Microsoft.Agents.AI.GithubCopilot\Microsoft.Agents.AI.GithubCopilot.csproj" />
|
||||
<ProjectReference Include="..\..\src\Microsoft.Agents.AI.GitHub.Copilot\Microsoft.Agents.AI.GitHub.Copilot.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
Reference in New Issue
Block a user