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

.Net: Bug: Token usage missing for Azure OpenAI Streaming Completion #9420

Open
lukasz-appstream opened this issue Oct 24, 2024 · 4 comments
Assignees
Labels
ai connector Anything related to AI connectors blocked This issue is blocked from making progress .NET Issue or Pull requests regarding .NET code

Comments

@lukasz-appstream
Copy link

lukasz-appstream commented Oct 24, 2024

Bug summary
When I use Azure OpenAI I don't get Usage in metadata any of the chunks.

Technical Details
SemanticKernel: 1.24.1 (.NET)
Model: gpt-4o
Azure OpenAI Api version: 2024-10-01-PREVIEW

Bug Description
I checked any chunk and I haven't got Usage in any of them when using chat completion with streaming and from what I've read - Usage should be there for Azure OpenAI Service in this API.

@lukasz-appstream lukasz-appstream added the bug Something isn't working label Oct 24, 2024
@moonbox3
Copy link
Contributor

Hi @lukasz-appstream, thanks for filing the issue. For the streaming API, the usage is included in the last chunk. @markwallace-microsoft / @dmytrostruk for visibility, just in case.

@lukasz-appstream
Copy link
Author

Thanks @moonbox3 for the response! Yeah, I thought so, I updated the library, I updated the api version, I saved the last message and it still had metadata?["Usage"] == null... Does it actually work with Azure OpenAI Connector, or for now only for OpenAI Connector?

@JadynWong
Copy link
Contributor

JadynWong commented Oct 25, 2024

While the new api version supports stream token usage, the azure openai sdk still does not support it at this time. openai sdk has always supported it for raw openai, but SK has not implemented it yet.
Streaming token usage added to OpenAI in #9022

see #9005

https://github.com/Azure/azure-sdk-for-net/blob/main/sdk%2Fopenai%2FAzure.AI.OpenAI%2Fsrc%2FCustom%2FChat%2FAzureChatClient.cs#L82

@RogerBarreto
Copy link
Member

RogerBarreto commented Oct 25, 2024

@JadynWong thanks for adding the context to this issue.

This issue will be blocked until Azure SDK provides support for getting the usage.

For context we are tracking those issues in Azure SDK repo

@RogerBarreto RogerBarreto reopened this Oct 25, 2024
@markwallace-microsoft markwallace-microsoft added .NET Issue or Pull requests regarding .NET code triage labels Oct 25, 2024
@github-actions github-actions bot changed the title Bug: Token usage missing for Azure OpenAI Streaming Completion .Net: Bug: Token usage missing for Azure OpenAI Streaming Completion Oct 25, 2024
@RogerBarreto RogerBarreto added blocked This issue is blocked from making progress ai connector Anything related to AI connectors and removed triage bug Something isn't working labels Oct 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ai connector Anything related to AI connectors blocked This issue is blocked from making progress .NET Issue or Pull requests regarding .NET code
Projects
Status: Backlog: Planned
Development

No branches or pull requests

5 participants