Skip to content

Commit

Permalink
Merge branch 'deploy' of https://github.com/glahaye/semantic-kernel i…
Browse files Browse the repository at this point in the history
…nto deploy
  • Loading branch information
glahaye committed May 2, 2023
2 parents e5cdd06 + a47ee6b commit 2228503
Show file tree
Hide file tree
Showing 183 changed files with 4,278 additions and 1,969 deletions.
17 changes: 15 additions & 2 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -131,12 +131,17 @@ dotnet_diagnostic.CA2201.severity = warning # Exception type System.Exception is

dotnet_naming_style.pascal_case_style.capitalization = pascal_case

dotnet_naming_style.camel_case_style.capitalization = camel_case

dotnet_naming_style.static_underscored.capitalization = camel_case
dotnet_naming_style.static_underscored.required_prefix = s_

dotnet_naming_style.underscored.capitalization = camel_case
dotnet_naming_style.underscored.required_prefix = _

dotnet_naming_style.uppercase_with_underscore_separator.capitalization = all_upper
dotnet_naming_style.uppercase_with_underscore_separator.word_separator = _

dotnet_naming_style.end_in_async.required_prefix =
dotnet_naming_style.end_in_async.required_suffix = Async
dotnet_naming_style.end_in_async.capitalization = pascal_case
Expand All @@ -148,6 +153,10 @@ dotnet_naming_symbols.constant_fields.applicable_kinds = field
dotnet_naming_symbols.constant_fields.applicable_accessibilities = *
dotnet_naming_symbols.constant_fields.required_modifiers = const

dotnet_naming_symbols.local_constant.applicable_kinds = local
dotnet_naming_symbols.local_constant.applicable_accessibilities = *
dotnet_naming_symbols.local_constant.required_modifiers = const

dotnet_naming_symbols.private_static_fields.applicable_kinds = field
dotnet_naming_symbols.private_static_fields.applicable_accessibilities = private
dotnet_naming_symbols.private_static_fields.required_modifiers = static
Expand All @@ -161,9 +170,13 @@ dotnet_naming_symbols.any_async_methods.required_modifiers = async

# Rules

dotnet_naming_rule.constant_fields_should_be_pascal_case.severity = error
dotnet_naming_rule.constant_fields_should_be_pascal_case.symbols = constant_fields
dotnet_naming_rule.constant_fields_should_be_pascal_case.symbols = constant_fields
dotnet_naming_rule.constant_fields_should_be_pascal_case.style = pascal_case_style
dotnet_naming_rule.constant_fields_should_be_pascal_case.severity = error

dotnet_naming_rule.local_constant_should_be_pascal_case.symbols = local_constant
dotnet_naming_rule.local_constant_should_be_pascal_case.style = pascal_case_style
dotnet_naming_rule.local_constant_should_be_pascal_case.severity = error

dotnet_naming_rule.private_static_fields_underscored.symbols = private_static_fields
dotnet_naming_rule.private_static_fields_underscored.style = static_underscored
Expand Down
24 changes: 8 additions & 16 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -1,34 +1,26 @@
# Add 'kernel' label to any change within the 'dotnet/src' that's not 'SemanticKernel' or 'SemanticKernel.Abstractions' directory
# Add 'kernel' label to any change within Connectors, Extensions, Skills, and tests directories
kernel:
- any: ["dotnet/src/**/*", "dotnet/src/*"]
- all:
[
"!dotnet/src/SemanticKernel/*",
"!dotnet/src/SemanticKernel/**/*",
"!dotnet/src/SemanticKernel.Abstractions/*",
"!dotnet/src/SemanticKernel.Abstractions/**/*",
]
- "dotnet/src/Connectors/**/*"
- "dotnet/src/Extensions/**/*"
- "dotnet/src/Skills/**/*"
- "dotnet/src/IntegrationTests/**/*"
- "dotnet/src/SemanticKernel.UnitTests/**/*"

