Azure / azure-sdk-for-net

This repository is for active development of the Azure SDK for .NET. For consumers of the SDK we recommend visiting our public developer docs at https://learn.microsoft.com/dotnet/azure/ or our versioned developer docs at https://azure.github.io/azure-sdk-for-net.
MIT License
5.35k stars 4.72k forks source link

[FEATURE REQ] Azure.AI.OpenAI `include_usage` in chat completion options #44237

Open janaka opened 4 months ago

janaka commented 4 months ago

Library name

Azure.AI.OpenAI

Please describe the feature.

Add include_usage options for streaming chat completions. Relevant OpenAI docs below.

https://platform.openai.com/docs/api-reference/completions/create

include_usage

Request:

image

Respose:

image
github-actions[bot] commented 4 months ago

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

BlackGad commented 4 months ago

https://github.com/Azure/azure-rest-api-specs/issues/25062 related stuff

janaka commented 3 months ago

Updated to the new v2 beta2 client. This feature seems to be switched to true by default in the OpenAI client but doesn't seem to be working.

https://github.com/openai/openai-dotnet/issues/103

Mako217 commented 1 month ago

Are there any updates on this?

janaka commented 1 month ago

Are there any updates on this?

@Mako217 on https://github.com/openai/openai-dotnet/issues/103 I was told the backend doesn't have the feature yet. Generally Azure have been terrible at communicating what the state of these features are. There are at least two other features we are waiting for were the backend state is unclear.

kenneth-stylespace commented 3 weeks ago

Seems it is now supported. Tested working on chat completion with OpenAI npm SDK with Azure credential, with ChatGPT-4o-0806, API version 2024-08-01-preview.

It never works in previous versions.

janaka commented 3 weeks ago

yes, confirmed for the save model and rest API version against eastus and sweden deployments. streaming + include_usage works for me with Postman.