microsoft / microsoft/promptflow

[Feature Request] Add token metrics to tracing for Non-OpenAI models

Open
#3,567 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement long-term
Dominant language
Python
Stars
11.2k
Forks
1.1k
PR merge metrics
No merged PRs in 30d

Description

Is your feature request related to a problem? Please describe.
I am currently running experiments (flex flows) with Phi-3 mini and want to track the number of prompt and completion tokens as part of my experiments. The tracing view that shows tokens per call and total number of tokens for OpenAI is great, and I'd love to see an easy way to integrate other models with this.

Describe the solution you'd like
A clear method or documentation on how to track token consumption for calls to non-OpenAI models like Phi-3. In this case, I think it is expected that the application code must calculate the number of tokens, but there should be a helper method for formatting that token information into the proper format and sending it to the tracing UI.

Describe alternatives you've considered
Calculating the token usage as part of the flow and adding them as fields to the flow output response. This way they will show up as columns (and I can use an aggregate method to summarize), but it also exposes that information to any consuming application when I eventually deploy.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No files or tests are named. Start by locating the existing OpenAI token-tracing integration and the tracing UI's token fields; determine how non-OpenAI callers can provide prompt and completion counts without exposing them in flow outputs. Done means a documented or supported helper path records those metrics in the tracing view.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
observability
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.