Sample not working for Azure OpenAI - invalid request
Describe the bug Trying to follow the basic example from: https://github.com/microsoft/semantic-kernel/blob/main/dotnet/README.md The code works with an OpenAI key, but if used with Azure OpenAI, I get an error 400 - invalid request.
To Reproduce Steps to reproduce the behavior:
- Follow https://github.com/microsoft/semantic-kernel/blob/main/dotnet/README.md
- Fill in the model deployment name, endpoint and Key
- Run the code
Expected behavior Receive the summary results
** Received behavior** Error: InvalidRequest: The request is not valid, HTTP status: 400 Error: InvalidRequest: The request is not valid, HTTP status: 400
Desktop (please complete the following information):
- OS: Windows11
- IDE: Visual Studio Enterpruse
- NuGet Package Version : 0.13.277.1-preview
- Project: C# console app
Additional context It's not an endpoint or auth problem as those results in 403 (tried the sample with the wrong key to make sure). Something in the API call to Azure OpenAI endpoint seems to have an issue. I double checked (copy/pasted) the model deployment name, the endpoint and the key directly from the Azure portal.
Ok, I was able to get more details by debugging the result from SK... It looks like gpt-35-turbo doesn't support all the parameters SK is using. So I guess it's a documentation issue? I switched to davinci and that worked.
logprobs, best_of and echo parameters are not available on gpt-35-turbo model. Please remove the parameter and try again. For more details, see https://go.microsoft.com/fwlink/?linkid=2227346. Status: 400 (BadRequest) ErrorCode: BadRequest
Content: {"error":{"code":"BadRequest","message":"logprobs, best_of and echo parameters are not available on gpt-35-turbo model. Please remove the parameter and try again. For more details, see https://go.microsoft.com/fwlink/?linkid=2227346."}}
Headers: apim-request-id: REDACTED Strict-Transport-Security: REDACTED X-Content-Type-Options: REDACTED x-ms-region: REDACTED Date: Tue, 25 Apr 2023 22:33:55 GMT Content-Length: 236 Content-Type: application/json
you use the wrong model for TextCompletionService
if you want to use gpt-35-turbo model, you should use ChatCompletionService
Can't believe I missed that! Switching to ChatCompletionService worked perfectly. Getting much better results with 35turbo on AOAI !! I think I have GPT4 on OAI so will try that next.