semantic-kernel icon indicating copy to clipboard operation
semantic-kernel copied to clipboard

.Net: ImportOpenAIPluginFunctionsAsync throws SKExeption on user_http

Open tolervik opened this issue 3 years ago • 4 comments

Describe the bug if the plugin .well-known/ai-plugin.json endpoint returns an auth node with type = user_http

"auth": { "type": "user_http", "authorization_type": "Bearer" }

IKernel.ImportOpenAIPluginFunctionsAsync trows

Microsoft.SemanticKernel.Diagnostics.SKException HResult=0x80131500 Message=Parsing of Open AI manifest failed. Source=Microsoft.SemanticKernel.Functions.OpenAPI StackTrace: at Microsoft.SemanticKernel.Functions.OpenAPI.OpenAI.KernelOpenAIPluginExtensions.d__3.MoveNext() in D:\source\repos\samples\semantic-kernel\dotnet\src\Functions\Functions.OpenAPI\OpenAI\KernelOpenAIPluginExtensions.cs:line 139 at Microsoft.SemanticKernel.Functions.OpenAPI.OpenAI.KernelOpenAIPluginExtensions.d__1.MoveNext() in D:\source\repos\samples\semantic-kernel\dotnet\src\Functions\Functions.OpenAPI\OpenAI\KernelOpenAIPluginExtensions.cs:line 84 at Example21_ChatGptPlugins.d__1.MoveNext() in D:\source\repos\samples\semantic-kernel\dotnet\samples\KernelSyntaxExamples\Example21_ChatGPTPlugins.cs:line 28 at Example21_ChatGptPlugins.d__0.MoveNext() in D:\source\repos\samples\semantic-kernel\dotnet\samples\KernelSyntaxExamples\Example21_ChatGPTPlugins.cs:line 17 at Program.d__4.MoveNext() in D:\source\repos\samples\semantic-kernel\dotnet\samples\KernelSyntaxExamples\Program.cs:line 101 at Program.d__1.MoveNext() in D:\source\repos\samples\semantic-kernel\dotnet\samples\KernelSyntaxExamples\Program.cs:line 60 at Program.

d__0.MoveNext() in D:\source\repos\samples\semantic-kernel\dotnet\samples\KernelSyntaxExamples\Program.cs:line 30

This exception was originally thrown at this call stack: [External Code] Microsoft.SemanticKernel.Functions.OpenAPI.OpenAI.KernelOpenAIPluginExtensions.ImportAsync(Microsoft.SemanticKernel.IKernel, string, string, Microsoft.SemanticKernel.Functions.OpenAPI.OpenAI.OpenAIFunctionExecutionParameters, System.Threading.CancellationToken) in KernelOpenAIPluginExtensions.cs

Inner Exception 1: JsonException: The JSON value could not be converted to Microsoft.SemanticKernel.Functions.OpenAPI.OpenAI.OpenAIAuthenticationType. Path: $.type | LineNumber: 0 | BytePositionInLine: 19.

To Reproduce Steps to reproduce the behavior: 1: modify Example21_ChatGPTPlugins to access a plugin that returns auth type "user_http"

Expected behavior looks like the enum OpenAIAuthenticationType is not parsed correctly

Platform

  • OS: Windows 11
  • IDE: Visual Studio 2022 17.8.0 Preview 7.0
  • Language: C#

tolervik avatar Nov 13 '23 14:11 tolervik

@dehoward, would you be able to take a look at this and see if it's related to your recent auth changes?

madsbolaris avatar Nov 13 '23 17:11 madsbolaris

this will be fixed by #3423 which should merge very soon (next day or so).

dehoward avatar Nov 13 '23 19:11 dehoward

this will be fixed by #3423 which should merge very soon (next day or so).

@dehoward, is this now fixed?

stephentoub avatar Dec 20 '23 00:12 stephentoub

@stephentoub yes, it ended up being fixed by #3716. closing.

dehoward avatar Dec 20 '23 00:12 dehoward