From the course: Azure OpenAI in .NET

Unlock the full course today

Join today to access over 24,900 courses taught by industry experts.

Semantic Kernel: Functions

Semantic Kernel: Functions - .NET Tutorial

From the course: Azure OpenAI in .NET

Semantic Kernel: Functions

- [Instructor] Now that we have created an instance of Semantic Kernel using the Microsoft Semantic Kernel NuGet package and the kernel builder functionality or the kernel builder function from the NuGet package, the next step is to define the functions that we want to call. And the first function that we will define is a native function. So a plain, straightforward C# function. And this is what you can see here in step number two. So what I'm doing is I'm defining a class NativeFunction. And in this class NativeFunction, I'm defining a method DownloadContentFromUrl. And this method or function is using the httpClient GetAsync method to download content from a webpage. Because I know that I will download from a Wikipedia site, I can also already parse the response. And this is what I'm doing here with a jsonDocument.Parse. And I'm extracting here just the raw content from the article, and I'm returning this raw…

Contents