Skip to content

Return Token Count #41241

Open
Open
@FlorianPydde

Description

@FlorianPydde

Missing Functionality

When running queries to Azure OpenAI, the api always returns the number of tokens consumed (input tokens + output tokens) as shown below. This information is currently not returned by the evaluation package.

{
 "body": {
   ....
   "choices": [
     {
       "text": "es\n\nWhat do you call a mango who's in charge?\n\nThe head mango.",
       "index": 0,
       "finish_reason": "stop",
       "logprobs": null
     }
   ],
   "usage": { ## !!! This is what I need !!!
     "completion_tokens": 20,
     "prompt_tokens": 6,
     "total_tokens": 26
   }
 }
}

Why is this necessary ?

To ensure latency for solution in production, customers need to estimate the PTUs required taking into account not only the number of requests but also how much the evaluation process will consume.
Currently to estimate the total number of tokens, the only way is to manually load the prompt files for the different metrics (relevancy, roundedness) and use tiktoken to estimate the number of tokens. The same needs to be done for the answer and reasoning in the evaluation's response.

Expected Behaviour

In the response of each evaluation request, I'd expect an additional field ("usage" like the AOAI's case) that lists the number of token used.

Metadata

Metadata

Assignees

No one assigned

    Labels

    EvaluationIssues related to the client library for Azure AI EvaluationService AttentionWorkflow: This issue is responsible by Azure service team.customer-reportedIssues that are reported by GitHub users external to the Azure organization.feature-requestThis issue requires a new behavior in the product in order be resolved.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