OkGoDoIt / OpenAI-API-dotnet

An unofficial C#/.NET SDK for accessing the OpenAI GPT-3 API

Home Page:https://www.nuget.org/packages/OpenAI/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

LogitBias Issue

PhoenixICE opened this issue · comments

Seems like LogitBias parameter in ChatRequest always throws the error of:

System.Net.Http.HttpRequestException: Error at chat/completions (https://api.openai.com/v1/chat/completions) with HTTP status code: BadRequest. Content: {
  "error": {
    "message": "Invalid key in 'logit_bias': AI. You should only be submitting non-negative integers.",
    "type": "invalid_request_error",
    "param": "logit_bias",
    "code": null
  }
}

   at OpenAI_API.EndpointBase.HttpRequestRaw(String url, HttpMethod verb, Object postData, Boolean streaming)
   at OpenAI_API.EndpointBase.HttpRequest[T](String url, HttpMethod verb, Object postData)
   at OpenAI_API.EndpointBase.HttpPost[T](String url, Object postData)
   at OpenAI_API.Chat.ChatEndpoint.CreateChatCompletionAsync(ChatRequest request)
   at OpenAI_API.Chat.Conversation.GetResponseFromChatbotAsync()

No matter if i use positive or negative floats, example:

        chat = openai.Chat.CreateConversation(new ChatRequest()
        {
            LogitBias = new Dictionary<string, float>()
            {
                ["AI"] = 10f,
            }
         }

Oh...well thats misleading the key isn't the word its the token, should be an int then.