-
Notifications
You must be signed in to change notification settings - Fork 5.3k
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
Add usage summary for agents #1269
Conversation
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #1269 +/- ##
===========================================
+ Coverage 32.08% 66.57% +34.48%
===========================================
Files 32 33 +1
Lines 4394 4431 +37
Branches 1025 1090 +65
===========================================
+ Hits 1410 2950 +1540
+ Misses 2867 1178 -1689
- Partials 117 303 +186
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Wait , how does this work for agents like GroupChatManager or agents that are enabled as Teachable? These agents make additional LLM calls outside the usual flow. |
I'm fixing the test failure in #1284 |
Thanks for the comment! Based on these observations, I am considering the following changes for this PR:
In the next step, maybe we can provide an abstract class method in |
@kevin666aa we can also merge this PR and make the proposed change in the next PR (create an issue first). |
* update * update * Update notebook/oai_client_cost.ipynb Co-authored-by: Chi Wang <[email protected]> * update doc and test --------- Co-authored-by: Qingyun Wu <[email protected]> Co-authored-by: Chi Wang <[email protected]>
* update * update * Update notebook/oai_client_cost.ipynb Co-authored-by: Chi Wang <[email protected]> * update doc and test --------- Co-authored-by: Qingyun Wu <[email protected]> Co-authored-by: Chi Wang <[email protected]>
Why are these changes needed?
Agent.print_usage_summary()
will print the cost summary for the agent.Agent.get_actual_usage()
andAgent.get_total_usage()
will return the usage summary in a dict. When an agent doesn't use LLM, they will return None.Agent.reset()
will reset the usage summary.autogen.agent_utils.gather_usage_summary
will gather the usage summary for a list of agents.Related issue number
Closes #1070
Checks