Skip to content

Commit

Permalink
style: apply dotnet-format changes
Browse files Browse the repository at this point in the history
  • Loading branch information
WeihanLi committed Sep 26, 2023
1 parent 323c82a commit 8213645
Show file tree
Hide file tree
Showing 12 changed files with 28 additions and 28 deletions.
6 changes: 3 additions & 3 deletions dotnet/samples/ApplicationInsightsExample/Program.cs
Expand Up @@ -31,7 +31,7 @@ public sealed class Program
/// <see cref="LogLevel.Information"/> is set by default. <para />
/// <see cref="LogLevel.Trace"/> will enable logging with more detailed information, including sensitive data. Should not be used in production. <para />
/// </remarks>
private static LogLevel s_logLevel = LogLevel.Information;
private const LogLevel MinLogLevel = LogLevel.Information;

/// <summary>
/// The main entry point for the application.
Expand Down Expand Up @@ -94,8 +94,8 @@ private static void ConfigureApplicationInsightsTelemetry(ServiceCollection serv

services.AddLogging(loggingBuilder =>
{
loggingBuilder.AddFilter<ApplicationInsightsLoggerProvider>(logLevel => logLevel == s_logLevel);
loggingBuilder.SetMinimumLevel(s_logLevel);
loggingBuilder.AddFilter<ApplicationInsightsLoggerProvider>(logLevel => logLevel == MinLogLevel);
loggingBuilder.SetMinimumLevel(MinLogLevel);
});

services.AddApplicationInsightsTelemetryWorkerService(options =>
Expand Down
Expand Up @@ -11,7 +11,7 @@
// ReSharper disable once InconsistentNaming
internal static class Example48_GroundednessChecks
{
private static string s_groundingText = @"""I am by birth a Genevese, and my family is one of the most distinguished of that republic.
private const string GroundingText = @"""I am by birth a Genevese, and my family is one of the most distinguished of that republic.
My ancestors had been for many years counsellors and syndics, and my father had filled several public situations
with honour and reputation.He was respected by all who knew him for his integrity and indefatigable attention
to public business.He passed his younger days perpetually occupied by the affairs of his country; a variety
Expand Down Expand Up @@ -94,7 +94,7 @@ public static async Task GroundednessCheckingAsync()
Console.WriteLine(extractionResult);

context.Variables.Update(extractionResult);
context.Variables.Set("reference_context", s_groundingText);
context.Variables.Set("reference_context", GroundingText);

var groundingResult = (await kernel.RunAsync(context.Variables, reference_check)).GetValue<string>();

Expand Down Expand Up @@ -141,7 +141,7 @@ public static async Task PlanningWithGroundednessAsync()
var plan = await planner.CreatePlanAsync(ask);
Console.WriteLine(plan.ToPlanWithGoalString());

var results = await kernel.RunAsync(s_groundingText, plan);
var results = await kernel.RunAsync(GroundingText, plan);
Console.WriteLine(results.GetValue<string>());
}
}
Expand Down
2 changes: 1 addition & 1 deletion dotnet/samples/KernelSyntaxExamples/TestConfiguration.cs
Expand Up @@ -7,7 +7,7 @@

public sealed class TestConfiguration
{
private IConfigurationRoot _configRoot;
private readonly IConfigurationRoot _configRoot;
private static TestConfiguration? s_instance;

private TestConfiguration(IConfigurationRoot configRoot)
Expand Down
Expand Up @@ -53,28 +53,28 @@ private protected ClientBase(ILoggerFactory? loggerFactory = null)
/// <summary>
/// Instance of <see cref="Meter"/> for metrics.
/// </summary>
private static Meter s_meter = new(typeof(ClientBase).Assembly.GetName().Name);
private static readonly Meter s_meter = new(typeof(ClientBase).Assembly.GetName().Name);

/// <summary>
/// Instance of <see cref="Counter{T}"/> to keep track of the number of prompt tokens used.
/// </summary>
private static Counter<int> s_promptTokensCounter =
private static readonly Counter<int> s_promptTokensCounter =
s_meter.CreateCounter<int>(
name: "SK.Connectors.OpenAI.PromptTokens",
description: "Number of prompt tokens used");

/// <summary>
/// Instance of <see cref="Counter{T}"/> to keep track of the number of completion tokens used.
/// </summary>
private static Counter<int> s_completionTokensCounter =
private static readonly Counter<int> s_completionTokensCounter =
s_meter.CreateCounter<int>(
name: "SK.Connectors.OpenAI.CompletionTokens",
description: "Number of completion tokens used");

/// <summary>
/// Instance of <see cref="Counter{T}"/> to keep track of the total number of tokens used.
/// </summary>
private static Counter<int> s_totalTokensCounter =
private static readonly Counter<int> s_totalTokensCounter =
s_meter.CreateCounter<int>(
name: "SK.Connectors.OpenAI.TotalTokens",
description: "Total number of tokens used");
Expand Down
Expand Up @@ -320,10 +320,10 @@ protected virtual void Dispose(bool disposing)

#region private ================================================================================

private Disposer _disposer;
private object _lock = new();
private readonly Disposer _disposer;
private readonly object _lock = new();

private string _database;
private readonly string _database;

private static ClientRequestProperties GetClientRequestProperties() => new()
{
Expand Down
Expand Up @@ -56,7 +56,7 @@ public class WeaviateMemoryStore : IMemoryStore
private readonly ILogger _logger;
private readonly Uri? _endpoint = null;
private readonly string? _apiVersion;
private string? _apiKey;
private readonly string? _apiKey;

/// <summary>
/// Initializes a new instance of the <see cref="WeaviateMemoryStore"/> class.
Expand Down
Expand Up @@ -31,10 +31,10 @@ public sealed class OobaboogaTextCompletionTests : IDisposable
private const string CompletionText = "fake-test";
private const string CompletionMultiText = "Hello, my name is";

private HttpMessageHandlerStub _messageHandlerStub;
private HttpClient _httpClient;
private Uri _endPointUri;
private string _streamCompletionResponseStub;
private readonly HttpMessageHandlerStub _messageHandlerStub;
private readonly HttpClient _httpClient;
private readonly Uri _endPointUri;
private readonly string _streamCompletionResponseStub;

public OobaboogaTextCompletionTests(ITestOutputHelper output)
{
Expand Down
Expand Up @@ -15,10 +15,10 @@ namespace SemanticKernel.Connectors.UnitTests.OpenAI.ChatCompletionWithData;
/// </summary>
public sealed class AzureChatCompletionWithDataTests : IDisposable
{
private AzureChatCompletionWithDataConfig _config;
private readonly AzureChatCompletionWithDataConfig _config;

private HttpMessageHandlerStub _messageHandlerStub;
private HttpClient _httpClient;
private readonly HttpMessageHandlerStub _messageHandlerStub;
private readonly HttpClient _httpClient;

public AzureChatCompletionWithDataTests()
{
Expand Down
Expand Up @@ -21,13 +21,13 @@ internal class WebSocketTestServer : IDisposable
private readonly CancellationTokenSource _socketCancellationTokenSource;
private bool _serverIsRunning;

private Func<ArraySegment<byte>, List<ArraySegment<byte>>> _arraySegmentHandler;
private readonly Func<ArraySegment<byte>, List<ArraySegment<byte>>> _arraySegmentHandler;
private readonly ConcurrentDictionary<Guid, ConcurrentQueue<byte[]>> _requestContentQueues;
private readonly ConcurrentBag<Task> _runningTasks = new();

private readonly ConcurrentDictionary<Guid, ConnectedClient> _clients = new();

private Task? _handleRequestTask = null;
private readonly Task? _handleRequestTask = null;

public TimeSpan RequestProcessingDelay { get; set; } = TimeSpan.Zero;
public TimeSpan SegmentMessageDelay { get; set; } = TimeSpan.Zero;
Expand Down
Expand Up @@ -17,7 +17,7 @@ internal sealed class QueryStringBuilder : IQueryStringBuilder
/// <summary>
/// Query string parameter serializers.
/// </summary>
private static Dictionary<RestApiOperationParameterStyle, Func<RestApiOperationParameter, string, string>> s_queryStringParameterSerializers = new()
private static readonly Dictionary<RestApiOperationParameterStyle, Func<RestApiOperationParameter, string, string>> s_queryStringParameterSerializers = new()
{
{ RestApiOperationParameterStyle.Form, FormStyleParameterSerializer.Serialize },
{ RestApiOperationParameterStyle.SpaceDelimited, SpaceDelimitedStyleParameterSerializer.Serialize },
Expand Down
Expand Up @@ -30,7 +30,7 @@ public sealed class KernelAIPluginExtensionsTests : IDisposable
/// <summary>
/// IKernel instance.
/// </summary>
private IKernel _kernel;
private readonly IKernel _kernel;

/// <summary>
/// Creates an instance of a <see cref="KernelAIPluginExtensionsTests"/> class.
Expand Down
Expand Up @@ -23,8 +23,8 @@ public sealed class OobaboogaTextCompletionTests : IDisposable
private const int StreamingPort = 5005;

private readonly IConfigurationRoot _configuration;
private List<ClientWebSocket> _webSockets = new();
private Func<ClientWebSocket> _webSocketFactory;
private readonly List<ClientWebSocket> _webSockets = new();
private readonly Func<ClientWebSocket> _webSocketFactory;

public OobaboogaTextCompletionTests()
{
Expand Down

0 comments on commit 8213645

Please sign in to comment.