Skip to content

Commit

Permalink
Merge branch 'microsoft:main' into azure-sql-vector
Browse files Browse the repository at this point in the history
  • Loading branch information
cincuranet committed May 15, 2024
2 parents cb80774 + cf91bc6 commit d19420d
Show file tree
Hide file tree
Showing 313 changed files with 2,038 additions and 1,085 deletions.
7 changes: 6 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -158,13 +158,18 @@ dotnet_diagnostic.CA1032.severity = none # We're using RCS1194 which seems to co
dotnet_diagnostic.CA1034.severity = none # Do not nest type. Alternatively, change its accessibility so that it is not externally visible
dotnet_diagnostic.CA1062.severity = none # Disable null check, C# already does it for us
dotnet_diagnostic.CA1303.severity = none # Do not pass literals as localized parameters
dotnet_diagnostic.CA1305.severity = none # Operation could vary based on current user's locale settings
dotnet_diagnostic.CA1307.severity = none # Operation has an overload that takes a StringComparison
dotnet_diagnostic.CA1508.severity = none # Avoid dead conditional code. Too many false positives.
dotnet_diagnostic.CA1510.severity = none
dotnet_diagnostic.CA1510.severity = none # ArgumentNullException.Throw
dotnet_diagnostic.CA1512.severity = none # ArgumentOutOfRangeException.Throw
dotnet_diagnostic.CA1515.severity = none # Making public types from exes internal
dotnet_diagnostic.CA1805.severity = none # Member is explicitly initialized to its default value
dotnet_diagnostic.CA1822.severity = none # Member does not access instance data and can be marked as static
dotnet_diagnostic.CA1848.severity = none # For improved performance, use the LoggerMessage delegates
dotnet_diagnostic.CA1849.severity = none # Use async equivalent; analyzer is currently noisy
dotnet_diagnostic.CA1865.severity = none # StartsWith(char)
dotnet_diagnostic.CA1867.severity = none # EndsWith(char)
dotnet_diagnostic.CA2007.severity = none # Do not directly await a Task
dotnet_diagnostic.CA2225.severity = none # Operator overloads have named alternates
dotnet_diagnostic.CA2227.severity = none # Change to be read-only by removing the property setter
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/dotnet-build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ jobs:
run: |
export UT_PROJECTS=$(find ./dotnet -type f -name "*.UnitTests.csproj" | grep -v -E "(Experimental.Orchestration.Flow.UnitTests.csproj|Experimental.Assistants.UnitTests.csproj)" | tr '\n' ' ')
for project in $UT_PROJECTS; do
dotnet test -c ${{ matrix.configuration }} $project --no-build -v Normal --logger trx --collect:"XPlat Code Coverage" --results-directory:"TestResults/Coverage/"
dotnet test -c ${{ matrix.configuration }} $project --no-build -v Normal --logger trx --collect:"XPlat Code Coverage" --results-directory:"TestResults/Coverage/" -- DataCollectionRunSettings.DataCollectors.DataCollector.Configuration.ExcludeByAttribute=ObsoleteAttribute,GeneratedCodeAttribute,CompilerGeneratedAttribute,ExcludeFromCodeCoverageAttribute
done
- name: Run Integration Tests
Expand Down
8 changes: 4 additions & 4 deletions docs/decisions/0044-OTel-semantic-convention.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,13 @@ block-beta
columns 1
Models
blockArrowId1<["&nbsp;&nbsp;&nbsp;"]>(y)
block:Connectors
block:Clients
columns 3
ConnectorTypeClientA["Instrumented client SDK<br>(i.e. Azure OpenAI client)"]
ConnectorTypeClientB["Un-instrumented Client SDK"]
ConnectorTypeClientC["Custom client on REST API<br>(i.e. HuggingFaceClient)"]
end
Services["AI Services"]
Connectors["AI Connectors"]
blockArrowId2<["&nbsp;&nbsp;&nbsp;"]>(y)
SemanticKernel["Semantic Kernel"]
block:Kernel
Expand Down Expand Up @@ -259,8 +259,8 @@ internal static class ModelDiagnostics
private static readonly string s_namespace = typeof(ModelDiagnostics).Namespace;
private static readonly ActivitySource s_activitySource = new(s_namespace);

private const string EnableModelDiagnosticsSettingName = "Microsoft.SemanticKernel.Experimental.EnableModelDiagnostics";
private const string EnableSensitiveEventsSettingName = "Microsoft.SemanticKernel.Experimental.EnableModelDiagnosticsWithSensitiveData";
private const string EnableModelDiagnosticsSettingName = "Microsoft.SemanticKernel.Experimental.GenAI.EnableOTelDiagnostics";
private const string EnableSensitiveEventsSettingName = "Microsoft.SemanticKernel.Experimental.GenAI.EnableOTelDiagnosticsSensitive";

