From the course: Azure OpenAI in .NET

Semantic Kernel

- [Instructor] Welcome to the first chapter of the training Azure OpenAI for .NET developers. And by now, we've already seen how embeddings support the semantic search for information. We've seen how we can call the rest interface of an LLM instance, or how we can use the Azure OpenAI.NET SDK. In this chapter now, we will deal with another SDK, or perhaps it would be better to say we deal with a tool that can also speed up and simplify the development of AI-infused applications. Of course, I'm talking here about Semantic Kernel, which was published by Microsoft on GitHub, and it is also used internally by Microsoft in the development of copilot functionalities, for example. In this chapter, we will look at three functionalities or strategies of Semantic Kernel. On the one hand, this is the concept of plug-ins, the concept of memories, and the concept of planner. And please stay tuned as we take a closer look at each of these concepts and its functionalities. We will also look at samples and corresponding source code that can potentially serve as a basis for your own applications, where you might use Semantic Kernel as well. Let's start with an overview of what functionalities and concepts Semantic Kernel provides, and how they can be applied. One of the goals of Semantic Kernel is to abstract the integration of open AI models into applications. And of course this abstraction does not stop at open AI models. The integration of vector databases, for example, to store embeddings and perform semantic searches is similarly abstracted by Semantic Kernel. But how is this done? Well, Semantic Kernel implements this abstraction using so-called connectors. This is an open architecture, and allows the integration of other external systems or components for which there are currently no connectors easily. This means, for example, that it doesn't matter whether Azure open AI models or maybe other models are used in the application. The same goes for vector databases, Semantic Kernel abstracts their usage away. This is somehow similar, and similar to some extent, how ADO.NET abstracts away the underlying database. But here's the cool thing. Semantic Kernel doesn't stop by simply abstracting external system. It goes one step further and introduces the concept of plug-ins. Plug-ins can be thought of as a collection of functions, let's say C sharp functions, that are sequenced and executed. It doesn't matter if it's a native function, meaning a function that uses C sharp to implement its functionality. Mathematical functions, or for example, the download of information from a webpage, are good examples of native functions. On top, plug-ins do also support so-called semantic functions, meaning calls to large language models. And now plug-ins give both types of functions a uniform way to call them. And of course we will see here a sample later in the training to see this concept in action. The next concept that Semantic Kernel supports are the so-called memories. What are memories? Do you remember the previous chapter where we converted a knowledge base into vectors, and stored them in a vector database to perform queries? Now, memories provide similar functionality. They dramatically simplify all steps needed to create, store, and query vectors or embeddings. For example, it is no longer necessary to call the LLM to create the embeddings. Semantic Kernel is doing this for us. And here I have also prepared some sample code, which will shed some light on this concept. And finally, we have the concept of planner. And I personally find this concept particularly exciting, but what does the planner do? Now imagine using an LLM to specify which functions, and in what order those functions should be called to deliver on a particular task. Sounds futuristic? Yes, certainly. With planner, an LLM supports us in calling existing functions with the correct input data based on a predefined task. And like with the other two concepts, I have also prepared here source code, which, again, will shed light into the functionality of planner.

Contents