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
1.99k stars 1.16k forks source link

ChatCompletions interface does not match actual payload #28966

Closed dangchinh25 closed 6 hours ago

dangchinh25 commented 4 months ago

Describe the bug ChatCompletions interface does not contain model and object attribute, but the actual received payload does have these values.

The code I tried with:

 const chatCompletion = await azureOpenAIClient.getChatCompletions(azureOpenAIDeploymentName, payload.messages, {
      functions: payload.functions,
      functionCall: payload.function_call,
      maxTokens: payload.maxTokens,
      temperature: payload.temperature,
      topP: payload.topP,
    })

console.log(chatCompletion)
image

To Reproduce Steps to reproduce the behavior:

Expected behavior Type definition and actual response object match each other.

Screenshots If applicable, add screenshots to help explain your problem.

Additional context Add any other context about the problem here.

github-actions[bot] commented 4 months ago

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @glharper.

deyaaeldeen commented 4 months ago

This is similar to https://github.com/Azure/azure-sdk-for-js/issues/26579. It is intentional to hide those properties because we believe they're not relevant to the experience of the SDK customers. Could you please share how do you intend to use object and model?

dangchinh25 commented 4 months ago

I think I'm in a similar scenario with issue https://github.com/Azure/azure-sdk-for-js/issues/26579 where we just want to do some logging/auditing on our end. I also want to point out that the deploymentId is not always the model name so we can't rely on that. I see that you also mentioned some workaround but I'm not sure that is the best way to do this when we already have this information ready on our end.

huytool157 commented 4 months ago

Seeing the same issue

deyaaeldeen commented 6 hours ago

Hi @dangchinh25 and @huytool157, we strongly recommend that you migrate to use the AzureOpenAI client exported by the official OpenAI client library for JavaScript. Checkout the migration guide for how to do so while maintaining typing for Azure features.

Please let us know if you have any other questions!