kernel.CreateFunctionFromMethod(GetChineseDay, "GetChineseDay", "返回中国的农历") ]); awaitCall1(); asyncTask Call1() { Console.WriteLine("---Call1 开始---"); var settings = new OpenAIPromptExecutionSettings() { ToolCallBehavior =ToolCallBehavior.AutoInvokeKernelFunctions }; await foreach ...
kernel.ImportPluginFromType<TimePlugin>("Time"); kernel.ImportPluginFromType<MathPlugin>("Math"); kernel.ImportPluginFromType<EmailPluginFake>("Email"); kernel.ImportPluginFromType<OrderPlugin>("Order");varsettings=newOpenAIPromptExecutionSettings() {ToolCallBehavior=ToolCallBehavior.AutoInvokeKernelFu...
然后在构建kernel实例时,构建KernelFunction 为SK插件,可以CreateFunctionFromMethod 方法传入MethodInfo,这里也能直接传委托。下文能看到如何调用。 到构建星火大模型客户端的地方,发送请求前从kernel.Plugins.GetFunctionMetadata()方法能获取所有...
然后在构建kernel实例时,构建KernelFunction 为SK插件,可以CreateFunctionFromMethod 方法传入MethodInfo,这里也能直接传委托。下文能看到如何调用。 到构建星火大模型客户端的地方,发送请求前从kernel.Plugins.GetFunctionMetadata方法能获取所有配置的sk function,通过前面导入时的命名,找到我们的本地方法,构建星火sdk的函数参...
kernel.ImportPluginFromFunctions("WeatherPlugin",new[] { kernel.CreateFunctionFromMethod(GetWeatherForCity,"GetWeatherForCity","获取指定城市的天气") }); 手动调用 function calling 根据上面的描述 手动处理function calling的关键实际上是ToolCallBehavior.EnableKernelFunctions参数。
Kernel SDK scans for functions marked with the[KernelFunction]attribute. It parses these functions for their names, input parameters, and output types, which are stored inKernelParameterMetadata. This metadata is crucial for building the JSON schema the model uses to call the correct function. ...
Kernel kernel = builder.Build(); kernel.ImportPluginFromFunctions("HelperFunctions", [ kernel.CreateFunctionFromMethod(GetChineseDay, "GetChineseDay", "返回中国的农历") ]); await Call1(); async Task Call1() { Console.WriteLine("---Call1 开始---"); var settings = new OpenAIPromptExecution...
自动化业务流程:Semantic Kernel 可以将A I Prompts 与现有API结合,自动执行业务操作。它作为中间件,将AI模型的请求转换为函数调用(Function Call),并处理其结果。 高度可扩展:你可以通过添加现有代码作为插件,利用一系列现成的连接器来集成AI服务。它还使用OpenAPI规范,便于与团队中的其他开发人员共享和扩展。
New approach with Automatic Function Calling For Automatic Function Calling,Kernelobject should be used withToolCallBehavior.AutoInvokeKernelFunctionsconfigured in execution settings. Here is an example: Copy // Get kernelKernel kernel = GetKernel();// Enable Automatic Function CallingOpenAIPromptExecu...
FunctionCallContent(inner_content: Any | None = None, ai_model_id: str | None = None, id: str | None = None, index: int | None = None, name: str | None = None, function_name: str | None = None, plugin_name: str | None = None, arguments: str | Mapping[str, Any] | Non...