# Add 'kernel.core' label to any change within the 'SemanticKernel' or 'SemanticKernel.Abstractions' directory
# Add 'kernel.core' label to any change within the 'SemanticKernel', 'SemanticKernel.Abstractions', or 'SemanticKernel.MetaPackage' directories
kernel.core:
- dotnet/src/SemanticKernel/*
- dotnet/src/SemanticKernel/**/*
- dotnet/src/SemanticKernel.Abstractions/*
- dotnet/src/SemanticKernel.Abstractions/**/*
- dotnet/src/SemanticKernel.MetaPackage/**/*

# Add 'python' label to any change within the 'python' directory
python:
- python/*
- python/**/*

# Add 'samples' label to any change within the 'samples' directory
samples:
- samples/*
- samples/**/*

# Add '.NET' label to any change within samples or kernel 'dotnet' directories.
.NET:
- dotnet/src/*
- dotnet/src/**/*
- samples/**/dotnet/**/*
- samples/**/dotnet/*
82 changes: 41 additions & 41 deletions .github/workflows/dotnet-integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,53 +7,53 @@ name: dotnet-integration-tests
on:
workflow_dispatch:
push:
branches: [ "main", "feature*" ]
branches: ["main", "feature*"]

permissions:
contents: read

jobs:
integration-tests:
strategy:
matrix:
os: [ubuntu-latest]
configuration: [Debug]
matrix:
os: [ubuntu-latest]
configuration: [Debug]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
with:
clean: true

- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 6.0.x

- name: Find projects
shell: bash
run: echo "projects=$(find ./dotnet -type f -name "*.IntegrationTests.csproj" | tr '\n' ' ')" >> $GITHUB_ENV

- name: Integration Tests
shell: bash
env: # Set Azure credentials secret as an input
AzureOpenAI__Label: azure-text-davinci-003
AzureOpenAIEmbedding__Label: azure-text-embedding-ada-002
AzureOpenAI__DeploymentName: ${{ vars.AZUREOPENAI__DEPLOYMENTNAME }}
AzureOpenAIEmbeddings__DeploymentName: ${{ vars.AZUREOPENAIEMBEDDING__DEPLOYMENTNAME }}
AzureOpenAI__Endpoint: ${{ secrets.AZUREOPENAI__ENDPOINT }}
AzureOpenAIEmbeddings__Endpoint: ${{ secrets.AZUREOPENAI__ENDPOINT }}
AzureOpenAI__ApiKey: ${{ secrets.AZUREOPENAI__APIKEY }}
AzureOpenAIEmbeddings__ApiKey: ${{ secrets.AZUREOPENAI__APIKEY }}
Bing__ApiKey: ${{ secrets.BING__APIKEY }}
OpenAI__ApiKey: ${{ secrets.OPENAI__APIKEY }}
run: |
for project in ${{ env.projects }}; do
dotnet test $project --verbosity normal --logger trx --results-directory ./TestResults --configuration ${{ matrix.configuration }}
done
- name: Upload dotnet test results
uses: actions/upload-artifact@v3
with:
name: dotnet-testresults-${{ matrix.configuration }}
path: ./TestResults
if: ${{ always() }}
- uses: actions/checkout@v3
with:
clean: true

- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 6.0.x

- name: Find projects
shell: bash
run: echo "projects=$(find ./dotnet -type f -name "*IntegrationTests.csproj" | tr '\n' ' ')" >> $GITHUB_ENV

- name: Integration Tests
shell: bash
env: # Set Azure credentials secret as an input
AzureOpenAI__Label: azure-text-davinci-003
AzureOpenAIEmbedding__Label: azure-text-embedding-ada-002
AzureOpenAI__DeploymentName: ${{ vars.AZUREOPENAI__DEPLOYMENTNAME }}
AzureOpenAIEmbeddings__DeploymentName: ${{ vars.AZUREOPENAIEMBEDDING__DEPLOYMENTNAME }}
AzureOpenAI__Endpoint: ${{ secrets.AZUREOPENAI__ENDPOINT }}
AzureOpenAIEmbeddings__Endpoint: ${{ secrets.AZUREOPENAI__ENDPOINT }}
AzureOpenAI__ApiKey: ${{ secrets.AZUREOPENAI__APIKEY }}
AzureOpenAIEmbeddings__ApiKey: ${{ secrets.AZUREOPENAI__APIKEY }}
Bing__ApiKey: ${{ secrets.BING__APIKEY }}
OpenAI__ApiKey: ${{ secrets.OPENAI__APIKEY }}
run: |
for project in ${{ env.projects }}; do
dotnet test $project --verbosity normal --logger trx --results-directory ./TestResults --configuration ${{ matrix.configuration }}
done
- name: Upload dotnet test results
uses: actions/upload-artifact@v3
with:
name: dotnet-testresults-${{ matrix.configuration }}
path: ./TestResults
if: ${{ always() }}
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ tips on how you can make reporting your issue as effective as possible.

### Where to Report

New issues can be reported in our [list of issues](https://github.com/semantic-kernel/issues).
New issues can be reported in our [list of issues](https://github.com/microsoft/semantic-kernel/issues).

Before filing a new issue, please search the list of issues to make sure it does
not already exist.
Expand Down
18 changes: 17 additions & 1 deletion dotnet/Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -42,23 +42,39 @@
<!-- Symbols -->
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="1.1.1" />


<!-- Analyzers -->
<!-- TODO: Not working with .NET Standard 2.0
<PackageVersion Include="Microsoft.CodeDom.Providers.DotNetCompilerPlatform" Version="4.1.0" />
<PackageReference Include="Microsoft.CodeDom.Providers.DotNetCompilerPlatform">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp.CodeStyle" Version="4.5.0" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.CodeStyle">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
-->

<PackageVersion Include="Microsoft.CodeAnalysis.Analyzers" Version="3.3.4" />
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>

<PackageVersion Include="Microsoft.VisualStudio.Threading.Analyzers" Version="17.5.22" />
<PackageReference Include="Microsoft.VisualStudio.Threading.Analyzers">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>

<PackageVersion Include="xunit.analyzers" Version="1.1.0" />
<PackageReference Include="xunit.analyzers">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>

<PackageVersion Include="Moq.Analyzers" Version="0.0.9" />
<PackageReference Include="Moq.Analyzers">
<PrivateAssets>all</PrivateAssets>
Expand Down
3 changes: 3 additions & 0 deletions dotnet/SK-dotnet.sln.DotSettings
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=UI/@EntryIndexedValue">UI</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=UID/@EntryIndexedValue">UID</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=URL/@EntryIndexedValue">URL</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=XML/@EntryIndexedValue">XML</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=YAML/@EntryIndexedValue">YAML</s:String>
<s:Boolean x:Key="/Default/CodeStyle/Naming/CSharpNaming/ApplyAutoDetectedRules/@EntryValue">False</s:Boolean>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=Constants/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /&gt;</s:String>
Expand Down Expand Up @@ -183,6 +184,7 @@ public void It$SOMENAME$()
<s:Boolean x:Key="/Default/UserDictionary/Words/=CHATGPT/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=childrens/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Chunker/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Ctors/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=davinci/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=greaterthan/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Joinable/@EntryIndexedValue">True</s:Boolean>
Expand All @@ -192,6 +194,7 @@ public void It$SOMENAME$()
<s:Boolean x:Key="/Default/UserDictionary/Words/=myfile/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Notegen/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Qdrant/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Roundtrips/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=sandboxing/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=SK/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=SKHTTP/@EntryIndexedValue">True</s:Boolean>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public abstract class ClientBase
/// </summary>
/// <param name="text">The prompt to complete.</param>
/// <param name="requestSettings">Request settings for the completion API</param>
/// <param name="cancellationToken">Cancellation token</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> to monitor for cancellation requests. The default is <see cref="CancellationToken.None"/>.</param>
/// <returns>Text generated by the remote model</returns>
protected async Task<string> InternalCompleteTextAsync(
string text,
Expand Down Expand Up @@ -87,7 +87,7 @@ public abstract class ClientBase
/// Generates an embedding from the given <paramref name="data"/>.
/// </summary>
/// <param name="data">List of strings to generate embeddings for</param>
/// <param name="cancellationToken">Cancellation token</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> to monitor for cancellation requests. The default is <see cref="CancellationToken.None"/>.</param>
/// <returns>List of embeddings</returns>
protected async Task<IList<Embedding<float>>> InternalGenerateTextEmbeddingsAsync(
IList<string> data,
Expand Down Expand Up @@ -193,7 +193,7 @@ protected ChatHistory InternalCreateNewChat(string instructions = "")
/// </summary>
/// <param name="text">The prompt to complete.</param>
/// <param name="requestSettings">Request settings for the completion API</param>
/// <param name="cancellationToken">Cancellation token</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> to monitor for cancellation requests. The default is <see cref="CancellationToken.None"/>.</param>
/// <returns>Text generated by the remote model</returns>
protected async Task<string> InternalCompleteTextUsingChatAsync(
string text,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ public abstract class OpenAIClientBase : ClientBase
string apiKey,
string? organization = null,
IDelegatingHandlerFactory? handlerFactory = null,
ILogger? log = null
)
ILogger? log = null)
{
Verify.NotEmpty(modelId, "The Model Id cannot be empty");
this.ModelId = modelId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,11 @@ public sealed class AzureChatCompletion : AzureOpenAIClientBase, IChatCompletion
/// <inheritdoc/>
public Task<string> GenerateMessageAsync(
ChatHistory chat,
ChatRequestSettings requestSettings,
ChatRequestSettings? requestSettings = null,
CancellationToken cancellationToken = default)
{
if (requestSettings == null) { requestSettings = new ChatRequestSettings(); }

return this.InternalGenerateChatMessageAsync(chat, requestSettings, cancellationToken);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,11 @@ public sealed class OpenAIChatCompletion : OpenAIClientBase, IChatCompletion, IT
/// <inheritdoc/>
public Task<string> GenerateMessageAsync(
ChatHistory chat,
ChatRequestSettings requestSettings,
ChatRequestSettings? requestSettings = null,
CancellationToken cancellationToken = default)
{
if (requestSettings == null) { requestSettings = new ChatRequestSettings(); }

return this.InternalGenerateChatMessageAsync(chat, requestSettings, cancellationToken);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ internal OpenAIClientBase(ILogger? log = null, IDelegatingHandlerFactory? handle
/// </summary>
/// <param name="url">URL for the text embedding request API</param>
/// <param name="requestBody">Request payload</param>
/// <param name="cancellationToken">Cancellation token</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> to monitor for cancellation requests. The default is <see cref="CancellationToken.None"/>.</param>
/// <returns>List of text embeddings</returns>
/// <exception cref="AIException">AIException thrown during the request.</exception>
protected async Task<IList<Embedding<float>>> ExecuteTextEmbeddingRequestAsync(
Expand Down Expand Up @@ -93,7 +93,7 @@ internal OpenAIClientBase(ILogger? log = null, IDelegatingHandlerFactory? handle
/// </summary>
/// <param name="url">URL for the image generation request API</param>
/// <param name="requestBody">Request payload</param>
/// <param name="cancellationToken">Cancellation token</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> to monitor for cancellation requests. The default is <see cref="CancellationToken.None"/>.</param>
/// <returns>List of image URLs</returns>
/// <exception cref="AIException">AIException thrown during the request.</exception>
protected async Task<IList<string>> ExecuteImageUrlGenerationRequestAsync(
Expand All @@ -119,7 +119,7 @@ internal OpenAIClientBase(ILogger? log = null, IDelegatingHandlerFactory? handle
/// </summary>
/// <param name="url">URL for the image generation request API</param>
/// <param name="requestBody">Request payload</param>
/// <param name="cancellationToken">Cancellation token</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> to monitor for cancellation requests. The default is <see cref="CancellationToken.None"/>.</param>
/// <returns>List of images serialized in base64</returns>
/// <exception cref="AIException">AIException thrown during the request.</exception>
protected async Task<IList<string>> ExecuteImageBase64GenerationRequestAsync(
Expand Down

0 comments on commit 2228503

Please sign in to comment.