Improve the main readme, supporting both users willing to clone and run samples, developers looking to create a new app using the nuget package, and contributors looking for ways to participate. Added additional technical docs, explaining some important concepts and touching on various aspects of the project, e.g. architecture and nomenclature.
Semantic Kernel
Semantic Kernel (SK) is a lightweight SDK enabling integration of AI Large Language Models (LLMs) with conventional programming languages. The SK extensible programming model combines natural language semantic functions, traditional code native functions, and embeddings-based memory unlocking new potential and adding value to applications with AI.
SK supports prompt templating, function chaining, vectorized memory, and intelligent planning capabilities out of the box.
Semantic Kernel is designed to support and encapsulate several design patterns from the latest in AI research, such that developers can infuse their applications with complex skills like prompt chaining, recursive reasoning, summarization, zero/few-shot learning, contextual memory, long-term memory, embeddings, semantic indexing, planning, and accessing external knowledge stores as well as your own data.
By joining the SK community, you can build AI-first apps faster and have a front-row peek at how the SDK is being built. SK has been released as open-source so that more pioneering developers can join us in crafting the future of this landmark moment in the history of computing.
Samples ⚡
If you would like a quick overview about how Semantic Kernel can integrate with your app, start by cloning the repository:
git clone https://github.com/microsoft/semantic-kernel.git
and try these examples:
| Simple chat summary | Use ready-to-use skills and get those skills into your app easily. |
| Book creator | Use planner to deconstruct a complex goal and envision using the planner in your app. |
| Authentication and APIs | Use a basic connector pattern to authenticate and connect to an API and imagine integrating external data into your app's LLM AI. |
For a more hands-on overview, you can also run the Getting Started notebook, looking into the syntax, creating Semantic Functions, working with Memory, and see how the kernel works.
Please note:
- You will need an Open AI API Key or Azure Open AI service key to get started.
- There are a few software requirements you may need to satisfy before running examples and notebooks:
- Azure Functions Core Tools used for running the kernel as a local API, required by the web apps.
- Yarn used for installing web apps' dependencies.
- .NET 7 and VS Code Polyglot extension to run the notebooks.
Get Started with Semantic Kernel ⚡
Here is a quick example of how to use Semantic Kernel from a C# console app.
-
Create a new project, targeting .NET 3.1 or newer, and add the
Microsoft.SemanticKernelnuget package:dotnet add package Microsoft.SemanticKernel --version <version number>See nuget.org for the latest version and more instructions.
-
Copy and paste the following code into your project, with your Azure OpenAI key in hand (you can create one here).
using Microsoft.SemanticKernel;
using Microsoft.SemanticKernel.KernelExtensions;
var kernel = Kernel.Builder.Build();
kernel.Config.AddAzureOpenAICompletionBackend(
"davinci-backend", // Alias used by the kernel
"text-davinci-003", // Azure OpenAI *Deployment ID*
"https://contoso.openai.azure.com/", // Azure OpenAI *Endpoint*
"...your Azure OpenAI Key..." // Azure OpenAI *Key*
);
string skPrompt = @"
{{$input}}
Give me the TLDR in 5 words.
";
string textToSummarize = @"
1) A robot may not injure a human being or, through inaction,
allow a human being to come to harm.
2) A robot must obey orders given it by human beings except where
such orders would conflict with the First Law.
3) A robot must protect its own existence as long as such protection
does not conflict with the First or Second Law.
";
var tldrFunction = kernel.CreateSemanticFunction(skPrompt);
var summary = await kernel.RunAsync(textToSummarize, tldrFunction);
Console.WriteLine(summary);
// Output => Protect humans, follow orders, survive.
Contributing and Community
We welcome your contributions and suggestions to SK community! One of the easiest ways to participate is to engage in discussions in the GitHub repository. Bug reports and fixes are welcome!
For new features, components, or extensions, please open an issue and discuss with us before sending a PR. This is to avoid rejection as we might be taking the core in a different direction, but also to consider the impact on the larger ecosystem.
To learn more and get started, please read our Contributing page and check some of our documentation:
- SK Prompt Template Language
- SKills and Functions
- Embeddings and Semantic Memory
- SK Planner
- SK Notebooks
Code of Conduct
This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.
License
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the MIT license.
