Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Return BadRequest when using gpt-35-turbo model #140

Closed
vincilee2 opened this issue Mar 22, 2023 · 4 comments
Closed

Return BadRequest when using gpt-35-turbo model #140

vincilee2 opened this issue Mar 22, 2023 · 4 comments

Comments

@vincilee2
Copy link

vincilee2 commented Mar 22, 2023

Describe the bug
Following the same code in README using the gpt-35-turbo model, returned bad request from azure openai. The reason is best_of is not supported at 3.5-turbo model.

To Reproduce
Run below code, use your own azure openai endpoint and api key

using Microsoft.SemanticKernel;
using Microsoft.SemanticKernel.KernelExtensions;

var kernel = Kernel.Builder.Build();

// For Azure Open AI service endpoint and keys please see
// https://learn.microsoft.com/azure/cognitive-services/openai/quickstart?pivots=rest-api
kernel.Config.AddAzureOpenAICompletionBackend(
    "gpt-35-turbo",                   // Alias used by the kernel
    "gpt-35-turbo",                  // Azure OpenAI *Deployment ID*
    "https://<your openai endpoint>.openai.azure.com/", // Azure OpenAI *Endpoint*
    "...your Azure OpenAI Key..."        // Azure OpenAI *Key*
);

string skPrompt = @"
{{$input}}

Give me the TLDR in 5 words.
";

string textToSummarize = @"
1) A robot may not injure a human being or, through inaction,
allow a human being to come to harm.

2) A robot must obey orders given it by human beings except where
such orders would conflict with the First Law.

3) A robot must protect its own existence as long as such protection
does not conflict with the First or Second Law.
";

var tldrFunction = kernel.CreateSemanticFunction(skPrompt);

var summary = await kernel.RunAsync(textToSummarize, tldrFunction);

Console.WriteLine(summary);

// Output => Protect humans, follow orders, survive.

Expected behavior
Should return 200 status code.

Additional context

{"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 Azure OpenAI Service REST API reference

@vincilee2 vincilee2 changed the title Returned BadRequest when using gpt-35-turbo model Return BadRequest when using gpt-35-turbo model Mar 22, 2023
@alexchaomander
Copy link
Contributor

Hi @vincilee2! Thank you for your message! So we currently don't support gpt-35-turbo because that is a ChatCompletion model and has a different API than the normal TextCompletion ones like text-davinci-003. But we know this is high priority and we're working on bringing it in!

@alexchaomander
Copy link
Contributor

We just landed #161! @vincilee2 I'd check that out to get gpt-35-turbo (ChatGPT) working for you. Closing this issue now, but feel free to raise it again if it doesn't work!

@zijeibo64270
Copy link

Does anyone can teach me how to use gpt-35-turbo?
I follow the doc: https://learn.microsoft.com/en-us/semantic-kernel/get-started Run the Jupyter notebooks locally, but when try to use gpt-35-turbo model with open ai, it has error: Text completion service not available
image

@alexchaomander
Copy link
Contributor

Hi @zijeibo64270! I'd refer to this example here for how to use the gpt-35-turbo model:
https://github.com/microsoft/semantic-kernel/blob/main/samples/dotnet/kernel-syntax-examples/Example17_ChatGPT.cs

There will also be another notebook example with this PR: #258

Bryan-Roe added a commit to BMR-Cloud-Dev/semantic that referenced this issue Jun 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants