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

add cost calculation to client #769

Merged
merged 7 commits into from
Nov 28, 2023
Merged

add cost calculation to client #769

merged 7 commits into from
Nov 28, 2023

Conversation

yiranwu0
Copy link
Collaborator

Why are these changes needed?

Add cost calculation to client in v0.2

Related issue number

#614

Checks

@codecov-commenter
Copy link

codecov-commenter commented Nov 26, 2023

Codecov Report

Attention: 11 lines in your changes are missing coverage. Please review.

Comparison is base (b30ead2) 27.61% compared to head (66ba07e) 37.21%.

Files Patch % Lines
autogen/oai/client.py 21.42% 11 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #769      +/-   ##
==========================================
+ Coverage   27.61%   37.21%   +9.60%     
==========================================
  Files          27       27              
  Lines        3480     3493      +13     
  Branches      789      791       +2     
==========================================
+ Hits          961     1300     +339     
+ Misses       2447     2073     -374     
- Partials       72      120      +48     
Flag Coverage Δ
unittests 37.16% <26.66%> (+9.54%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Collaborator

@joshkyh joshkyh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work! Quite a few people are asking for cost reports, it's great to have this feature (back)!

test/oai/test_client.py Outdated Show resolved Hide resolved
autogen/oai/client.py Outdated Show resolved Hide resolved
autogen/oai/client.py Show resolved Hide resolved
autogen/oai/client.py Show resolved Hide resolved
Co-authored-by: Joshua Kim <joshkyh@users.noreply.github.com>
Co-authored-by: Joshua Kim <joshkyh@users.noreply.github.com>
Copy link
Contributor

@qingyun-wu qingyun-wu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code LGTM. Just one suggestion about documentation: We should make this feature discoverable with proper documentation or demonstration in a notebook.

@yiranwu0
Copy link
Collaborator Author

The code LGTM. Just one suggestion about documentation: We should make this feature discoverable with proper documentation or demonstration in a notebook.

Got it. I just added the print cost in the documentation. I will add a notebook about cost calculation in the next PR when implementing cost summary of a client instance.

@afourney
Copy link
Member

afourney commented Nov 28, 2023

The code LGTM. Just one suggestion about documentation: We should make this feature discoverable with proper documentation or demonstration in a notebook.

I'll add it to the Testbed as well, once it has progressed to the point where we're computing costs for agents and group chats.

@sonichi sonichi added this pull request to the merge queue Nov 28, 2023
Merged via the queue into main with commit f812a23 Nov 28, 2023
66 of 71 checks passed
@sonichi sonichi deleted the addcost branch December 3, 2023 18:58
whiskyboy pushed a commit to whiskyboy/autogen that referenced this pull request Apr 17, 2024
* add cost calculation

* Update autogen/oai/client.py

Co-authored-by: Joshua Kim <joshkyh@users.noreply.github.com>

* Update autogen/oai/client.py

Co-authored-by: Joshua Kim <joshkyh@users.noreply.github.com>

* update

* add doc

---------

Co-authored-by: Joshua Kim <joshkyh@users.noreply.github.com>
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.

6 participants