You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
That's because in #17307 it was introduced this code to change the role of the system prompt for OpenAI messages, but this doesn't work in Azure OpenAI as they still use the old format:
# TODO: O1 models do not support system prompts if model is not None and model in O1_MODELS: if message_dict["role"] == "system": message_dict["role"] = "developer"
Since AzureOpenAI imports from OpenAI
#base.py from llama_index.llms.openai import OpenAI
The same behaviour is wrongly applied to the AzureOpenAI class
Version
0.12.11
Steps to Reproduce
Instantiate a client using AzureOpenAI with an O1 model
Use anything that passes a system message to the llm
@EmanueleMeazzo Hello! I'm here to help you with any bugs, questions, or contributions while you wait for a human maintainer.
The issue you're encountering is due to a change introduced in pull request #17307, which modifies the role of system prompts to "developer" for O1 models. This change is not compatible with Azure OpenAI, which still expects the old format with roles like "system", "assistant", "user", "function", and "tool" [1].
To resolve this, you would need to ensure that the role conversion logic does not apply to Azure OpenAI models or adjust the role conversion to match Azure's expected values. This might involve modifying the code to check if the model is an Azure OpenAI model and skip or adjust the role conversion accordingly.
Bug Description
#17307 introduced a regression for O1 models hosted in Azure OpenaAI
When using an O1 Azure OpenAI model the following error appears:
Error code: 400 - {'error': {'message': "Invalid value: 'developer'. Supported values are: 'system', 'assistant', 'user', 'function', and 'tool'.", 'type': 'invalid_request_error', 'param': 'messages[0].role', 'code': 'invalid_value'}}
That's because in #17307 it was introduced this code to change the role of the system prompt for OpenAI messages, but this doesn't work in Azure OpenAI as they still use the old format:
# TODO: O1 models do not support system prompts if model is not None and model in O1_MODELS: if message_dict["role"] == "system": message_dict["role"] = "developer"
Since AzureOpenAI imports from OpenAI
#base.py from llama_index.llms.openai import OpenAI
The same behaviour is wrongly applied to the AzureOpenAI class
Version
0.12.11
Steps to Reproduce
Relevant Logs/Tracbacks
The text was updated successfully, but these errors were encountered: