Skip to content

Azure OpenAI 2024‑05‑01-preview Deprecation for AzureCognitiveSearch - 2024‑12‑01-preview returns 400 BadRequest when role_information is present #1364

Open
@Ruben-Wien

Description

@Ruben-Wien

Azure OpenAI 2024‑12‑01-preview returns 400 BadRequest when role_information is present

Describe the bug
Invoking the Azure OpenAI Chat‑Completions API with version 2024‑12‑01-preview and an Azure AI Search data source fails whenever the request body contains the role_information field (still shown in Microsoft’s documentation ). The service responds with 400 BadRequest and states that the field is not permitted:

openai.BadRequestError: Error code: 400 - {
  "error": {
    "requestid": <REDACTED>",
    "code": 400,
    "message": "Validation error at #/data_sources/0/azure_search/parameters/role_information: Extra inputs are not permitted"
  }
}

The Azure portal also shows a retirement notice for the previously used API version 2024‑05‑01-preview:

This deployment uses the legacy model gpt‑4o, version 2024‑05‑13, which will be retired on 2025‑06‑30 (local time). After retirement, inference will return erroneous responses and new deployments will be blocked.


To Reproduce

  1. Deploy gpt‑4o 2024-08-06 (Standard) and set api_version="2024-12-01-preview".
  2. Call the API with the Python SDK v1.3.x:
curl --cacert ./<CERTIFICATE>.crt -v -X POST \
  "https://<RESSOURCE>.openai.azure.com/openai/deployments/<DEPLOYMENT>/chat/completions?api-version=2024-12-01-preview" \
  -H "Content-Type: application/json" \
  -H "api-key: <API KEY>" \
  -d @- <<'JSON'
{
  "messages": [
    { "role": "user", "content": "BlaBlaBla" }
  ],
  "data_sources": [
    {
      "type": "azure_search",
      "parameters": {
        "endpoint": "https://<AI_SEARCH_SERVICE>.search.windows.net",
        "index_name": "<INDEX_NAME>",
        "authentication": { "type": "api_key", "key": "<AI_SEARCH_KEY>" },
        "top_n_documents": 3,
        "query_type": "simple",
        "role_information": "You are an assistant that answers questions."  # per docs but invalid

      }
    }
  ]
}
JSON
  1. Observe the 400 error shown above.

Expected behavior
The POST request should always pass the system message as the first element of the messages array, regardless of whether a data source is configured. This replaces the deprecated role_information parameter.

Required code changes:

app.py → prepare_model_args

# old
if not app_settings.datasource:
    messages = [
        {
            "role": "system",
            "content": app_settings.azure_openai.system_message
        }
    ]

# new
messages = [
    {
        "role": "system",
        "content": app_settings.azure_openai.system_message
    }
]

settings.py

  • Remove the role_information field from the _SearchCommonSettings class.
  • Set MINIMUM_SUPPORTED_AZURE_OPENAI_PREVIEW_API_VERSION = "2024-12-01-preview".

After these changes, requests to API version 2024‑12‑01-preview succeed without 400 errors.


Configuration

  • Model: gpt-4o
  • API version: 2024‑12‑01-preview
  • Chat history enabled? No
  • Data source: Azure AI Search (OpenAI‑augmented index)

Logs

openai.BadRequestError ... role_information: Extra inputs are not permitted

Additional context

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