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

Fix cost calculation when completion_token is None #2292

Merged
merged 1 commit into from
Apr 5, 2024
Merged

Fix cost calculation when completion_token is None #2292

merged 1 commit into from
Apr 5, 2024

Conversation

yiranwu0
Copy link
Collaborator

@yiranwu0 yiranwu0 commented Apr 5, 2024

Why are these changes needed?

When using OpenAI, sometimes the response has a prompt token but the completion token is None. This would cause error when calculating the cost.
This PR fixes this issue.

Related issue number

Checks

@codecov-commenter
Copy link

codecov-commenter commented Apr 5, 2024

Codecov Report

Attention: Patch coverage is 0% with 4 lines in your changes are missing coverage. Please review.

Project coverage is 57.22%. Comparing base (16b1db3) to head (8afe469).
Report is 5 commits behind head on main.

Files Patch % Lines
autogen/oai/client.py 0.00% 2 Missing and 2 partials ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##             main    #2292       +/-   ##
===========================================
+ Coverage   38.16%   57.22%   +19.06%     
===========================================
  Files          78       78               
  Lines        7861     7865        +4     
  Branches     1681     1821      +140     
===========================================
+ Hits         3000     4501     +1501     
+ Misses       4611     2987     -1624     
- Partials      250      377      +127     
Flag Coverage Δ
unittest 14.21% <0.00%> (?)
unittests 56.21% <0.00%> (+18.06%) ⬆️

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.

@ekzhu ekzhu added this pull request to the merge queue Apr 5, 2024
Merged via the queue into main with commit 4a44093 Apr 5, 2024
67 of 75 checks passed
@ekzhu ekzhu deleted the fixcost branch April 5, 2024 21:20
whiskyboy pushed a commit to whiskyboy/autogen that referenced this pull request Apr 17, 2024
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.

3 participants