Fix Group Chat usage summary (tokens + cost) #173
Draft
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.
UPDATE: We are exploring the native integration of telemetry to provide a more holistic capture of the key events and costs of your AG2 workflow. So, this PR may be supeseded by that integration. Exploration continues...
Why are these changes needed?
An issue raised by @bassilkhilo, #103, identified a bug with the ChatResult of a group chat not including the costs.
After investigating, I've found that when calculating the costs in
initiate_chat
/a_initiate_chat
it is not looking at the costs of the agents in the group chat (only the initiating agent and the group chat manager).This addresses that.
The status of this PR is that it is pulling through the costs of the agents in the group chat, however it is not including the costs of the speaker selection agent when in auto speaker selection mode. This needs to be addressed as well.
As it is, this will work for a swarm, which doesn't use that.
TODO: Review nested chats to ensure those costs are coming through as well.
Related issue number
Closes #103
Checks