Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] StreamOptions is always set to null - it makes it impossible to get token usage with streaming mode #46407

Open
klinki opened this issue Oct 3, 2024 · 2 comments
Labels
Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team OpenAI question The issue doesn't require a change to the product in order to be resolved. Most issues start as that Service Attention Workflow: This issue is responsible by Azure service team.

Comments

@klinki
Copy link

klinki commented Oct 3, 2024

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

@github-actions github-actions bot added Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team OpenAI question The issue doesn't require a change to the product in order to be resolved. Most issues start as that Service Attention Workflow: This issue is responsible by Azure service team. labels Oct 3, 2024
Copy link

github-actions bot commented Oct 3, 2024

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

@AngelosP
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team OpenAI question The issue doesn't require a change to the product in order to be resolved. Most issues start as that Service Attention Workflow: This issue is responsible by Azure service team.
Projects
None yet
Development

No branches or pull requests

2 participants