Logprobs not Completions.create() got an unexpected keyword argument 'logprobs'

client = OpenAI(
    # This is the default and can be omitted
    api_key=SECEREC_KEY,
)

response = client.chat.completions.create(
    model='gpt-3.5-turbo',
    # model='gpt-4-1106-preview',
    messages=prompts,
    stream=False,
    # frequency_penalty=penalty,
    presence_penalty=penalty,
    logprobs=True,
    top_logprobs=20
    
)

above code,
Completions.create() got an unexpected keyword argument ‘logprobs’
error happened.

whats wrong??

1 Like

Update the OpenAI client library to the latest.

pip install --upgrade openai tiktoken

The library validates inputs strictly, preventing you from sending valid input to the API, thus making it not forward-compatible.

2 Likes

Thanks a lot. A similar problem in Completions.create() has been resolved after this. :pray: