#pragmawarning disable SKEXP0001usingMicrosoft.SemanticKernel;usingMicrosoft.SemanticKernel.Connectors.OpenAI;usingSystem;usingSystem.ComponentModel;usingSystem.Globalization;varchatModelId ="gpt-4o";varkey = File.ReadAllText(@"C:\GPT\key.txt");varbuilder =Kernel.CreateBuilder(); builder.AddOpenAIChatComp...
<PackageReference Include="Microsoft.SemanticKernel"Version="1.7.1"/> <PackageReference Include="NAudio"Version="2.2.1"/> </ItemGroup> 下面是具体代码,核心是在定义准确性的方法时,通过KernelFunction特性和Description特性来让SK知道这是一个Plugins,并且用Description的描述来映射自然语言的语义,包括提取参数,具...
比如,如果想要在Kernel中导入ConversationSummaryPlugin插件,我们可以使用以下的代码: KernelPlugin conversationSummaryPlugin = kernel.ImportPluginFromType<ConversationSummaryPlugin>; 在深入探讨SemanticKernel Plugins.Core 系统内置插件的强大功能之外,值得一提的是,SemanticKernel的扩展性同样令人兴奋。框架不仅提供了一套丰...
varkernel = Kernel.CreateBuilder.AddOpenAIChatCompletion(modelId:"gpt-3.5-turbo",apiKey:"这里填写在https://api.token-ai.cn/创建的令牌",httpClient:newHttpClient(newOpenAIHttpClientHandler("https://api.token-ai.cn/"))).Build; // 加载时间插件kernel.Plugins.AddFromType<WeatherInformationPlugin>; /...
Semantic Kernel(SK) 是由微软开发的一款开源开发工具包,旨在帮助开发者和企业利用最新的人工智能技术构建更智能和复杂的AI驱动解决方案,例如检索增强生成 (RAG) 和智能体 (Agent)。 核心概念 内核(Kernel) 您可以将SK的内核视为一个容器,该容器包含您所需的所有与AI相关的组件,如提示语模板、AI服务和插件。如果...
var builder = Kernel.CreateBuilder(); builder.Services.AddOpenAIChatCompletion(chatModelId, _key); builder.Plugins.AddFromObject(_store); _kernel = builder.Build(); _history = new ChatHistory("所有水果的单价(Price)单位是斤),所有数量都是斤。"); ...
NuGet\Install-Package Microsoft.SemanticKernel.Plugins.Core -Version 1.14.1-alpha 该包目前只有预览版本,如果用VS的包管理器安装,那需要勾选包括预览发行版 Semantic Kernel注册插件有两种方式: kernel.ImportPluginFromType<HttpPlugin>(); var httpclient = new HttpClient();kernel.ImportPluginFromObject(new Http...
Kernel 核心 Memories 记忆 Planner 规划器 Connectors 连接器 Plugins 插件(又称技能) Semantic Kernel管道组件架构。来源:Semantic Kernel Github 存储库 Kernel 核心 它的名字已经向我们揭示了它在 SDK 中的重要性。 在内核中,我们将注册所有连接器和插件,并配置运行程序所需的内容。
以OpenAI 的ChatGPT 所掀起的GenAI 快速创新浪潮,其中连接LLM 和 应用之间的桥梁的两大开源项目:LangChain[1]和Semantic Kernel[2] ,在半年前写过一篇文章 LangChain vs Semantic Kernel [3],这半年以来Semantic kernel 有了显...
[KernelFunction]是SemanticKernel中的一个特性,表示指定导入为插件的类中的方法应作为 Microsoft.SemanticKernel.KernelFunction 包含在生成的 Microsoft.SemanticKernel.KernelPlugin 中。 [Description]特性用于为类、方法、属性等添加描述信息。 在kernel中加入这个插件: builder.Plugins.AddFromType<TimeInformation>(); ...