

GitHub - microsoft/semantic-kernel: Integrate cutting-edge LLM technology quickl...
source link: https://github.com/microsoft/semantic-kernel
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Semantic Kernel
NOTE: This project is in early alpha and, just like AI, 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.
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. |
Github repository Q&A | Use embeddings and memory to store recent data and allow you to query against it. |
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.
- Semantic Kernel supports .NET Standard 2.1 and it's recommended using .NET 6+. However, some of the examples in the repository require .NET 7 and the 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 6 or newer, and add the
Microsoft.SemanticKernel
nuget package:dotnet add package Microsoft.SemanticKernel --prerelease
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;
var kernel = Kernel.Builder.Build();
// For Azure Open AI details please see
// https://learn.microsoft.com/azure/cognitive-services/openai/quickstart?pivots=rest-api
kernel.Config.AddAzureOpenAITextCompletionService(
"davinci-azure", // 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 summarizePrompt = @"
{{$input}}
Give me the a TLDR in 5 words.";
string haikuPrompt = @"
{{$input}}
Write a futuristic haiku about it.";
var summarize = kernel.CreateSemanticFunction(summarizePrompt);
var haikuWriter = kernel.CreateSemanticFunction(haikuPrompt);
string inputText = @"
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 output = await kernel.RunAsync(inputText, summarize, haikuWriter);
Console.WriteLine(output);
// Output => Robots protect us all
// No harm to humans they bring
// Peaceful coexistence
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:
- Read the documentation
- Learn how to contribute to the project
- Join the Discord community
- Follow the team on our blog
Python developers: Semantic Kernel is coming to Python soon! Check out the work-in-progress and contribute in the python-preview branch.
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.
Recommend
-
10
How to Integrate it into Your SEO StrategySemantic search has been a popular topic of conversation for years – and for good reason, as it created a massive shift in how modern SEOs evaluate and plan content.In this guide, I’ll run thro...
-
8
微软博客上几篇 Semantic-kernel (SK)文章 自从最近...
-
6
Semantic KernelThe latest news from the Semantic Kernel team for developers ...
-
7
Semantic Kernel 入门系列:🔥Kernel 内核和🧂Skills 技能 ...
-
4
如果把提示词也算作一种代码的话,那么语义技能所带来的将会是全新编程方式,自然语言...
-
3
Semantic Kernel 入门系列:💾Native Function ...
-
7
无尽的上下文 LLM对自然语言的理解和掌握在知识内容的解...
-
3
使用 Semantic Kernel 实现 Microsoft 365 Copilot 架构 ...
-
2
How To Use Microsoft Fabric with Semantic Kernel John Maeda...
-
8
Microsoft’s Semantic Kernel is ready to pop Now available in a release candidate, a simpler and easier Semantic Kernel SDK now automates function calling...
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK