-
Notifications
You must be signed in to change notification settings - Fork 5.2k
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
Total token usage and latency metrics should be reflected in TaskResult
and Response
#4719
Comments
I see the first part as extending both Then there’s the However, what do you mean by the Console using the agent’s inner messages to keep track of total token usage? I have run the Console with a couple of teams, and it seems like it’s not only keeping track of inner messages. I could debug this further, but I’m wondering what am I missing? |
Yes
You can take a look at this example in the doc: https://microsoft.github.io/autogen/dev/user-guide/agentchat-user-guide/tutorial/custom-agents.html#arithmeticagent The total token usage reported is 0, which is false, because the selector group chat uses model client to choose the next agent. |
Thanks. |
Note the model usage of the M1 orchestrator is also not tracked. |
Right now, anytime when the inner messages that incur token usage are not emitted, it is not tracked. We would like to make sure even when no inner message is emitted, we can still track the token usage by using the |
Hi @ekzhu ,
Hmm, I couldn't find a way to do this using Response.
Recap: If the tokens usage is happening because of the I have created a PR with a proposal where we can discuss some alternatives. Alternatively, can you help me see how to use Response to share the token usage? Thanks!! Additionally, I noticed that the ultimate source of truth of token usage would be the |
I think you can create a new internal event type In Lines 140 to 141 in b15551c
In |
The current
autogen_agentchat.base.TaskResult
andautogen_agentchat.base.Response
should contain the following additional fields:autogen_core.models.RequestUsage
type.Console
is currently using agents' inner messages to keep track of the total token usage -- this is inaccurate. As agents may not emit inner messages, and SelectorGroupChat's model client usage is not reflected. We need to fix these as well.Related: #4172
The text was updated successfully, but these errors were encountered: