.NET update global.json to use 9.0.100 (#5517)

<!-- 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.
This commit is contained in:
Xiaoyun Zhang 2025-02-12 16:02:37 -08:00 committed by GitHub
parent d9432510e4
commit 7f0acd78a8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
20 changed files with 59 additions and 44 deletions

View File

@ -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

View File

@ -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
@ -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
@ -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

View File

@ -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

View File

@ -1,6 +1,6 @@
{
"sdk": {
"version": "8.0.401",
"rollForward": "latestMinor"
"version": "9.0.100",
"rollForward": "latestFeature"
}
}

View File

@ -42,8 +42,6 @@ public class Tool_Call_With_Ollama_And_LiteLLM
});
#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
@ -59,7 +57,7 @@ public class Tool_Call_With_Ollama_And_LiteLLM
.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
}
}

View File

@ -40,6 +40,6 @@ public class DummyAgent : IStreamingAgent
foreach (var c in reply)
{
yield return new TextMessageUpdate(Role.Assistant, c.ToString(), this.Name);
};
}
}
}

View File

@ -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);
}

View File

@ -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>
@ -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);
}

View File

@ -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>
@ -73,7 +73,7 @@ public interface ITaskRunner
/// <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))
{
@ -98,7 +98,7 @@ public interface ITaskRunner
/// <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>
@ -113,5 +113,5 @@ public interface ITaskRunner
/// <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);
}

View File

@ -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
@ -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);
}
@ -52,7 +52,7 @@ public interface ITerminationCondition
/// </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);
}

View File

@ -82,8 +82,8 @@ public class ParameterSchema<T>(string name, bool isRequired = false, T? default
/// </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; }

View File

@ -114,7 +114,7 @@ public abstract class GroupChatBase<TManager> : ITeam where TManager : GroupChat
if (Activator.CreateInstance(typeof(TManager), options) is TManager result)
{
return result;
};
}
}
catch (TargetInvocationException tie)
{

View File

@ -11,8 +11,8 @@ internal delegate ValueTask MessagePublishServicer(GroupChatEventBase event_, st
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,

View File

@ -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

View File

@ -43,7 +43,7 @@ internal sealed class AutoRestartChannel : IDisposable
if (this.RecreateChannel(null) == null)
{
throw new Exception("Failed to connect to gRPC endpoint.");
};
}
}
public AsyncDuplexStreamingCall<Message, Message> StreamingCall
@ -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);

View File

@ -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>

View File

@ -243,7 +243,7 @@ public sealed class GrpcGateway : BackgroundService, IGateway
default:
await RespondBadRequestAsync(connection, $"Unknown message type for message '{message}'.");
break;
};
}
}
/// <summary>

View File

@ -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>

View File

@ -72,7 +72,7 @@ public partial class MiddlewareTest
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) =>

View File

@ -92,7 +92,7 @@ internal sealed class TestGrpcWorkerConnection : IAsyncDisposable
default:
// if it wasn't recognized return bad request
throw new RpcException(new Status(StatusCode.InvalidArgument, $"Unknown message type for message '{message}'"));
};
}
}
}
catch (OperationCanceledException)