Description
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
- Deploy gpt‑4o 2024-08-06 (Standard) and set
api_version="2024-12-01-preview"
. - 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
- 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
- Microsoft Docs (retrieved 2025‑05‑13): https://learn.microsoft.com/en-us/azure/ai-services/openai/references/azure-search?tabs=python#parameters
- A fix is required before the legacy model is retired on 2025‑06‑30 to avoid production outages.