Search code examples
c#openai-apiazure-openaisemantic-kernel

SemanticKernel throws "Unrecognized request argument supplied: tools"


I've just upgraded to SemanticKernel 1.0.0-rc4 and this error shows up wherever I'm using Native Functions:

Microsoft.SemanticKernel.Http.HttpOperationException
Unrecognized request argument supplied: tools
Status: 404 (model_error)

Content:
{
  "error": {
    "message": "Unrecognized request argument supplied: tools",
    "type": "invalid_request_error",
    "param": null,
    "code": null
  }
}


Headers:
Access-Control-Allow-Origin: REDACTED
x-ms-region: REDACTED
x-ratelimit-remaining-tokens: REDACTED
apim-request-id: REDACTED
X-Request-ID: REDACTED
ms-azureml-model-error-reason: REDACTED
ms-azureml-model-error-statuscode: REDACTED
x-ms-client-request-id: 952ee943-35b4-4bd4-883f-a82c80c93ae3
x-ratelimit-remaining-requests: REDACTED
Strict-Transport-Security: REDACTED
X-Content-Type-Options: REDACTED
Date: Thu, 14 Dec 2023 21:59:26 GMT
Content-Length: 158
Content-Type: application/json

Here is my sample code trying to use LightPlugin in the sample docs:

OpenAIPromptExecutionSettings settings = new()
{
    ToolCallBehavior = ToolCallBehavior.AutoInvokeKernelFunctions
};

// This line throws the exception
var result = await chatService.GetChatMessageContentsAsync(chatHistory, settings, kernel);

It works fine with semantic functions, the problem is just when I'm using native functions. The native functions were also working fine in 1.0.0-rc3.


Solution

  • The problem was that since SemanticKernel 1.0.0-rc4, it requires a gpt-turbo-35 model newer than 0614. Mine was 0301.

    Good to mention that in some Azure regions (like West Europe at the time) the newer versions are not available yet. I had to create another resource on UK South so I could create a 1106 version model.