Semantic Kernel调用本地插件时触发HttpOperationException错误
问题:SemanticKernel自动调用插件时抛出HttpOperationException错误
在LinqPad脚本中参照微软官方示例开发本地原生插件,直接调用MathPlugin的Sqrt方法时运行正常:
double resultDirect = await kernel.InvokeAsync<double>( nameof(Plugins.MathPlugin), nameof(Plugins.MathPlugin.Sqrt), new() { {"number1", 12 }, })!; resultDirect.Dump();
但按照「让AI自动调用函数」的步骤操作时,执行await foreach (var content in result)抛出Microsoft.SemanticKernel.HttpOperationException,错误信息为:
Unrecognized request arguments supplied: tool_choice, tools
Status: 400 (model_error)
错误详情的JSON内容:
{ "error": { "message": "Unrecognized request arguments supplied: tool_choice, tools", "type": "invalid_request_error", "param": null, "code": null } }
使用的NuGet包版本:
- Microsoft.SemanticKernel 1.1.0
- Microsoft.SemanticKernel.Plugins.Core(pre) 1.1.0-alpha
- Microsoft.SemanticKernel.Planners.Handlebars(pre) 1.1.0-preview
内容的提问来源于stack exchange,提问作者DrGriff
相关产品推荐
相关产品推荐

