Bumps [Microsoft.Data.Sqlite](https://github.com/dotnet/efcore) from 6.0.19 to 7.0.8. <details> <summary>Release notes</summary> <p><em>Sourced from <a href="https://github.com/dotnet/efcore/releases">Microsoft.Data.Sqlite's releases</a>.</em></p> <blockquote> <h2>EF Core 7.0.8</h2> <p>This is a <a href="https://www.nuget.org/packages/Microsoft.EntityFrameworkCore/7.0.8">patch release of EF Core 7.0</a> containing only updates to dependencies. There are no additional fixes in this release beyond those already shipped in EF Core 7.0.7.</p> <p>EF Core 7.0.7 is <a href="https://www.nuget.org/packages/Microsoft.EntityFrameworkCore/7.0.7">available on NuGet now</a>. This is a patch release of EF Core 7 containing only <a href="https://github.com/dotnet/efcore/issues?q=is%3Aissue+milestone%3A7.0.7+is%3Aclosed">important bug fixes</a>:</p> <ul> <li><a href="https://redirect.github.com/dotnet/efcore/issues/30115">IndexOutOfRangeException in CreateNavigationExpansionExpression</a></li> <li><a href="https://redirect.github.com/dotnet/efcore/issues/30266">Linq select cannot project an entity containing both Json columns and ICollections</a></li> <li><a href="https://redirect.github.com/dotnet/efcore/issues/30330">Json: updating property with conversion from string to other type fails on sql server</a></li> <li><a href="https://redirect.github.com/dotnet/efcore/issues/30358">Duplicate table alias in generated select query (An item with the same key has already been added)</a></li> <li><a href="https://redirect.github.com/dotnet/efcore/issues/30528">InvalidOperationException when calling ExecuteUpdate with owned entity & using current value</a></li> <li><a href="https://redirect.github.com/dotnet/efcore/issues/30565">Query/Json: projecting entity collection along with json collection generates invalid shaper</a></li> <li><a href="https://redirect.github.com/dotnet/efcore/issues/30572">AutoInclude causes ExecuteDelete to fail</a></li> <li><a href="https://redirect.github.com/dotnet/efcore/issues/30575">Multiple LeftJoins (GroupJoins) lead to GroupJoin Exception when the same where is used twice</a></li> <li><a href="https://redirect.github.com/dotnet/efcore/issues/30601">SaveChanges circular dependency in unique unfiltered index (when change doesn't affect any column from unique index).</a></li> </ul> <p>EF Core 7.0.5 is <a href="https://www.nuget.org/packages/Microsoft.EntityFrameworkCore/7.0.5">available on NuGet now</a>. This is a patch release of EF Core 7 containing only <a href="https://github.com/dotnet/efcore/issues?q=is%3Aissue+milestone%3A7.0.5+is%3Aclosed">important bug fixes</a>:</p> <ul> <li><a href="https://redirect.github.com/dotnet/efcore/issues/30321">Can't add migration renaming a column on TPC root</a></li> <li><a href="https://redirect.github.com/dotnet/efcore/issues/30286">Scaffolded collection navigation properties do not have setters</a></li> <li><a href="https://redirect.github.com/dotnet/efcore/issues/30273">EF7 generating incorrect SQL for the Concat/Union All</a></li> <li><a href="https://redirect.github.com/dotnet/efcore/issues/30028">Added nullable property to Json mapped model resulting in errors instead of mapping non existing json property to null</a></li> </ul> <h2>EF Core 7.0.4</h2> <p>This is a <a href="https://www.nuget.org/packages/Microsoft.EntityFrameworkCore/7.0.4">patch release of EF Core 7.0</a> containing only <a href="https://github.com/dotnet/efcore/issues?q=is%3Aissue+milestone%3A7.0.4+is%3Aclosed">important bug fixes</a>:</p> <ul> <li><a href="https://redirect.github.com/dotnet/efcore/issues/30135">Exception replacing multi-level relationship in EF7</a></li> <li><a href="https://redirect.github.com/dotnet/efcore/issues/30122">Deletion can cause error "The association between entity types A and B has been severed..."</a></li> <li><a href="https://redirect.github.com/dotnet/efcore/issues/30058">Non-empty second migration in TPC scheme using inheritance</a></li> <li><a href="https://redirect.github.com/dotnet/efcore/issues/29985">Entity Framework Core 7 keeps creating the same migration for Nullable DateTime field</a></li> <li><a href="https://redirect.github.com/dotnet/efcore/issues/29899">TPC mapping strategy not respecting default database schema during migration</a></li> <li><a href="https://redirect.github.com/dotnet/efcore/issues/29667">Count after Take throws "No column name was specified for column 1 of 't'."</a></li> </ul> <p>And for <a href="https://www.nuget.org/packages/Microsoft.Data.Sqlite/7.0.4">Microsoft.Data.Sqlite</a>:</p> <ul> <li><a href="https://redirect.github.com/dotnet/efcore/issues/29952">ArgumentOutOfRangeException in SqliteConnectionFactory.PruneCallback</a></li> </ul> <h2>EF Core 7.0.3</h2> <p>This is a <a href="https://www.nuget.org/packages/Microsoft.EntityFrameworkCore/7.0.3">patch release of EF Core 7.0</a> containing only <a href="https://github.com/dotnet/efcore/issues?q=is%3Aissue+milestone%3A7.0.3+is%3Aclosed">important bug fixes</a>:</p> <ul> <li><a href="https://redirect.github.com/dotnet/efcore/issues/27504">Add-Migration fails with "An item with the same key has already been added" when renaming entity</a></li> <li><a href="https://redirect.github.com/dotnet/efcore/issues/28727">ExecuteUpdate fails when target entity has an owned entity</a></li> <li><a href="https://redirect.github.com/dotnet/efcore/issues/29418">EF Core 7 Rev eng: Missing HasForeignKey when referencing a navigation property with a unique constraint with DataAnnotations on</a></li> <li><a href="https://redirect.github.com/dotnet/efcore/issues/29450">Change in behaviour of CSharpHelper.Identifier(string name)</a></li> <li><a href="https://redirect.github.com/dotnet/efcore/issues/29516">NullReferenceException scaffolding when no primary key set</a></li> <li><a href="https://redirect.github.com/dotnet/efcore/issues/29530">Idempotent migration script not working on EFCore7.0 for AlterColumn when nullable changed from true to false</a></li> <li><a href="https://redirect.github.com/dotnet/efcore/issues/29531">6.0.11 to 7.0.0: [...] are both mapped to column [..] but are configured to use differing provider types ('double' and 'double?').'</a></li> <li><a href="https://redirect.github.com/dotnet/efcore/issues/29534">Generated Model Snapshot throws InvalidOperationException</a></li> <li><a href="https://redirect.github.com/dotnet/efcore/issues/29539">SQL Server bulk insert broken when new command applies pending commands and goes over the batch parameter limit</a></li> <li><a href="https://redirect.github.com/dotnet/efcore/issues/29544">Invalid singularization when scaffolding a manytomany table</a></li> </ul> <!-- raw HTML omitted --> </blockquote> <p>... (truncated)</p> </details> <details> <summary>Commits</summary> <ul> <li><a href="https://github.com/dotnet/efcore/commit/ec04682078a1a4824c7af617357c7497190f32cc"><code>ec04682</code></a> Update branding to 7.0.8 (<a href="https://redirect.github.com/dotnet/efcore/issues/31045">#31045</a>)</li> <li><a href="https://github.com/dotnet/efcore/commit/81a09d5f0ca45f744ec8a4b8938f38780bb15a4c"><code>81a09d5</code></a> Merge in 'release/7.0' changes</li> <li><a href="https://github.com/dotnet/efcore/commit/3e87774498671124873d970fcbb177c105fd3998"><code>3e87774</code></a> [release/7.0] Bump SqlClient to 5.0.2 due to bad memory bug in 5.0.1 (<a href="https://redirect.github.com/dotnet/efcore/issues/30828">#30828</a>)</li> <li><a href="https://github.com/dotnet/efcore/commit/8dc90e7513792cf327526548a2d805263e4d2476"><code>8dc90e7</code></a> Merge in 'release/7.0' changes</li> <li><a href="https://github.com/dotnet/efcore/commit/ea9106076040480b1efa2a0f53cba4540631b9cf"><code>ea91060</code></a> Re-introduce quirk with typo (<a href="https://redirect.github.com/dotnet/efcore/issues/30825">#30825</a>)</li> <li><a href="https://github.com/dotnet/efcore/commit/1123a9a676afd0b54a991e873b35669e51a4db6e"><code>1123a9a</code></a> Merge in 'release/7.0' changes</li> <li><a href="https://github.com/dotnet/efcore/commit/847bdd33bf2f430b1c8a37bb3a3ff1c3b423f795"><code>847bdd3</code></a> fixing a typo in quirk string for issue 30330 (<a href="https://redirect.github.com/dotnet/efcore/issues/30784">#30784</a>)</li> <li><a href="https://github.com/dotnet/efcore/commit/5261aa5cfebbef26383b8a65aa8efd048d9982b8"><code>5261aa5</code></a> Merge in 'release/7.0' changes</li> <li><a href="https://github.com/dotnet/efcore/commit/03541adb3b3ec5cdbe19d59d5d5439fd62619f5a"><code>03541ad</code></a> Fix to <a href="https://redirect.github.com/dotnet/efcore/issues/30575">#30575</a> - Multiple LeftJoins (GroupJoins) lead to GroupJoin Exception w...</li> <li><a href="https://github.com/dotnet/efcore/commit/d3fb4064bc7c3639f5915df5e4522d6fe6136188"><code>d3fb406</code></a> Merge in 'release/7.0' changes</li> <li>Additional commits viewable in <a href="https://github.com/dotnet/efcore/compare/v6.0.19...v7.0.8">compare view</a></li> </ul> </details> <br /> [](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) --- <details> <summary>Dependabot commands and options</summary> <br /> You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) </details> Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Shawn Callegari <[email protected]>
Get Started with Semantic Kernel ⚡
OpenAI / Azure OpenAI API keys
To run the LLM prompts and semantic functions in the examples below, make sure you have an Open AI API Key or Azure Open AI service key.
Nuget package
Here is a quick example of how to use Semantic Kernel from a C# console app.
First, let's create a new project, targeting .NET 6 or newer, and add the
Microsoft.SemanticKernel nuget package to your project from the command prompt
in Visual Studio:
dotnet add package Microsoft.SemanticKernel --prerelease
Running prompts with input parameters
Copy and paste the following code into your project, with your Azure OpenAI key in hand:
using Microsoft.SemanticKernel;
var builder = new KernelBuilder();
builder.WithAzureTextCompletionService(
"text-davinci-003", // Azure OpenAI Deployment Name
"https://contoso.openai.azure.com/", // Azure OpenAI Endpoint
"...your Azure OpenAI Key..."); // Azure OpenAI Key
// Alternative using OpenAI
//builder.WithOpenAITextCompletionService(
// "text-davinci-003", // OpenAI Model name
// "...your OpenAI API Key..."); // OpenAI API Key
var kernel = builder.Build();
var prompt = @"{{$input}}
One line TLDR with the fewest words.";
var summarize = kernel.CreateSemanticFunction(prompt);
string text1 = @"
1st Law of Thermodynamics - Energy cannot be created or destroyed.
2nd Law of Thermodynamics - For a spontaneous process, the entropy of the universe increases.
3rd Law of Thermodynamics - A perfect crystal at zero Kelvin has zero entropy.";
string text2 = @"
1. An object at rest remains at rest, and an object in motion remains in motion at constant speed and in a straight line unless acted on by an unbalanced force.
2. The acceleration of an object depends on the mass of the object and the amount of force applied.
3. Whenever one object exerts a force on another object, the second object exerts an equal and opposite on the first.";
Console.WriteLine(await summarize.InvokeAsync(text1));
Console.WriteLine(await summarize.InvokeAsync(text2));
// Output:
// Energy conserved, entropy increases, zero entropy at 0K.
// Objects move in response to forces.
Prompt chaining
The previous code shows how to invoke individual semantic functions, but you can also chain functions (aka prompt chaining) to process the initial input with multiple operations.
The following code for example, translates an initial text to math symbols and then generates a summary:
string translationPrompt = @"{{$input}}
Translate the text to math.";
string summarizePrompt = @"{{$input}}
Give me a TLDR with the fewest words.";
var translator = kernel.CreateSemanticFunction(translationPrompt);
var summarize = kernel.CreateSemanticFunction(summarizePrompt);
string inputText = @"
1st Law of Thermodynamics - Energy cannot be created or destroyed.
2nd Law of Thermodynamics - For a spontaneous process, the entropy of the universe increases.
3rd Law of Thermodynamics - A perfect crystal at zero Kelvin has zero entropy.";
// Run two prompts in sequence (prompt chaining)
var output = await kernel.RunAsync(inputText, translator, summarize);
Console.WriteLine(output);
// Output: ΔE = 0, ΔSuniv > 0, S = 0 at 0K.
Semantic Kernel Notebooks
The repository contains also a few C# Jupyter notebooks that demonstrates how to get started with the Semantic Kernel.
See here for the full list, with requirements and setup instructions.
- Getting started
- Loading and configuring Semantic Kernel
- Running AI prompts from file
- Creating Semantic Functions at runtime (i.e. inline functions)
- Using Context Variables to Build a Chat Experience
- Creating and Executing Plans
- Building Memory with Embeddings
- Creating images with DALL-E 2
- Chatting with ChatGPT and Images
Nuget packages
Semantic Kernel provides a set of nuget packages to allow extending the core with more features, such as connectors to services and Skills to perform specific actions. Unless you need to optimize which packages to include in your app, you will usually start by installing this meta-package first:
- Microsoft.SemanticKernel
This meta package includes core packages and OpenAI connectors, allowing to run most samples and build apps with OpenAI and Azure OpenAI.
Packages included in Microsoft.SemanticKernel:
- Microsoft.SemanticKernel.Abstractions: contains common interfaces and classes used by the core and other SK components.
- Microsoft.SemanticKernel.Core: contains the core logic of SK, such as prompt engineering, semantic memory and semantic functions definition and orchestration.
- Microsoft.SemanticKernel.Connectors.AI.OpenAI: connectors to OpenAI and Azure OpenAI, allowing to run semantic functions, chats, image generation with GPT3, GPT3.5, GPT4, DALL-E2. Includes also GPT tokenizers.
Other SK packages available at nuget.org:
- Microsoft.SemanticKernel.Connectors.Memory.Qdrant: Qdrant connector for skills and semantic memory.
- Microsoft.SemanticKernel.Connectors.Memory.Sqlite: SQLite connector for skills and semantic memory
- Microsoft.SemanticKernel.Skills.Document: Document Skill: Word processing, OpenXML, etc.
- Microsoft.SemanticKernel.Skills.MsGraph: Microsoft Graph Skill: access your tenant data, schedule meetings, send emails, etc.
- Microsoft.SemanticKernel.Skills.OpenAPI: OpenAPI skill.
- Microsoft.SemanticKernel.Skills.Web: Web Skill: search the web, download files, etc.