azure-sdk-for-net icon indicating copy to clipboard operation
azure-sdk-for-net copied to clipboard

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

Open janaka opened this issue 1 year ago • 8 comments

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

janaka avatar May 24 '24 16:05 janaka

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

github-actions[bot] avatar May 24 '24 16:05 github-actions[bot]

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

BlackGad avatar May 27 '24 14:05 BlackGad

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

janaka avatar Jul 01 '24 15:07 janaka

Are there any updates on this?

Mako217 avatar Aug 30 '24 06:08 Mako217

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.

janaka avatar Aug 30 '24 10:08 janaka

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.

kenneth-stylespace avatar Sep 10 '24 17:09 kenneth-stylespace

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

janaka avatar Sep 11 '24 09:09 janaka

We are not on v2.1 of the dotnet SDK and this issue still has not been fixed.

As documented in https://github.com/openai/openai-dotnet/issues/103 this is a bug in the client. The backend is confirmed to support this feature.

Can somebody on the SDK team at least acknowledge this is an issue cc @jpalvarezl @trrwilson .

janaka avatar Oct 24 '24 14:10 janaka

Pretty sure this is sorted in v2.2.0 for us so closing. Thanks

janaka avatar May 24 '25 13:05 janaka