Skip to content

azure-ai-inference: token count attributes missing for streaming calls in traces #40113

Open
@aprilk-ms

Description

@aprilk-ms
  • Package Name: azure-ai-inference
  • Package Version: 1.0.0b9
  • Operating System: Linux
  • Python Version: 3.11

Describe the bug
Token count attributes are missing in the AI trace for streaming chat completion calls.
Image

I can see token count if change the LLM call to no streaming
Image

After consulting with Jarno/Marko from the SDK team, they have this finding --> seems that the token count in the streaming case is not provided by the openai based models that I tested. I tested a non-openai based model and in that case the token count is reported.

To Reproduce
Steps to reproduce the behavior:

  1. Enable tracing
  2. Issue a streaming chat completion call to an openai model (e.g. gpt-4o-mini)
  3. Check the app insights logs
  4. Observe that token count attributes are missing

Expected behavior
Token count attributes should be present.

Metadata

Metadata

Assignees

Labels

AI Model InferenceIssues related to the client library for Azure AI Model Inference (\sdk\ai\azure-ai-inference)ClientThis issue points to a problem in the data-plane of the library.needs-team-attentionWorkflow: This issue needs attention from Azure service team or SDK team

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions