openai-python icon indicating copy to clipboard operation
openai-python copied to clipboard

Why do we get a `openai.error.InvalidRequestError` if we pass `None` to `logit_bias` even if it defaults to `null`?

Open nbro10 opened this issue 1 year ago • 3 comments

Describe the bug

According to the docs, logit_bias defaults to null, but if we pass None to this parameter we get openai.error.InvalidRequestError

openai.error.InvalidRequestError: None is not of type 'object' - 'logit_bias'

So, I suppose this is a bug in this package, as None should correspond to what the docs refer to as null, or the documentation is wrong.

To Reproduce

Use the script below

Code snippets

import openai

completions = openai.Completion.create(model="text-davinci-003",
                                       prompt="hello",
                                       logit_bias=None)
print(completions)

OS

macos monterey (12.5.1)

Python version

Python 3.8.13

Library version

0.27.0

nbro10 avatar Mar 08 '23 14:03 nbro10