Skip to content

chore: deprecate TokenCounterCallback and the hardcoded TOKEN_PRICES table - #472

Open
lzhao8956-glitch wants to merge 1 commit into
valory-xyz:mainfrom
lzhao8956-glitch:chore/deprecate-token-counter-callback
Open

chore: deprecate TokenCounterCallback and the hardcoded TOKEN_PRICES table#472
lzhao8956-glitch wants to merge 1 commit into
valory-xyz:mainfrom
lzhao8956-glitch:chore/deprecate-token-counter-callback

Conversation

@lzhao8956-glitch

Copy link
Copy Markdown

Summary

Closes #319

Deprecates TokenCounterCallback and its hardcoded TOKEN_PRICES table 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

  • Adds import warnings to benchmarks.py
  • Adds a module-level deprecation note explaining the rationale
  • Adds a .. deprecated:: directive to the class docstring
  • Adds a _DEPRECATION_MSG constant
  • Emits DeprecationWarning on __init__ (stacklevel=2)

Backwards compatibility

  • Class is fully functional — no behavior change
  • All callers (behaviours.py, test_benchmarks.py) continue to work
  • Existing tests still pass; they will emit DeprecationWarning at runtime
  • TOKEN_PRICES table 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.

…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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Deprecate TokenCounterCallback

1 participant