chore: deprecate TokenCounterCallback and the hardcoded TOKEN_PRICES table - #472
Open
lzhao8956-glitch wants to merge 1 commit into
Open
Conversation
…table Closes valory-xyz#319 The hardcoded TOKEN_PRICES dict in benchmarks.py is unsustainable: - Goes stale as new models ship - Grows unboundedly as the LLM ecosystem expands - Belongs to the tool package, not the mech, per the discussion on PR valory-xyz#318 This commit: - Emits DeprecationWarning on TokenCounterCallback instantiation - Adds a .. deprecated:: directive in the class docstring - Adds a module-level note explaining the rationale - Keeps the class fully functional for backwards compatibility Future work: remove the class and its TOKEN_PRICES table entirely once tool packages carry their own pricing metadata.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #319
Deprecates
TokenCounterCallbackand its hardcodedTOKEN_PRICEStable per the discussion on PR #318. The hardcoded price dict is unsustainable (goes stale as new models ship, grows unboundedly) and conflicts with the mech's intended role as a thin intermediary between clients and tools — pricing should live in each tool package instead.Changes
import warningstobenchmarks.py.. deprecated::directive to the class docstring_DEPRECATION_MSGconstantDeprecationWarningon__init__(stacklevel=2)Backwards compatibility
behaviours.py,test_benchmarks.py) continue to workDeprecationWarningat runtimeTOKEN_PRICEStable preserved (will be removed in a follow-up)Follow-up
A future PR should remove the class entirely once tool packages carry their own pricing metadata.