Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support token counting for OpenAI, DashScope, Gemini and HuggingFace models #470

Merged
merged 9 commits into from
Nov 5, 2024

Conversation

DavdGao
Copy link
Collaborator

@DavdGao DavdGao commented Oct 23, 2024

Description

  1. Add a new tokens module in AgentScope to handle token related events
  2. Support to count tokens for OpenAI, DashScope, Gemini and HuggingFace models
  3. Support to register token counting functions

TODO

A more elegant way to register token counting functions for different models

Checklist

Please check the following items before code is ready to be reviewed.

  • Code has passed all tests
  • Docstrings have been added/updated in Google Style
  • Documentation has been updated
  • Code is ready for review

src/agentscope/tokens.py Outdated Show resolved Hide resolved
src/agentscope/tokens.py Outdated Show resolved Hide resolved
src/agentscope/tokens.py Outdated Show resolved Hide resolved
@DavdGao DavdGao merged commit 1d0373b into modelscope:main Nov 5, 2024
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants