Return tokens count/cost for checks
Opened this issue · 1 comments
Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
As a user of the API, I often need to keep track of the number of tokens consumed with each API call to perform a certain check(e.g, RESPONSE_COMPLETENESS). Currently, there is no straightforward way to obtain this information from the API response. Therefore, I propose adding a feature to include the number of tokens used in the API response payload.
Describe the solution you'd like
A clear and concise description of what you want to happen.
It might be useful to return the number of tokens consumed while performing a certain check. For example when the check for RESPONSE_COMPLETENESS is performed, include a field to indicate what was token consumption:
{
"score_response_completeness": ...,
"explanation_response_completeness": "...",
# new field to add
"tokens_used_response_completeness": ".."
"cost_response_completeness": ".."
}
The thing is, in the end, I'm interested in knowing the cost of evaluation. If you can do the cost computation internally and just return that, then I won't need the token consumption information. If not, return the token consumption in that case, so that we can calculate the cost on our end. It is not very clear how many LLM calls are made for performing a certain check. So the tokens count returned should actually reflect the total number of tokens used combining all the calls that the backend makes for performing a certain check.
Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
Additional context
Add any other context or screenshots about the feature request here.
Thank you for your feature request - We love adding them
Thanks @ssaha1567 for raising this issue. We will take this as a part of our next release. We will keep you posted on this.