Skip to content

Commit

Permalink
.NET update global.json to use 9.0.100 (#5517)
Browse files Browse the repository at this point in the history
<!-- Thank you for your contribution! Please review
https://microsoft.github.io/autogen/docs/Contribute before opening a
pull request. -->

<!-- Please add a reviewer to the assignee section when you create a PR.
If you don't have the access to it, we will shortly find a reviewer and
assign them to your PR. -->

## Why are these changes needed?

<!-- Please give a short summary of the change and the problem this
solves. -->

## Related issue number

<!-- For example: "Closes #1234" -->

## Checks

- [ ] I've included any doc changes needed for
https://microsoft.github.io/autogen/. See
https://microsoft.github.io/autogen/docs/Contribute#documentation to
build and test documentation locally.
- [ ] I've added tests (if relevant) corresponding to the changes
introduced in this PR.
- [ ] I've made sure all auto checks have passed.
  • Loading branch information
LittleLittleCloud authored Feb 13, 2025
1 parent d943251 commit 7f0acd7
Show file tree
Hide file tree
Showing 20 changed files with 59 additions and 44 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,11 @@ jobs:
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'
- if: matrix.build-mode == 'manual'
name: Setup .NET 9.0
uses: actions/setup-dotnet@v4
with:
dotnet-version: '9.0.x'
- if: matrix.build-mode == 'manual'
shell: bash
working-directory: dotnet
Expand Down
12 changes: 12 additions & 0 deletions .github/workflows/dotnet-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@ jobs:
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'
- name: Setup .NET 9.0
uses: actions/setup-dotnet@v4
with:
dotnet-version: '9.0.x'
- name: Restore dependencies
run: dotnet restore -bl
- name: Format check
Expand Down Expand Up @@ -207,6 +211,10 @@ jobs:
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'
- name: Setup .NET 9.0
uses: actions/setup-dotnet@v4
with:
dotnet-version: '9.0.x'

- name: publish AOT testApp, assert static analysis warning count, and run the app
shell: pwsh
Expand Down Expand Up @@ -249,6 +257,10 @@ jobs:
with:
dotnet-version: '8.0.x'
global-json-file: dotnet/global.json
- name: Setup .NET 9.0
uses: actions/setup-dotnet@v4
with:
dotnet-version: '9.0.x'
- name: Install dev certs
run: dotnet --version && dotnet dev-certs https --trust
- name: Restore dependencies
Expand Down
2 changes: 1 addition & 1 deletion dotnet/.tools/test-aot-compatibility.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ foreach ($line in $($publishOutput -split "`r`n"))
}
}

pushd $rootDirectory/artifacts/bin/AutoGen.AotCompatibility.Tests/release
pushd $rootDirectory/artifacts/bin/AutoGen.AotCompatibility.Tests/release/native

Write-Host "Executing test App..."
./AutoGen.AotCompatibility.Tests
Expand Down
4 changes: 2 additions & 2 deletions dotnet/global.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"sdk": {
"version": "8.0.401",
"rollForward": "latestMinor"
"version": "9.0.100",
"rollForward": "latestFeature"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@ public static async Task RunAsync()
});
#endregion Create_tools
#region Create_Agent
var liteLLMUrl = "http://localhost:4000";

