Skip to content

A programming framework for agentic AI

[.Net] update dotnet-ci and dotnet-release to use 8.0.x version when setting up .NET. And enable format check (#3136)

Xiaoyun Zhang970c1961ddf7
diff --git a/.github/workflows/dotnet-build.yml b/.github/workflows/dotnet-build.yml
index f4074b061..7e5002591 100644
--- a/.github/workflows/dotnet-build.yml
+++ b/.github/workflows/dotnet-build.yml
@@ -56,11 +56,16 @@ jobs:
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
- global-json-file: dotnet/global.json
+ dotnet-version: '8.0.x'
- name: Restore dependencies
run: |
# dotnet nuget add source --name dotnet-tool https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json --configfile NuGet.config
dotnet restore -bl
+ - name: Format check
+ run: |
+ echo "Format check"
+ echo "If you see any error in this step, please run 'dotnet format' locally to format the code."
+ dotnet format --verify-no-changes -v diag --no-restore
- name: Build
run: |
echo "Build AutoGen"
diff --git a/.github/workflows/dotnet-release.yml b/.github/workflows/dotnet-release.yml
index 2877d0583..aacfd115b 100644
--- a/.github/workflows/dotnet-release.yml
+++ b/.github/workflows/dotnet-release.yml
@@ -32,7 +32,7 @@ jobs:
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
- global-json-file: dotnet/global.json
+ dotnet-version: '8.0.x'
- name: Restore dependencies
run: |
dotnet restore -bl
diff --git a/dotnet/sample/AutoGen.Anthropic.Samples/Create_Anthropic_Agent.cs b/dotnet/sample/AutoGen.Anthropic.Samples/Create_Anthropic_Agent.cs
index 031e50685..6f32c3cb4 100644
--- a/dotnet/sample/AutoGen.Anthropic.Samples/Create_Anthropic_Agent.cs
+++ b/dotnet/sample/AutoGen.Anthropic.Samples/Create_Anthropic_Agent.cs
@@ -1,5 +1,5 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
-// AnthropicSamples.cs
+// Create_Anthropic_Agent.cs
using AutoGen.Anthropic.Extensions;
using AutoGen.Anthropic.Utils;
diff --git a/dotnet/sample/AutoGen.Anthropic.Samples/Create_Anthropic_Agent_With_Tool.cs b/dotnet/sample/AutoGen.Anthropic.Samples/Create_Anthropic_Agent_With_Tool.cs
index 26bd32dd1..0324a39ff 100644
--- a/dotnet/sample/AutoGen.Anthropic.Samples/Create_Anthropic_Agent_With_Tool.cs
+++ b/dotnet/sample/AutoGen.Anthropic.Samples/Create_Anthropic_Agent_With_Tool.cs
@@ -1,5 +1,5 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
-// Single_Anthropic_Tool.cs
+// Create_Anthropic_Agent_With_Tool.cs
using AutoGen.Anthropic.DTO;
using AutoGen.Anthropic.Extensions;
diff --git a/dotnet/sample/AutoGen.BasicSamples/CodeSnippet/MiddlewareAgentCodeSnippet.cs b/dotnet/sample/AutoGen.BasicSamples/CodeSnippet/MiddlewareAgentCodeSnippet.cs
index 795606ebc..1b5a9a903 100644
--- a/dotnet/sample/AutoGen.BasicSamples/CodeSnippet/MiddlewareAgentCodeSnippet.cs
+++ b/dotnet/sample/AutoGen.BasicSamples/CodeSnippet/MiddlewareAgentCodeSnippet.cs
@@ -20,8 +20,7 @@ public class MiddlewareAgentCodeSnippet
var middlewareAgent = new MiddlewareAgent(innerAgent: agent);
middlewareAgent.Use(async (messages, options, agent, ct) =>
{
- var lastMessage = messages.Last() as TextMessage;
- if (lastMessage != null && lastMessage.Content.Contains("Hello World"))
+ if (messages.Last() is TextMessage lastMessage && lastMessage.Content.Contains("Hello World"))
{
lastMessage.Content = $"[middleware 0] {lastMessage.Content}";
return lastMessage;
@@ -39,8 +38,7 @@ public class MiddlewareAgentCodeSnippet
#region register_middleware_agent
middlewareAgent = agent.RegisterMiddleware(async (messages, options, agent, ct) =>
{
- var lastMessage = messages.Last() as TextMessage;
- if (lastMessage != null && lastMessage.Content.Contains("Hello World"))
+ if (messages.Last() is TextMessage lastMessage && lastMessage.Content.Contains("Hello World"))
{
lastMessage.Content = $"[middleware 0] {lastMessage.Content}";
return lastMessage;
diff --git a/dotnet/sample/AutoGen.BasicSamples/Example04_Dynamic_GroupChat_Coding_Task.cs b/dotnet/sample/AutoGen.BasicSamples/Example04_Dynamic_GroupChat_Coding_Task.cs
index 47dd8ce66..216059928 100644
--- a/dotnet/sample/AutoGen.BasicSamples/Example04_Dynamic_GroupChat_Coding_Task.cs
+++ b/dotnet/sample/AutoGen.BasicSamples/Example04_Dynamic_GroupChat_Coding_Task.cs
@@ -17,14 +17,18 @@ public partial class Example04_Dynamic_GroupChat_Coding_Task
// setup dotnet interactive
var workDir = Path.Combine(Path.GetTempPath(), "InteractiveService");
if (!Directory.Exists(workDir))
+ {
Directory.CreateDirectory(workDir);
+ }
using var service = new InteractiveService(workDir);
var dotnetInteractiveFunctions = new DotnetInteractiveFunction(service);
var result = Path.Combine(workDir, "result.txt");
if (File.Exists(result))
+ {
File.Delete(result);
+ }
await service.StartAsync(workDir, default);
diff --git a/dotnet/sample/AutoGen.BasicSamples/Example07_Dynamic_GroupChat_Calculate_Fibonacci.cs b/dotnet/sample/AutoGen.BasicSamples/Example07_Dynamic_GroupChat_Calculate_Fibonacci.cs
index 72719c606..004e0f055 100644
--- a/dotnet/sample/AutoGen.BasicSamples/Example07_Dynamic_GroupChat_Calculate_Fibonacci.cs
+++ b/dotnet/sample/AutoGen.BasicSamples/Example07_Dynamic_GroupChat_Calculate_Fibonacci.cs
@@ -225,7 +225,9 @@ public partial class Example07_Dynamic_GroupChat_Calculate_Fibonacci
long the39thFibonacciNumber = 63245986;
var workDir = Path.Combine(Path.GetTempPath(), "InteractiveService");
if (!Directory.Exists(workDir))
+ {
Directory.CreateDirectory(workDir);
+ }
using var service = new InteractiveService(workDir);
var dotnetInteractiveFunctions = new DotnetInteractiveFunction(service);
@@ -329,7 +331,9 @@ public partial class Example07_Dynamic_GroupChat_Calculate_Fibonacci
long the39thFibonacciNumber = 63245986;
var workDir = Path.Combine(Path.GetTempPath(), "InteractiveService");
if (!Directory.Exists(workDir))
+ {
Directory.CreateDirectory(workDir);
+ }
using var service = new InteractiveService(workDir);
var dotnetInteractiveFunctions = new DotnetInteractiveFunction(service);
diff --git a/dotnet/sample/AutoGen.BasicSamples/Example13_OpenAIAgent_JsonMode.cs b/dotnet/sample/AutoGen.BasicSamples/Example13_OpenAIAgent_JsonMode.cs
index 9e5b91ecc..596ab08d0 100644
--- a/dotnet/sample/AutoGen.BasicSamples/Example13_OpenAIAgent_JsonMode.cs
+++ b/dotnet/sample/AutoGen.BasicSamples/Example13_OpenAIAgent_JsonMode.cs
@@ -1,3 +1,5 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Example13_OpenAIAgent_JsonMode.cs
-// this example has been moved to https://github.com/microsoft/autogen/blob/main/dotnet/sample/AutoGen.OpenAI.Sample/Use_Json_Mode.cs
\ No newline at end of file
+
+// this example has been moved to https://github.com/microsoft/autogen/blob/main/dotnet/sample/AutoGen.OpenAI.Sample/Use_Json_Mode.cs
+
diff --git a/dotnet/sample/AutoGen.BasicSamples/Example15_GPT4V_BinaryDataImageMessage.cs b/dotnet/sample/AutoGen.BasicSamples/Example15_GPT4V_BinaryDataImageMessage.cs
index 788122d3f..dee991551 100644
--- a/dotnet/sample/AutoGen.BasicSamples/Example15_GPT4V_BinaryDataImageMessage.cs
+++ b/dotnet/sample/AutoGen.BasicSamples/Example15_GPT4V_BinaryDataImageMessage.cs
@@ -50,7 +50,9 @@ public static class Example15_GPT4V_BinaryDataImageMessage
foreach (string file in Directory.GetFiles(imageResourcePath))
{
if (!_mediaTypeMappings.TryGetValue(Path.GetExtension(file).ToLowerInvariant(), out var mediaType))
+ {
continue;
+ }
using var fs = new FileStream(file, FileMode.Open, FileAccess.Read);
var ms = new MemoryStream();
diff --git a/dotnet/sample/AutoGen.BasicSamples/Example16_OpenAIChatAgent_ConnectToThirdPartyBackend.cs b/dotnet/sample/AutoGen.BasicSamples/Example16_OpenAIChatAgent_ConnectToThirdPartyBackend.cs
index f676e22a2..969f7dc21 100644
--- a/dotnet/sample/AutoGen.BasicSamples/Example16_OpenAIChatAgent_ConnectToThirdPartyBackend.cs
+++ b/dotnet/sample/AutoGen.BasicSamples/Example16_OpenAIChatAgent_ConnectToThirdPartyBackend.cs
@@ -1,3 +1,4 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Example16_OpenAIChatAgent_ConnectToThirdPartyBackend.cs
-// this example has been moved to https://github.com/microsoft/autogen/blob/main/dotnet/sample/AutoGen.OpenAI.Sample/Connect_To_Ollama.cs
\ No newline at end of file
+
+// this example has been moved to https://github.com/microsoft/autogen/blob/main/dotnet/sample/AutoGen.OpenAI.Sample/Connect_To_Ollama.cs
diff --git a/dotnet/sample/AutoGen.BasicSamples/GettingStart/Dynamic_Group_Chat.cs b/dotnet/sample/AutoGen.BasicSamples/GettingStart/Dynamic_Group_Chat.cs
index 9d21bbde7..7acaae4b1 100644
--- a/dotnet/sample/AutoGen.BasicSamples/GettingStart/Dynamic_Group_Chat.cs
+++ b/dotnet/sample/AutoGen.BasicSamples/GettingStart/Dynamic_Group_Chat.cs
@@ -1,5 +1,5 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
-// Dynamic_GroupChat.cs
+// Dynamic_Group_Chat.cs
using AutoGen.Core;
using AutoGen.OpenAI;
diff --git a/dotnet/sample/AutoGen.OpenAI.Sample/Connect_To_Ollama.cs b/dotnet/sample/AutoGen.OpenAI.Sample/Connect_To_Ollama.cs
index b4206b4b6..3823de2a5 100644
--- a/dotnet/sample/AutoGen.OpenAI.Sample/Connect_To_Ollama.cs
+++ b/dotnet/sample/AutoGen.OpenAI.Sample/Connect_To_Ollama.cs
@@ -1,5 +1,6 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
-// Example16_OpenAIChatAgent_ConnectToThirdPartyBackend.cs
+// Connect_To_Ollama.cs
+
#region using_statement
using AutoGen.Core;
using AutoGen.OpenAI.Extension;
diff --git a/dotnet/sample/AutoGen.OpenAI.Sample/Use_Json_Mode.cs b/dotnet/sample/AutoGen.OpenAI.Sample/Use_Json_Mode.cs
index 3bf88be72..d92983c50 100644
--- a/dotnet/sample/AutoGen.OpenAI.Sample/Use_Json_Mode.cs
+++ b/dotnet/sample/AutoGen.OpenAI.Sample/Use_Json_Mode.cs
@@ -1,5 +1,5 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
-// Example13_OpenAIAgent_JsonMode.cs
+// Use_Json_Mode.cs
using System.Text.Json;
using System.Text.Json.Serialization;
diff --git a/dotnet/src/AutoGen.Anthropic/Agent/AnthropicClientAgent.cs b/dotnet/src/AutoGen.Anthropic/Agent/AnthropicClientAgent.cs
index a3ecc1cce..73510baeb 100644
--- a/dotnet/src/AutoGen.Anthropic/Agent/AnthropicClientAgent.cs
+++ b/dotnet/src/AutoGen.Anthropic/Agent/AnthropicClientAgent.cs
@@ -1,4 +1,7 @@
-using System;
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// AnthropicClientAgent.cs
+
+using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
diff --git a/dotnet/src/AutoGen.Anthropic/AnthropicClient.cs b/dotnet/src/AutoGen.Anthropic/AnthropicClient.cs
index dd35638c4..c58b2c195 100644
--- a/dotnet/src/AutoGen.Anthropic/AnthropicClient.cs
+++ b/dotnet/src/AutoGen.Anthropic/AnthropicClient.cs
@@ -48,7 +48,9 @@ public sealed class AnthropicClient : IDisposable
var responseStream = await httpResponseMessage.Content.ReadAsStreamAsync();
if (httpResponseMessage.IsSuccessStatusCode)
+ {
return await DeserializeResponseAsync<ChatCompletionResponse>(responseStream, cancellationToken);
+ }
ErrorResponse res = await DeserializeResponseAsync<ErrorResponse>(responseStream, cancellationToken);
throw new Exception(res.Error?.Message);
diff --git a/dotnet/src/AutoGen.Anthropic/Converters/ContentBaseConverter.cs b/dotnet/src/AutoGen.Anthropic/Converters/ContentBaseConverter.cs
index b41a761dc..3e620f934 100644
--- a/dotnet/src/AutoGen.Anthropic/Converters/ContentBaseConverter.cs
+++ b/dotnet/src/AutoGen.Anthropic/Converters/ContentBaseConverter.cs
@@ -1,12 +1,10 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
-// ContentConverter.cs
-
-using AutoGen.Anthropic.DTO;
-
+// ContentBaseConverter.cs
using System;
using System.Text.Json;
using System.Text.Json.Serialization;
+using AutoGen.Anthropic.DTO;
namespace AutoGen.Anthropic.Converters;
public sealed class ContentBaseConverter : JsonConverter<ContentBase>
diff --git a/dotnet/src/AutoGen.Anthropic/DTO/ChatCompletionRequest.cs b/dotnet/src/AutoGen.Anthropic/DTO/ChatCompletionRequest.cs
index b18461e69..463ee7fc2 100644
--- a/dotnet/src/AutoGen.Anthropic/DTO/ChatCompletionRequest.cs
+++ b/dotnet/src/AutoGen.Anthropic/DTO/ChatCompletionRequest.cs
@@ -1,7 +1,7 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// ChatCompletionRequest.cs
-using System.Text.Json.Serialization;
using System.Collections.Generic;
+using System.Text.Json.Serialization;
namespace AutoGen.Anthropic.DTO;
diff --git a/dotnet/src/AutoGen.Anthropic/DTO/ChatCompletionResponse.cs b/dotnet/src/AutoGen.Anthropic/DTO/ChatCompletionResponse.cs
index 2c6fa100f..fc33aa0e2 100644
--- a/dotnet/src/AutoGen.Anthropic/DTO/ChatCompletionResponse.cs
+++ b/dotnet/src/AutoGen.Anthropic/DTO/ChatCompletionResponse.cs
@@ -1,10 +1,11 @@
-// Copyright (c) Microsoft Corporation. All rights reserved.
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// ChatCompletionResponse.cs
-namespace AutoGen.Anthropic.DTO;
using System.Collections.Generic;
using System.Text.Json.Serialization;
+namespace AutoGen.Anthropic.DTO;
public class ChatCompletionResponse
{
[JsonPropertyName("content")]
diff --git a/dotnet/src/AutoGen.Anthropic/DTO/Content.cs b/dotnet/src/AutoGen.Anthropic/DTO/Content.cs
index ee7a745a1..353cf6ae8 100644
--- a/dotnet/src/AutoGen.Anthropic/DTO/Content.cs
+++ b/dotnet/src/AutoGen.Anthropic/DTO/Content.cs
@@ -1,4 +1,4 @@
-// Copyright (c) Microsoft Corporation. All rights reserved.
+// Copyright (c) Microsoft Corporation. All rights reserved.
// Content.cs
using System.Text.Json.Nodes;
diff --git a/dotnet/src/AutoGen.Anthropic/DTO/ErrorResponse.cs b/dotnet/src/AutoGen.Anthropic/DTO/ErrorResponse.cs
index d02a8f6d1..1a94334c8 100644
--- a/dotnet/src/AutoGen.Anthropic/DTO/ErrorResponse.cs
+++ b/dotnet/src/AutoGen.Anthropic/DTO/ErrorResponse.cs
@@ -1,4 +1,4 @@
-// Copyright (c) Microsoft Corporation. All rights reserved.
+// Copyright (c) Microsoft Corporation. All rights reserved.
// ErrorResponse.cs
using System.Text.Json.Serialization;
diff --git a/dotnet/src/AutoGen.Anthropic/DTO/Tool.cs b/dotnet/src/AutoGen.Anthropic/DTO/Tool.cs
index 41c20dc2a..2a46bc42a 100644
--- a/dotnet/src/AutoGen.Anthropic/DTO/Tool.cs
+++ b/dotnet/src/AutoGen.Anthropic/DTO/Tool.cs
@@ -1,4 +1,4 @@
-// Copyright (c) Microsoft Corporation. All rights reserved.
+// Copyright (c) Microsoft Corporation. All rights reserved.
// Tool.cs
using System.Collections.Generic;
diff --git a/dotnet/src/AutoGen.Anthropic/Utils/AnthropicConstants.cs b/dotnet/src/AutoGen.Anthropic/Utils/AnthropicConstants.cs
index e70572cbd..6fd70cb4e 100644
--- a/dotnet/src/AutoGen.Anthropic/Utils/AnthropicConstants.cs
+++ b/dotnet/src/AutoGen.Anthropic/Utils/AnthropicConstants.cs
@@ -1,5 +1,5 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
-// Constants.cs
+// AnthropicConstants.cs
namespace AutoGen.Anthropic.Utils;
diff --git a/dotnet/src/AutoGen.Core/Message/ToolCallAggregateMessage.cs b/dotnet/src/AutoGen.Core/Message/ToolCallAggregateMessage.cs
index 7781b785e..7d46d5613 100644
--- a/dotnet/src/AutoGen.Core/Message/ToolCallAggregateMessage.cs
+++ b/dotnet/src/AutoGen.Core/Message/ToolCallAggregateMessage.cs
@@ -1,5 +1,5 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
-// FunctionCallAggregateMessage.cs
+// ToolCallAggregateMessage.cs
using System.Collections.Generic;
diff --git a/dotnet/src/AutoGen.Gemini/IGeminiClient.cs b/dotnet/src/AutoGen.Gemini/IGeminiClient.cs
index 2e209e02b..d391a4508 100644
--- a/dotnet/src/AutoGen.Gemini/IGeminiClient.cs
+++ b/dotnet/src/AutoGen.Gemini/IGeminiClient.cs
@@ -1,5 +1,5 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
-// IVertexGeminiClient.cs
+// IGeminiClient.cs
using System.Collections.Generic;
using System.Threading;
diff --git a/dotnet/src/AutoGen.Gemini/VertexGeminiClient.cs b/dotnet/src/AutoGen.Gemini/VertexGeminiClient.cs
index c54f2280d..12a11993c 100644
--- a/dotnet/src/AutoGen.Gemini/VertexGeminiClient.cs
+++ b/dotnet/src/AutoGen.Gemini/VertexGeminiClient.cs
@@ -1,5 +1,5 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
-// IGeminiClient.cs
+// VertexGeminiClient.cs
using System.Collections.Generic;
using System.Threading;
diff --git a/dotnet/src/AutoGen.Ollama/DTOs/Message.cs b/dotnet/src/AutoGen.Ollama/DTOs/Message.cs
index 2e0d891cc..75f622ff7 100644
--- a/dotnet/src/AutoGen.Ollama/DTOs/Message.cs
+++ b/dotnet/src/AutoGen.Ollama/DTOs/Message.cs
@@ -1,5 +1,5 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
-// ChatResponseUpdate.cs
+// Message.cs
using System.Collections.Generic;
using System.Text.Json.Serialization;
diff --git a/dotnet/src/AutoGen.Ollama/Embeddings/ITextEmbeddingService.cs b/dotnet/src/AutoGen.Ollama/Embeddings/ITextEmbeddingService.cs
index 5ce0dc8cc..cce6dbb83 100644
--- a/dotnet/src/AutoGen.Ollama/Embeddings/ITextEmbeddingService.cs
+++ b/dotnet/src/AutoGen.Ollama/Embeddings/ITextEmbeddingService.cs
@@ -1,4 +1,4 @@
-// Copyright (c) Microsoft Corporation. All rights reserved.
+// Copyright (c) Microsoft Corporation. All rights reserved.
// ITextEmbeddingService.cs
using System.Threading;
diff --git a/dotnet/src/AutoGen.Ollama/Embeddings/OllamaTextEmbeddingService.cs b/dotnet/src/AutoGen.Ollama/Embeddings/OllamaTextEmbeddingService.cs
index 2e431e7bc..ea4993eb8 100644
--- a/dotnet/src/AutoGen.Ollama/Embeddings/OllamaTextEmbeddingService.cs
+++ b/dotnet/src/AutoGen.Ollama/Embeddings/OllamaTextEmbeddingService.cs
@@ -1,4 +1,4 @@
-// Copyright (c) Microsoft Corporation. All rights reserved.
+// Copyright (c) Microsoft Corporation. All rights reserved.
// OllamaTextEmbeddingService.cs
using System;
diff --git a/dotnet/src/AutoGen.Ollama/Embeddings/TextEmbeddingsRequest.cs b/dotnet/src/AutoGen.Ollama/Embeddings/TextEmbeddingsRequest.cs
index 7f2531c52..d776b183d 100644
--- a/dotnet/src/AutoGen.Ollama/Embeddings/TextEmbeddingsRequest.cs
+++ b/dotnet/src/AutoGen.Ollama/Embeddings/TextEmbeddingsRequest.cs
@@ -1,4 +1,4 @@
-// Copyright (c) Microsoft Corporation. All rights reserved.
+// Copyright (c) Microsoft Corporation. All rights reserved.
// TextEmbeddingsRequest.cs
using System.Text.Json.Serialization;
diff --git a/dotnet/src/AutoGen.Ollama/Embeddings/TextEmbeddingsResponse.cs b/dotnet/src/AutoGen.Ollama/Embeddings/TextEmbeddingsResponse.cs
index 580059c03..f3ce64b70 100644
--- a/dotnet/src/AutoGen.Ollama/Embeddings/TextEmbeddingsResponse.cs
+++ b/dotnet/src/AutoGen.Ollama/Embeddings/TextEmbeddingsResponse.cs
@@ -1,4 +1,4 @@
-// Copyright (c) Microsoft Corporation. All rights reserved.
+// Copyright (c) Microsoft Corporation. All rights reserved.
// TextEmbeddingsResponse.cs
using System.Text.Json.Serialization;
diff --git a/dotnet/src/AutoGen.SourceGenerator/SourceGeneratorFunctionContract.cs b/dotnet/src/AutoGen.SourceGenerator/SourceGeneratorFunctionContract.cs
index 24e42affa..aa4980379 100644
--- a/dotnet/src/AutoGen.SourceGenerator/SourceGeneratorFunctionContract.cs
+++ b/dotnet/src/AutoGen.SourceGenerator/SourceGeneratorFunctionContract.cs
@@ -1,5 +1,5 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
-// FunctionContract.cs
+// SourceGeneratorFunctionContract.cs
namespace AutoGen.SourceGenerator
{
diff --git a/dotnet/src/AutoGen.WebAPI/OpenAI/DTO/OpenAIMessage.cs b/dotnet/src/AutoGen.WebAPI/OpenAI/DTO/OpenAIMessage.cs
index 3cad9ae36..24cbb72fb 100644
--- a/dotnet/src/AutoGen.WebAPI/OpenAI/DTO/OpenAIMessage.cs
+++ b/dotnet/src/AutoGen.WebAPI/OpenAI/DTO/OpenAIMessage.cs
@@ -1,5 +1,5 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
-// OpenAIChatCompletionOption.cs
+// OpenAIMessage.cs
using System.Text.Json.Serialization;
diff --git a/dotnet/src/AutoGen.WebAPI/OpenAI/DTO/OpenAIStreamOptions.cs b/dotnet/src/AutoGen.WebAPI/OpenAI/DTO/OpenAIStreamOptions.cs
index 3c188b865..7a4985144 100644
--- a/dotnet/src/AutoGen.WebAPI/OpenAI/DTO/OpenAIStreamOptions.cs
+++ b/dotnet/src/AutoGen.WebAPI/OpenAI/DTO/OpenAIStreamOptions.cs
@@ -1,5 +1,5 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
-//
+// OpenAIStreamOptions.cs
using System.Text.Json.Serialization;
diff --git a/dotnet/test/AutoGen.Anthropic.Tests/AnthropicClientAgentTest.cs b/dotnet/test/AutoGen.Anthropic.Tests/AnthropicClientAgentTest.cs
index 552408f1d..085917d41 100644
--- a/dotnet/test/AutoGen.Anthropic.Tests/AnthropicClientAgentTest.cs
+++ b/dotnet/test/AutoGen.Anthropic.Tests/AnthropicClientAgentTest.cs
@@ -188,7 +188,7 @@ public class AnthropicClientAgentTest
IMessage[] chatHistory = [
new TextMessage(Role.User, "what's the weather in Philadelphia?"),
new ToolCallMessage([toolCall], from: "assistant"),
- new ToolCallResultMessage([toolCall], from: "user" ),
+ new ToolCallResultMessage([toolCall], from: "user"),
];
var reply = await agent.SendAsync(chatHistory: chatHistory);
diff --git a/dotnet/test/AutoGen.Anthropic.Tests/AnthropicClientTest.cs b/dotnet/test/AutoGen.Anthropic.Tests/AnthropicClientTest.cs
index 66b7d0077..102e48b9b 100644
--- a/dotnet/test/AutoGen.Anthropic.Tests/AnthropicClientTest.cs
+++ b/dotnet/test/AutoGen.Anthropic.Tests/AnthropicClientTest.cs
@@ -1,4 +1,7 @@
-using System.Text;
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// AnthropicClientTest.cs
+
+using System.Text;
using System.Text.Json;
using System.Text.Json.Nodes;
using System.Text.Json.Serialization;
@@ -59,7 +62,9 @@ public class AnthropicClientTests
foreach (ChatCompletionResponse result in results)
{
if (result.Delta is not null && !string.IsNullOrEmpty(result.Delta.Text))
+ {
sb.Append(result.Delta.Text);
+ }
}
string resultContent = sb.ToString();
diff --git a/dotnet/test/AutoGen.Anthropic.Tests/AnthropicTestFunctionCalls.cs b/dotnet/test/AutoGen.Anthropic.Tests/AnthropicTestFunctionCalls.cs
index 5f1c0971b..8b5466e3a 100644
--- a/dotnet/test/AutoGen.Anthropic.Tests/AnthropicTestFunctionCalls.cs
+++ b/dotnet/test/AutoGen.Anthropic.Tests/AnthropicTestFunctionCalls.cs
@@ -1,5 +1,5 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
-// AnthropicTestFunctions.cs
+// AnthropicTestFunctionCalls.cs
using System.Text.Json;
using System.Text.Json.Serialization;
diff --git a/dotnet/test/AutoGen.Gemini.Tests/GeminiAgentTests.cs b/dotnet/test/AutoGen.Gemini.Tests/GeminiAgentTests.cs
index 6d095845f..c076aee18 100644
--- a/dotnet/test/AutoGen.Gemini.Tests/GeminiAgentTests.cs
+++ b/dotnet/test/AutoGen.Gemini.Tests/GeminiAgentTests.cs
@@ -1,13 +1,13 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// GeminiAgentTests.cs
-using AutoGen.Tests;
-using Google.Cloud.AIPlatform.V1;
using AutoGen.Core;
-using FluentAssertions;
using AutoGen.Gemini.Extension;
-using static Google.Cloud.AIPlatform.V1.Part;
+using AutoGen.Tests;
+using FluentAssertions;
+using Google.Cloud.AIPlatform.V1;
using Xunit.Abstractions;
+using static Google.Cloud.AIPlatform.V1.Part;
namespace AutoGen.Gemini.Tests;
public class GeminiAgentTests
diff --git a/dotnet/test/AutoGen.Gemini.Tests/VertexGeminiClientTests.cs b/dotnet/test/AutoGen.Gemini.Tests/VertexGeminiClientTests.cs
index 8063b7077..fba97aa52 100644
--- a/dotnet/test/AutoGen.Gemini.Tests/VertexGeminiClientTests.cs
+++ b/dotnet/test/AutoGen.Gemini.Tests/VertexGeminiClientTests.cs
@@ -1,5 +1,5 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
-// GeminiVertexClientTests.cs
+// VertexGeminiClientTests.cs
using AutoGen.Tests;
using FluentAssertions;
diff --git a/dotnet/test/AutoGen.Ollama.Tests/OllamaTextEmbeddingServiceTests.cs b/dotnet/test/AutoGen.Ollama.Tests/OllamaTextEmbeddingServiceTests.cs
index 06522bdd8..b7186a3c6 100644
--- a/dotnet/test/AutoGen.Ollama.Tests/OllamaTextEmbeddingServiceTests.cs
+++ b/dotnet/test/AutoGen.Ollama.Tests/OllamaTextEmbeddingServiceTests.cs
@@ -1,4 +1,4 @@
-// Copyright (c) Microsoft Corporation. All rights reserved.
+// Copyright (c) Microsoft Corporation. All rights reserved.
// OllamaTextEmbeddingServiceTests.cs
using AutoGen.Tests;
diff --git a/dotnet/test/AutoGen.SourceGenerator.Tests/FunctionCallTemplateEncodingTests.cs b/dotnet/test/AutoGen.SourceGenerator.Tests/FunctionCallTemplateEncodingTests.cs
index 8ca6e31a8..0b2e211c6 100644
--- a/dotnet/test/AutoGen.SourceGenerator.Tests/FunctionCallTemplateEncodingTests.cs
+++ b/dotnet/test/AutoGen.SourceGenerator.Tests/FunctionCallTemplateEncodingTests.cs
@@ -1,7 +1,9 @@
-// Using directives
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// FunctionCallTemplateEncodingTests.cs
+
using System.Text.Json; // Needed for JsonSerializer
-using Xunit; // Needed for Fact and Assert
using AutoGen.SourceGenerator.Template; // Needed for FunctionCallTemplate
+using Xunit; // Needed for Fact and Assert
namespace AutoGen.SourceGenerator.Tests
{
@@ -89,4 +91,4 @@ namespace AutoGen.SourceGenerator.Tests
Assert.Contains("Description = @\"This is a \"\"parameter\"\" description\"", result);
}
}
-}
\ No newline at end of file
+}
diff --git a/dotnet/test/AutoGen.Tests/GroupChat/GraphTests.cs b/dotnet/test/AutoGen.Tests/GroupChat/GraphTests.cs
index 77e2c99dc..7eeea6743 100644
--- a/dotnet/test/AutoGen.Tests/GroupChat/GraphTests.cs
+++ b/dotnet/test/AutoGen.Tests/GroupChat/GraphTests.cs
@@ -1,4 +1,6 @@
-
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// GraphTests.cs
+
using Xunit;
namespace AutoGen.Tests
diff --git a/dotnet/test/AutoGen.WebAPI.Tests/EchoAgent.cs b/dotnet/test/AutoGen.WebAPI.Tests/EchoAgent.cs
index 64d48d2a0..6f9d217b5 100644
--- a/dotnet/test/AutoGen.WebAPI.Tests/EchoAgent.cs
+++ b/dotnet/test/AutoGen.WebAPI.Tests/EchoAgent.cs
@@ -1,5 +1,5 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
-// OpenAIChatCompletionMiddlewareTests.cs
+// EchoAgent.cs
using System.Runtime.CompilerServices;
using AutoGen.Core;