[BUG] StreamOptions is always set to null - it makes it impossible to get token usage with streaming mode
Library name and version
Azure.AI.OpenAI 2.0.0
Describe the bug
{ "stream_options": { "include_usage": true }}
is never sent to OpenAI API.
Please check CompleteChatStreamingAsync method in AzureChatClient.
It contains call to PostfixClearStreamOptions which always sets ChatCompletionOptions StreamOptions to null.
https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/openai/Azure.AI.OpenAI/src/Custom/Chat/AzureChatClient.cs#L66
As it is internal API, it is impossible to set the value.
Expected behavior
PostfixClearStreamOptions should not be called.
And ideally, setting StreamOptions should be possible with public API.
Actual behavior
PostfixClearStreamOptions is called and StreamOptions is always set to null.
Reproduction Steps
Call ChatClient.CompleteChatStreamingAsync
Environment
No response
Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @jpalvarezl @ralph-msft @trrwilson.
Hi @klinki,
Thank you for raising this issue! Hang tight while we take a look. Feel free to add more details if you have any.