Skip to content

fix(usage): error usage format in streaming #61

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

Closed
wants to merge 1 commit into from

Conversation

Kaikaikaifang
Copy link

@Kaikaikaifang Kaikaikaifang commented Mar 12, 2025

image

In the stream_response, forgot to modify the format of usage.

Why this error occur

in _run_single_turn_stream (run.py), treat the usage as ResponseUsage, but in fact the usage is CompletionUsage, because forgot to modify the format of usage in stream_response (openai_chatcompletions.py).

fix #63

@Kaikaikaifang
Copy link
Author

@rm-openai Please review this pr to fix the current issue where the stream response is not tracking properly.

Copy link
Collaborator

@rm-openai rm-openai left a comment

Choose a reason for hiding this comment

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

This looks good - can you please add a test so this doesn't regress?

@benjaminbascary97
Copy link

Waiting on this to be merged asap

@rm-openai
Copy link
Collaborator

FYI I put out #112 so that we can merge this faster

@rm-openai rm-openai closed this Mar 13, 2025
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.

AttributeError: 'CompletionUsage' object has no attribute 'input_tokens'
3 participants