feat: Add unified token usage and API call tracking - #502
Conversation
Implement unified token usage tracking and API calls count for Gemini, OpenAI, and Ollama providers, returning metrics in AnnotatedDocument.metadata.
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
|
Your branch is 1 commits behind git fetch origin main
git merge origin/main
git pushNote: Enable "Allow edits by maintainers" to allow automatic updates. |
1 similar comment
|
Your branch is 1 commits behind git fetch origin main
git merge origin/main
git pushNote: Enable "Allow edits by maintainers" to allow automatic updates. |
Description
This PR adds token usage and API call tracking across Gemini, OpenAI, and Ollama. The metrics are returned inside the
metadatadictionary of theAnnotatedDocument.Changes made:
track_api_call_detailsflag to inspect individual chunk/pass metrics.tests/token_usage_test.pyand updatedREADME.md.Fixes #155
Fixes #425
Fixes #475
Type: Feature
How Has This Been Tested?
I ran the entire test suite of the repository to verify that all existing tests pass and no regressions were introduced.
Checklist:
pylintover the affected code.