-
Notifications
You must be signed in to change notification settings - Fork 461
[Bugfix] reused metrics to modify the API Server token statistics in Stream Response #1301
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
Changes from 5 commits
f5312af
d5f4c59
2d7d7e5
5973e72
92b855e
47db423
cb223a8
671c7f1
3fd876b
dae1460
a0bf25f
8f8c69d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -71,6 +71,7 @@ class MixRequestFuncOutput(RequestFuncOutput): | |
| audio_duration: float = 0.0 | ||
| audio_frames: int = 0 | ||
| audio_rtf: float = 0.0 | ||
| text_latency: float = 0.0 | ||
|
|
||
|
|
||
| async def async_request_openai_chat_omni_completions( | ||
|
|
@@ -148,6 +149,7 @@ async def async_request_openai_chat_omni_completions( | |
| output.itl.append(timestamp - most_recent_timestamp) | ||
| generated_text += content or "" | ||
| most_recent_timestamp = timestamp | ||
| output.text_latency = timestamp - st | ||
| elif modality == "audio": | ||
| if output.audio_ttfp == 0.0: | ||
| output.audio_ttfp = timestamp - st | ||
|
|
@@ -161,8 +163,8 @@ async def async_request_openai_chat_omni_completions( | |
| else: | ||
| generated_audio = generated_audio + seg | ||
|
|
||
| elif usage := data.get("usage"): | ||
| output.output_tokens = usage.get("completion_tokens") | ||
| if metrics := data.get("metrics"): | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Set default values to avoid possible error
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. fixed
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This selection is legal cause := firstly get the value from the formula and then transfer to the metrics param. If no attribution is found, it returns None, which makes this judgement execute no more. |
||
| output.output_tokens = metrics.get("num_tokens_out") | ||
|
|
||
| output.latency = timestamp - st | ||
| output.generated_text = generated_text | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The same
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This attribute is pre-defined in the struct, having a default value as 0