// api-key is not required for local server
// so you can use any string here
var openAIClient = new OpenAIClient(new ApiKeyCredential("api-key"), new OpenAIClientOptions
Expand All @@ -59,7 +57,7 @@ public static async Task RunAsync()
.RegisterMiddleware(functionMiddleware)
.RegisterPrintMessage();

var reply = await agent.SendAsync("what's the weather in new york");
await agent.SendAsync("what's the weather in new york");
#endregion Create_Agent
}
}
2 changes: 1 addition & 1 deletion dotnet/samples/AgentChat/AutoGen.WebAPI.Sample/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,6 @@ public async IAsyncEnumerable<IMessage> GenerateStreamingReplyAsync(IEnumerable<
foreach (var c in reply)
{
yield return new TextMessageUpdate(Role.Assistant, c.ToString(), this.Name);
};
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -170,24 +170,23 @@ public interface IChatAgent :
/// <summary>
/// The name of the agent. This is used by team to uniquely identify the agent.It should be unique within the team.
/// </summary>
AgentName Name { get; }
public AgentName Name { get; }

/// <summary>
/// The description of the agent. This is used by team to make decisions about which agents to use.The description
/// should describe the agent's capabilities and how to interact with it.
/// </summary>
string Description { get; }
public string Description { get; }

/// <summary>
/// The types of messages that the agent produces.
/// </summary>
IEnumerable<Type> ProducedMessageTypes { get; } // TODO: Is there a way to make this part of the type somehow?
// Annotations, or IProduce<>? Do we ever actually access this?
public IEnumerable<Type> ProducedMessageTypes { get; } // TODO: Is there a way to make this part of the type somehow? Annotations, or IProduce<>? Do we ever actually access this?

/// <summary>
/// Reset the agent to its initialization state.
/// </summary>
/// <param name="cancellationToken"></param>
/// <returns></returns>
ValueTask ResetAsync(CancellationToken cancellationToken);
public ValueTask ResetAsync(CancellationToken cancellationToken);
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,22 @@ namespace Microsoft.AutoGen.AgentChat.Abstractions;

public interface IHandleChat<in TIn>
{
ValueTask HandleAsync(TIn item)
public ValueTask HandleAsync(TIn item)
{
return this.HandleAsync(item, CancellationToken.None);
}

ValueTask HandleAsync(TIn item, CancellationToken cancellationToken);
public ValueTask HandleAsync(TIn item, CancellationToken cancellationToken);
}

public interface IHandleChat<in TIn, TOut> // TODO: Map this to IHandle<> somehow?
{
ValueTask<TOut> HandleAsync(TIn item)
public ValueTask<TOut> HandleAsync(TIn item)
{
return this.HandleAsync(item, CancellationToken.None);
}

ValueTask<TOut> HandleAsync(TIn item, CancellationToken cancellationToken);
public ValueTask<TOut> HandleAsync(TIn item, CancellationToken cancellationToken);
}

public interface IHandleDefault : IHandleChat<object>
Expand All @@ -29,10 +29,10 @@ public interface IHandleDefault : IHandleChat<object>

public interface IHandleStream<in TIn, TOut>
{
IAsyncEnumerable<TOut> StreamAsync(TIn item)
public IAsyncEnumerable<TOut> StreamAsync(TIn item)
{
return this.StreamAsync(item, CancellationToken.None);
}

IAsyncEnumerable<TOut> StreamAsync(TIn item, CancellationToken cancellationToken);
public IAsyncEnumerable<TOut> StreamAsync(TIn item, CancellationToken cancellationToken);
}
8 changes: 4 additions & 4 deletions dotnet/src/Microsoft.AutoGen/AgentChat/Abstractions/Tasks.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public interface ITaskRunner
/// <param name="task">The task definition in text form.</param>
/// <param name="cancellationToken"></param>
/// <returns>The result of running the task.</returns>
async ValueTask<TaskResult> RunAsync(string task, CancellationToken cancellationToken = default) =>
public async ValueTask<TaskResult> RunAsync(string task, CancellationToken cancellationToken = default) =>
await this.RunAsync(ToMessage(task)!, cancellationToken);

/// <summary>
Expand All @@ -73,7 +73,7 @@ async ValueTask<TaskResult> RunAsync(string task, CancellationToken cancellation
/// <param name="cancellationToken"></param>
/// <returns>The result of running the task.</returns>
/// <exception cref="InvalidOperationException">If no response is generated.</exception>
async ValueTask<TaskResult> RunAsync(ChatMessage task, CancellationToken cancellationToken = default)
public async ValueTask<TaskResult> RunAsync(ChatMessage task, CancellationToken cancellationToken = default)
{
await foreach (TaskFrame frame in this.StreamAsync(task, cancellationToken))
{
Expand All @@ -98,7 +98,7 @@ async ValueTask<TaskResult> RunAsync(ChatMessage task, CancellationToken cancell
/// <param name="cancellationToken"></param>
/// <returns>A stream of <see cref="TaskFrame"/> containing internal messages and intermediate results followed by
/// the final <see cref="TaskResult"/></returns>
IAsyncEnumerable<TaskFrame> StreamAsync(string task, CancellationToken cancellationToken = default) =>
public IAsyncEnumerable<TaskFrame> StreamAsync(string task, CancellationToken cancellationToken = default) =>
this.StreamAsync(ToMessage(task), cancellationToken);

/// <summary>
Expand All @@ -113,5 +113,5 @@ IAsyncEnumerable<TaskFrame> StreamAsync(string task, CancellationToken cancellat
/// <param name="cancellationToken"></param>
/// <returns>A stream of <see cref="TaskFrame"/> containing internal messages and intermediate results followed by
/// the final <see cref="TaskResult"/></returns>
IAsyncEnumerable<TaskFrame> StreamAsync(ChatMessage? task, CancellationToken cancellationToken = default);
public IAsyncEnumerable<TaskFrame> StreamAsync(ChatMessage? task, CancellationToken cancellationToken = default);
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public interface ITerminationCondition
/// <summary>
/// Checks if the termination condition has been reached
/// </summary>
bool IsTerminated { get; }
public bool IsTerminated { get; }

/// <summary>
/// Check if the conversation should be terminated based on the messages received
Expand All @@ -30,19 +30,19 @@ public interface ITerminationCondition
/// <returns>A <see cref="StopMessage"/> if the conversation should be terminated, or <c>null</c>
/// otherwise.</returns>
/// <exception cref="TerminatedException">If the termination condition has already been reached.</exception>
ValueTask<StopMessage?> CheckAndUpdateAsync(IList<AgentMessage> messages);
public ValueTask<StopMessage?> CheckAndUpdateAsync(IList<AgentMessage> messages);

/// <summary>
/// Resets the termination condition.
/// </summary>
void Reset();
public void Reset();

/// <summary>
/// Combine this termination condition with another using a logical OR.
/// </summary>
/// <param name="other">Another termination condition.</param>
/// <returns>The combined termination condition, with appropriate short-circuiting.</returns>
ITerminationCondition Or(ITerminationCondition other)
public ITerminationCondition Or(ITerminationCondition other)
{
return new CombinerCondition(CombinerCondition.Or, this, other);
}
Expand All @@ -52,7 +52,7 @@ ITerminationCondition Or(ITerminationCondition other)
/// </summary>
/// <param name="other">Another termination condition.</param>
/// <returns>The combined termination condition, with appropriate short-circuiting.</returns>
ITerminationCondition And(ITerminationCondition other)
public ITerminationCondition And(ITerminationCondition other)
{
return new CombinerCondition(CombinerCondition.And, this, other);
}
Expand Down
4 changes: 2 additions & 2 deletions dotnet/src/Microsoft.AutoGen/AgentChat/Abstractions/Tools.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ public static ParameterSchema Create(Type type, string name, bool isRequired = f
/// </summary>
public interface ITool
{
string Name { get; }
string Description { get; }
public string Name { get; }
public string Description { get; }

public IEnumerable<ParameterSchema> Parameters { get; }
public Type ReturnType { get; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ public virtual TManager CreateChatManager(GroupChatOptions options)
if (Activator.CreateInstance(typeof(TManager), options) is TManager result)
{
return result;
};
}
}
catch (TargetInvocationException tie)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ namespace Microsoft.AutoGen.AgentChat.GroupChat;

internal interface IGroupChatHandler : IHandle<GroupChatStart>, IHandle<GroupChatAgentResponse>, IHandle<object>
{
void AttachMessagePublishServicer(MessagePublishServicer? servicer = null);
void DetachMessagePublishServicer() => this.AttachMessagePublishServicer(null);
public void AttachMessagePublishServicer(MessagePublishServicer? servicer = null);
public void DetachMessagePublishServicer() => this.AttachMessagePublishServicer(null);
}

internal sealed class GroupChatHandlerRouter<TManager> : HostableAgentAdapter,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ namespace Microsoft.AutoGen.AgentChat.Abstractions;

internal interface IOutputCollectionSink
{
void CollectMessage(AgentMessage message);
void Terminate(StopMessage message);
public void CollectMessage(AgentMessage message);
public void Terminate(StopMessage message);
}

internal sealed class OutputSink : IOutputCollectionSink
Expand Down
5 changes: 3 additions & 2 deletions dotnet/src/Microsoft.AutoGen/Core.Grpc/GrpcMessageRouter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public void EnsureConnected()
if (this.RecreateChannel(null) == null)
{
throw new Exception("Failed to connect to gRPC endpoint.");
};
}
}

public AsyncDuplexStreamingCall<Message, Message> StreamingCall
Expand Down Expand Up @@ -117,8 +117,9 @@ internal sealed class GrpcMessageRouter(AgentRpc.AgentRpcClient client,
private readonly CancellationTokenSource _shutdownCts = CancellationTokenSource.CreateLinkedTokenSource(shutdownCancellation);

private readonly IMessageSink<Message> _incomingMessageSink = incomingMessageSink;

// TODO: Enable a way to configure the channel options
private readonly Channel<(Message Message, TaskCompletionSource WriteCompletionSource)> _outboundMessagesChannel
// TODO: Enable a way to configure the channel options
= Channel.CreateBounded<(Message, TaskCompletionSource)>(DefaultChannelOptions);

private readonly AutoRestartChannel _incomingMessageChannel = new AutoRestartChannel(client, clientId, logger, shutdownCancellation);
Expand Down
8 changes: 4 additions & 4 deletions dotnet/src/Microsoft.AutoGen/Core/ResultSink.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ namespace Microsoft.AutoGen.Core;

internal interface IResultSink<TResult> : IValueTaskSource<TResult>
{
void SetResult(TResult result);
void SetException(Exception exception);
void SetCancelled();
public void SetResult(TResult result);
public void SetException(Exception exception);
public void SetCancelled();

ValueTask<TResult> Future { get; }
public ValueTask<TResult> Future { get; }
}

public sealed class ResultSink<TResult> : IResultSink<TResult>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ internal async Task OnReceivedMessageAsync(GrpcWorkerConnection connection, Mess
default:
await RespondBadRequestAsync(connection, $"Unknown message type for message '{message}'.");
break;
};
}
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<PublishAot>true</PublishAot>
Expand Down
2 changes: 1 addition & 1 deletion dotnet/test/AutoGen.Tests/MiddlewareTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public async Task HumanInputMiddlewareTestAsync()
public async Task FunctionCallMiddlewareTestAsync()
{
var agent = new EchoAgent("echo");
var args = new EchoSchema { message = "hello" };
var args = new AutoGen.Tests.MiddlewareTest.EchoSchema { message = "hello" }; // make the format check happy on linux
var argsJson = JsonSerializer.Serialize(args) ?? throw new InvalidOperationException("Failed to serialize args");
var functionCall = new ToolCall("Echo", argsJson);
var functionCallAgent = agent.RegisterMiddleware(async (messages, options, agent, ct) =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public async Task RunReadPump()
default:
// if it wasn't recognized return bad request
throw new RpcException(new Status(StatusCode.InvalidArgument, $"Unknown message type for message '{message}'"));
};
}
}
}
catch (OperationCanceledException)
Expand Down

0 comments on commit 7f0acd7

Please sign in to comment.