For C#, you can install Semantic Kernel from NuGet. The command line is:
dotnet add package Microsoft.SemanticKernel
For Python, you can install Semantic Kernel from PyPI. The command line is:
pip install semantic-kernel
It’s possible that you will need to use pip3
rather than pip
.
In Java, you can build the project in the repo from the Maven wrapper, and that will pull in everything you need.
No matter which language you use, you’ll need an API key, either from OpenAI or Azure OpenAI. Save the API key locally in a safe place. You’ll also need to enter the API key somewhere (it varies by language) so that the code can use it to call LLMs. If you run the Bing search example (see screenshot below) you’ll also need to get a Bing API key from Azure.
Unless you have a strong interest in Python or Java, I suggest that you read and run the C# notebook examples, which are currently in the best shape, i.e. they mostly work without throwing errors and mostly match the documentation. Entering the API key for these happens interactively in the first example.
The repository has a section on learning Semantic Kernel. Some of the content referenced is helpful. However, some of the titles no longer match the content, and some of the content is currently missing examples for particular languages.
IDG
Semantic Kernel Cookbook
The Semantic Kernel Cookbook, an open-source manual mainly focused on the implementation of the Semantic Kernel for beginners, is available in English and Simplified Chinese. It’s an interesting complement to the official Semantic Kernel documentation, written by kinfey, a Microsoft Cloud Advocate.
Project Miyagi
Project Miyagi is an “as-is” demo envisioning sample for the Copilot stack. It includes examples of usage for Semantic Kernel, Promptflow, LlamaIndex, LangChain, vector stores (Azure AI Search, CosmosDB Postgres pgvector), and generative image utilities such as DreamFusion and ControlNet. Project Miyagi is also interesting as a complement to the official Semantic Kernel documentation.
Semantic Kernel project
Given how much Microsoft has invested in Copilots and Copilot+ PCs, you would think that the Semantic Kernel project would get some serious resources. But no. In December 2023 the Semantic Kernel repo got over 100 commits a week; in June 2024, it has been getting about 30 commits a week. The core framework code seems to be progressing, especially the C# version, and the Python and Java code seems to be catching up, but the documentation and examples don’t seem to be getting much love despite being out of date.
Perhaps I’m seeing a normal development cycle for an open source project. There was a big spike in code additions and deletions in May 2024, similar to the spikes in April and October of 2023. It’s possible that the documentation and example writers have been waiting for the code to settle down before updating their parts of the project.
Or, possibly, Microsoft simply doesn’t care about the Semantic Kernel open-source project. Their internal efforts were enough to release lots of Copilots. As far as external development of AI applications goes, they may be content to let LangChain or LlamaIndex dominate the ecosystem rather than pushing their own Semantic Kernel, as long as developers use Azure or OpenAI services. Time will tell.
—
Pros
- A free open-source SDK that lets you build agents that can call your existing code.
- Supports C#, Python, and Java.
- Reasonably easy to learn and use, especially in C#.
- Can generate its own plans.
Cons
- Using planners is expensive (uses lots of AI tokens) and introduces noticeable delays for the user.
- The documentation and examples seem to be out-of-date or missing for Python and Java.
Cost
Free open source, MIT License.
Platform
C#, Python, and Java.