Skip to content

AzureOpenAI client usage is inconsistent with the API description regarding model id #1089

Closed
@jhakulin

Description

@jhakulin

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

Following are examples of chat completions create and assistants create calls:

response = client.chat.completions.create(
model=model,
messages=messages
)

assistant = client.beta.assistants.create(
name=name,
instructions=instructions,
tools=tools,
model=model,
file_ids=file_ids
)

In both API methods, the model parameter is specified as
model: ID of the model to use. See the model endpoint compatibility table for details on which models work with the Chat API.

The problem is that if client has been created with AzureOpenAI() constructor,
the required model parameter value is not actually model id but model deployment name (from Azure Portal)

This is problematic because:

  1. Documentation asks for model id, not for deployment name
  2. If customer lists the models using following API client.models.list(), it provides model ids that
    works OK with OpenAI client, but not with AzureOpenAI client (unless the deployment name is the same as model id)
  3. Listing the models using client api is probably common and the values there are expected to work with client APIs.

The problem can be avoided with AzureOpenAI if model deployment name and model id are the same, but it is not
clear for user always to do that.

To Reproduce

  1. Create Azure OpenAI resource and create model deployment with some name which is not the same as model id(name)
  2. Construct AzureOpenAI client
  3. List the model ids using client.models.list() API
  4. Use e.g. chat completion api with the model id
  5. If the model id is not the same as model deployment name, there will be a "model deployment not found" error

Code snippets

No response

OS

Windows

Python version

Python v3.12.1

Library version

openai v1.7.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions