ℹ️ NOTE:This project is just like AI and will evolve quickly. We invite you to join us in developing the Semantic Kernel together! Please contribute by using GitHub Discussions, opening GitHub Issues, sending us PRs, joining our Discord community.
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 supports and encapsulates 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, retrieval-augmented generation 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.
Semantic Kernel is available to explore AI and build apps with C# and Python:
See the Feature Matrix to see a breakdown of feature parity across C#, Python, and Java.
The quickest way to get started with the basics is to get an API key (OpenAI or Azure OpenAI) and to run one of the console applications/scripts:
For C#:
- Create a new console app.
- Add the semantic kernel nuget
Microsoft.SemanticKernel
. - Copy the code from here into the app
Program.cs
file. - Replace the configuration placeholders for API key and other params with your key and settings.
- Run with
F5
ordotnet run
For Python:
- Install the pip package:
python -m pip install semantic-kernel
. - Create a new script e.g.
hello-world.py
. - Store your API key and settings in an
.env
file as described here. - Copy the code from here into the
hello-world.py
script. - Run the python script.
For Java:
-
Install jbang:
- Linux/Mac:
curl -Ls https://sh.jbang.dev | bash -s - app setup
. - Windows:
iex "& { $(iwr -useb https://ps.jbang.dev) } app setup"
.
- Linux/Mac:
-
Create a new script e.g.
HelloSK.java
. -
Store your API key and settings in an
sk.properties
file as described here. -
Copy the code from here into the
HelloSK.java
script. -
Run the Java application with
jbang HelloSK.java
.
Note: to run the Java application with jbang HelloSK.java
, you will need to have the Semantic Kernel for Java installed locally. See here for instructions. This step is temporary, and won't be required after the library is available to Maven Central.
The repository includes some sample applications, with a React frontend and a backend web service using Semantic Kernel.
Follow the links for more information and instructions about running these apps.
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. |
GitHub repository Q&A | Use embeddings and memory to store recent data and allow you to query against it. |
Copilot Chat Sample App | Build your own chat experience based on Semantic Kernel. |
Requirements:
- You will need an Open AI API Key or Azure Open AI service key to get started.
- Azure Functions Core Tools are required to run the kernel as a local web service, used by the sample web apps.
- .NET 6. If you have .NET 7 installed, Azure Function Tools will still require .NET 6, so we suggest installing both.
- Yarn is used for installing web apps' dependencies.
For a more hands-on overview, you can also check out the C# and Python Jupyter notebooks, starting from here:
Requirements: C# notebooks require .NET 7 and the VS Code Polyglot extension.
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:
- Read the documentation
- Learn how to contribute to the project
- Join the Discord community
- Follow the team on our blog
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.
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the MIT license.