Skip to content

logprobs parameter support for Chat Completion API and GPT-4 model  #1080

@MRvra-MSFT

Description

@MRvra-MSFT

Confirm this is an issue with the Python library and not an underlying OpenAI API

  • This is an issue with the Python library

Describe the bug

May you please share a documentation regarding the correct usage of logprobs parameter in Chat Completion API as well as support for the following models.

  1. gpt-4-0613
  2. gpt-4-1106-Preview

Currently, when using the parameter with the above models the following errors are returned by the Chat Completion API. openai version is 1.7.2

gpt-4-06-13
BadRequestError: Error code: 400 - {'error': {'message': 'Unrecognized request argument supplied: logprobs', 'type': 'invalid_request_error', 'param': None, 'code': None}}

gpt-4-1106
BadRequestError: Error code: 400 - {'error': {'message': "This model does not support the 'logprobs' parameter.", 'type': 'invalid_request_error', 'param': 'logprobs', 'code': None}}

To Reproduce

Please see code snippet below.

Code snippets

from openai import AzureOpenAI
 
client = AzureOpenAI(
  azure_endpoint = 'API_ENDPOINT', 
  api_key='API_KEY',  
  api_version='2023-05-15',
  azure_deployment = 'gpt-4-1106'
)

response = client.chat.completions.create(
    model='gpt-4',
    messages=[
        {....}
    ],
    logprobs=True,
    top_logprobs=2
)
response

OS

Windows11

Python version

Python v3.11.2

Library version

openai v1.7.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions