Azure / azure-sdk-for-js

This repository is for active development of the Azure SDK for JavaScript (NodeJS & Browser). For consumers of the SDK we recommend visiting our public developer docs at https://docs.microsoft.com/javascript/azure/ or our versioned developer docs at https://azure.github.io/azure-sdk-for-js.
MIT License
2.07k stars 1.19k forks source link

Support o1-preview models #31317

Open vinnymac opened 2 weeks ago

vinnymac commented 2 weeks ago

Is your feature request related to a problem? Please describe. I have access to o1-preview models on azure, but cannot use them with openai and @azure/openai/types.

Describe the solution you'd like When using the chat completion API I expect to be able to use the latest o1-preview model. Instead I receive an error:

Error: 400 An error occurred when calling Azure OpenAI: Server responded with status 400. Error message: {
            "error": {
              "message": "Unsupported value: 'messages[0].role' does not support 'system' with this model.",
              "type": "invalid_request_error",
              "param": "messages[0].role",
              "code": "unsupported_value"
            }
          }
              at Function.generate (/Users/user/node_modules/openai/src/error.ts:70:14)
              at AzureOpenAI.makeStatusError (/Users/user/node_modules/openai/src/core.ts:431:21)
              at AzureOpenAI.makeRequest (/Users/user/node_modules/openai/src/core.ts:495:24)
              at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
              at MyAzureService.createChatCompletion (/Users/user/project/src/script.ts:249:20)
              at main (/Users/user/project/src/index.mts:56:3)
              at <anonymous> (/Users/user/project/src/index.mts:64:3)

Note: I do not have a "system" role defined. Here is my messages array:

const messages = [
  { role: 'user', content: 'You respond world when the user says hello.' }
];

Additionally the o1-preview models do not appear to be compatible with role_information, and return another error:

 Error: 400 Validation error at #/data_sources/0/azure_search/parameters/role_information: Extra inputs are not permitted

Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.

Not using Azure OpenAI, but instead using OpenAI directly works just fine.

Additional context Add any other context or screenshots about the feature request here.

In case it helps the requestid is 23238976-bcd7-40e4-97cc-a97404e33545.

deyaaeldeen commented 2 weeks ago

Hi @vinnymac. Thanks for reaching out! Yeah I agree the error message is confusing in this case. One thing to double check, are you setting the API version to 2024-09-01-preview as mentioned in the docs?

This issue doesn't seem to be an SDK issue given that calls to OpenAI work fine. I would encourage you to open an Azure support ticket. To open a support ticket, please refer to the guide here. In the meantime, please feel free to reach out if you have any other questions!

vinnymac commented 2 weeks ago

Yes the API version is set to 2024-09-01-preview.

I am meeting with a support representative tomorrow, if I learn anything I’ll report back here.

EDIT: Meeting got pushed back, but looking forward to discussing this issue with technical support more soon.