private static readonly bool s_enableSensitiveEvents = AppContextSwitchHelper.GetConfigValue(EnableSensitiveEventsSettingName);
private static readonly bool s_enableModelDiagnostics = AppContextSwitchHelper.GetConfigValue(EnableModelDiagnosticsSettingName) || s_enableSensitiveEvents;
Expand Down
33 changes: 18 additions & 15 deletions dotnet/SK-dotnet.sln
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PromptTemplates.Liquid.Unit
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Functions.Prompty.UnitTests", "src\Functions\Functions.Prompty.UnitTests\Functions.Prompty.UnitTests.csproj", "{AD787471-5E43-44DF-BF3E-5CD26C765B4E}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ContentSafety", "samples\Demos\ContentSafety\ContentSafety.csproj", "{6EF9663D-976C-4A27-B8D3-8B1E63BA3BF2}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ContentSafety", "samples\Demos\ContentSafety\ContentSafety.csproj", "{6EF9663D-976C-4A27-B8D3-8B1E63BA3BF2}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Concepts", "samples\Concepts\Concepts.csproj", "{925B1185-8B58-4E2D-95C9-4CA0BA9364E5}"
EndProject
Expand All @@ -304,6 +304,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Connectors.Memory.SqlServer
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CodeInterpreterPlugin", "samples\Demos\CodeInterpreterPlugin\CodeInterpreterPlugin.csproj", "{3ED53702-0E53-473A-A0F4-645DB33541C2}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TimePlugin", "samples\Demos\TimePlugin\TimePlugin.csproj", "{F312FCE1-12D7-4DEF-BC29-2FF6618509F3}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -671,6 +673,12 @@ Global
{1D98CF16-5156-40F0-91F0-76294B153DB3}.Publish|Any CPU.Build.0 = Debug|Any CPU
{1D98CF16-5156-40F0-91F0-76294B153DB3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1D98CF16-5156-40F0-91F0-76294B153DB3}.Release|Any CPU.Build.0 = Release|Any CPU
{87DA81FE-112E-4AF5-BEFB-0B91B993F749}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{87DA81FE-112E-4AF5-BEFB-0B91B993F749}.Debug|Any CPU.Build.0 = Debug|Any CPU
{87DA81FE-112E-4AF5-BEFB-0B91B993F749}.Publish|Any CPU.ActiveCfg = Debug|Any CPU
{87DA81FE-112E-4AF5-BEFB-0B91B993F749}.Publish|Any CPU.Build.0 = Debug|Any CPU
{87DA81FE-112E-4AF5-BEFB-0B91B993F749}.Release|Any CPU.ActiveCfg = Release|Any CPU
{87DA81FE-112E-4AF5-BEFB-0B91B993F749}.Release|Any CPU.Build.0 = Release|Any CPU
{12B06019-740B-466D-A9E0-F05BC123A47D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{12B06019-740B-466D-A9E0-F05BC123A47D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{12B06019-740B-466D-A9E0-F05BC123A47D}.Publish|Any CPU.ActiveCfg = Publish|Any CPU
Expand Down Expand Up @@ -701,18 +709,6 @@ Global
{6EF9663D-976C-4A27-B8D3-8B1E63BA3BF2}.Publish|Any CPU.Build.0 = Debug|Any CPU
{6EF9663D-976C-4A27-B8D3-8B1E63BA3BF2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6EF9663D-976C-4A27-B8D3-8B1E63BA3BF2}.Release|Any CPU.Build.0 = Release|Any CPU
{87DA81FE-112E-4AF5-BEFB-0B91B993F749}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{87DA81FE-112E-4AF5-BEFB-0B91B993F749}.Debug|Any CPU.Build.0 = Debug|Any CPU
{87DA81FE-112E-4AF5-BEFB-0B91B993F749}.Publish|Any CPU.ActiveCfg = Debug|Any CPU
{87DA81FE-112E-4AF5-BEFB-0B91B993F749}.Publish|Any CPU.Build.0 = Debug|Any CPU
{87DA81FE-112E-4AF5-BEFB-0B91B993F749}.Release|Any CPU.ActiveCfg = Release|Any CPU
{87DA81FE-112E-4AF5-BEFB-0B91B993F749}.Release|Any CPU.Build.0 = Release|Any CPU
{6EF9663D-976C-4A27-B8D3-8B1E63BA3BF2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6EF9663D-976C-4A27-B8D3-8B1E63BA3BF2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6EF9663D-976C-4A27-B8D3-8B1E63BA3BF2}.Publish|Any CPU.ActiveCfg = Debug|Any CPU
{6EF9663D-976C-4A27-B8D3-8B1E63BA3BF2}.Publish|Any CPU.Build.0 = Debug|Any CPU
{6EF9663D-976C-4A27-B8D3-8B1E63BA3BF2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6EF9663D-976C-4A27-B8D3-8B1E63BA3BF2}.Release|Any CPU.Build.0 = Release|Any CPU
{925B1185-8B58-4E2D-95C9-4CA0BA9364E5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{925B1185-8B58-4E2D-95C9-4CA0BA9364E5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{925B1185-8B58-4E2D-95C9-4CA0BA9364E5}.Publish|Any CPU.ActiveCfg = Debug|Any CPU
Expand All @@ -737,6 +733,12 @@ Global
{3ED53702-0E53-473A-A0F4-645DB33541C2}.Publish|Any CPU.Build.0 = Debug|Any CPU
{3ED53702-0E53-473A-A0F4-645DB33541C2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3ED53702-0E53-473A-A0F4-645DB33541C2}.Release|Any CPU.Build.0 = Release|Any CPU
{F312FCE1-12D7-4DEF-BC29-2FF6618509F3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F312FCE1-12D7-4DEF-BC29-2FF6618509F3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F312FCE1-12D7-4DEF-BC29-2FF6618509F3}.Publish|Any CPU.ActiveCfg = Debug|Any CPU
{F312FCE1-12D7-4DEF-BC29-2FF6618509F3}.Publish|Any CPU.Build.0 = Debug|Any CPU
{F312FCE1-12D7-4DEF-BC29-2FF6618509F3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F312FCE1-12D7-4DEF-BC29-2FF6618509F3}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down Expand Up @@ -827,17 +829,18 @@ Global
{5C813F83-9FD8-462A-9B38-865CA01C384C} = {5D4C0700-BBB5-418F-A7B2-F392B9A18263}
{D5E4C960-53B3-4C35-99C1-1BA97AECC489} = {5D4C0700-BBB5-418F-A7B2-F392B9A18263}
{1D98CF16-5156-40F0-91F0-76294B153DB3} = {FA3720F1-C99A-49B2-9577-A940257098BF}
{87DA81FE-112E-4AF5-BEFB-0B91B993F749} = {FA3720F1-C99A-49B2-9577-A940257098BF}
{77E141BA-AF5E-4C01-A970-6C07AC3CD55A} = {4D3DAE63-41C6-4E1C-A35A-E77BDFC40675}
{12B06019-740B-466D-A9E0-F05BC123A47D} = {9ECD1AA0-75B3-4E25-B0B5-9F0945B64974}
{66D94E25-9B63-4C29-B7A1-3DFA17A90745} = {078F96B4-09E1-4E0E-B214-F71A4F4BF633}
{CC6DEE89-57AA-494D-B40D-B09E1CCC6FAD} = {078F96B4-09E1-4E0E-B214-F71A4F4BF633}
{AD787471-5E43-44DF-BF3E-5CD26C765B4E} = {9ECD1AA0-75B3-4E25-B0B5-9F0945B64974}
{87DA81FE-112E-4AF5-BEFB-0B91B993F749} = {FA3720F1-C99A-49B2-9577-A940257098BF}
{77E141BA-AF5E-4C01-A970-6C07AC3CD55A} = {4D3DAE63-41C6-4E1C-A35A-E77BDFC40675}
{6EF9663D-976C-4A27-B8D3-8B1E63BA3BF2} = {5D4C0700-BBB5-418F-A7B2-F392B9A18263}
{925B1185-8B58-4E2D-95C9-4CA0BA9364E5} = {FA3720F1-C99A-49B2-9577-A940257098BF}
{6B56D8EE-9991-43E3-90B2-B8F5C5CE77C2} = {5D4C0700-BBB5-418F-A7B2-F392B9A18263}
{24B8041B-92C6-4BB3-A699-C593AF5A870F} = {24503383-A8C4-4255-9998-28D70FE8E99A}
{3ED53702-0E53-473A-A0F4-645DB33541C2} = {5D4C0700-BBB5-418F-A7B2-F392B9A18263}
{F312FCE1-12D7-4DEF-BC29-2FF6618509F3} = {5D4C0700-BBB5-418F-A7B2-F392B9A18263}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {FBDC56A3-86AD-4323-AA0F-201E59123B83}
Expand Down
1 change: 1 addition & 0 deletions dotnet/code-coverage.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ foreach ($project in $testProjects) {
dotnet test $testProjectPath `
--collect:"XPlat Code Coverage" `
--results-directory:$coverageOutputPath `
-- DataCollectionRunSettings.DataCollectors.DataCollector.Configuration.ExcludeByAttribute=ObsoleteAttribute,GeneratedCodeAttribute,CompilerGeneratedAttribute,ExcludeFromCodeCoverageAttribute `

}

Expand Down
2 changes: 1 addition & 1 deletion dotnet/docs/EXPERIMENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ You can use the following diagnostic IDs to ignore warnings or errors for a part

```xml
<PropertyGroup>
<NoWarn>SKEXP0001,SKEXP0010</NoWarn>
<NoWarn>$(NoWarn);SKEXP0001,SKEXP0010</NoWarn>
</PropertyGroup>
```

Expand Down
6 changes: 3 additions & 3 deletions dotnet/docs/TELEMETRY.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Telemetry

Telemetry in Semantic Kernel (SK) .NET implementation includes _logging_, _metering_ and _tracing_.
The code is instrumented using native .NET instrumentation tools, which means that it's possible to use different monitoring platforms (e.g. Application Insights, Prometheus, Grafana etc.).
The code is instrumented using native .NET instrumentation tools, which means that it's possible to use different monitoring platforms (e.g. Application Insights, Aspire dashboard, Prometheus, Grafana etc.).

Code example using Application Insights can be found [here](https://github.com/microsoft/semantic-kernel/blob/main/dotnet/samples/TelemetryExample).
Code example using Application Insights can be found [here](../samples/Demos/TelemetryWithAppInsights/).

## Logging

Expand Down Expand Up @@ -108,7 +108,7 @@ Tracing is implemented with `Activity` class from `System.Diagnostics` namespace
Available activity sources:

- _Microsoft.SemanticKernel.Planning_ - creates activities for all planners.
- _Microsoft.SemanticKernel_ - creates activities for `KernelFunction`.
- _Microsoft.SemanticKernel_ - creates activities for `KernelFunction` as well as requests to models.

### Examples

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ private void DisplayMessages(IEnumerable<IChatMessage> messages, IAgent? agent =
private void DisplayMessage(IChatMessage message, IAgent? agent = null)
{
Console.WriteLine($"[{message.Id}]");
if (agent != null)
if (agent is not null)
{
Console.WriteLine($"# {message.Role}: ({agent.Name}) {message.Content}");
}
Expand Down
2 changes: 1 addition & 1 deletion dotnet/samples/Concepts/Agents/Legacy_AgentDelegation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public async Task RunAsync()
{
Console.WriteLine("======== Example71_AgentDelegation ========");

if (TestConfiguration.OpenAI.ApiKey == null)
if (TestConfiguration.OpenAI.ApiKey is null)
{
Console.WriteLine("OpenAI apiKey not found. Skipping example.");
return;
Expand Down
4 changes: 2 additions & 2 deletions dotnet/samples/Concepts/Agents/Legacy_AgentTools.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public async Task RunRetrievalToolAsync()

Console.WriteLine("======== Using Retrieval tool ========");

if (TestConfiguration.OpenAI.ApiKey == null)
if (TestConfiguration.OpenAI.ApiKey is null)
{
Console.WriteLine("OpenAI apiKey not found. Skipping example.");
return;
Expand Down Expand Up @@ -125,7 +125,7 @@ public async Task RunRetrievalToolAsync()
params string[] questions)
{
string[]? fileIds = null;
if (fileId != null)
if (fileId is not null)
{
fileIds = [fileId];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public async Task RunAsync()
string chatModelId = TestConfiguration.AzureOpenAI.ChatModelId;
string endpoint = TestConfiguration.AzureOpenAI.Endpoint;

if (apiKey == null || chatDeploymentName == null || chatModelId == null || endpoint == null)
if (apiKey is null || chatDeploymentName is null || chatModelId is null || endpoint is null)
{
Console.WriteLine("Azure endpoint, apiKey, deploymentName or modelId not found. Skipping example.");
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,15 +111,4 @@ await foreach (StreamingChatMessageContent chatUpdate in chatCompletionService.G
Console.WriteLine(message);
}
}

/// <summary>
/// Add enough new lines to clear the console window.
/// </summary>
private void ClearDisplayByAddingEmptyLines()
{
for (int i = 0; i < System.Console.WindowHeight - 2; i++)
{
Console.WriteLine();
}
}
}
Loading

0 comments on commit d19420d

Please sign in to comment.