Skip to content

Commit

Permalink
add in Buffering..
Browse files Browse the repository at this point in the history
Signed-off-by: Wang, Yi A <yi.a.wang@intel.com>
  • Loading branch information
sywangyi authored and drbh committed Feb 18, 2025
1 parent 03233fd commit cbfd82d
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions router/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1345,6 +1345,18 @@ pub(crate) async fn chat_completions(
model_id.clone(),
);
yield Ok::<Event, Infallible>(event);
if stream_token.details.is_some() && stream_options
.as_ref()
.map(|s| s.include_usage)
.unwrap_or(false) {
let usage_event = create_usage_event_from_stream_token(
stream_token,
stream_options.clone(),
system_fingerprint.clone(),
model_id.clone(),
);
yield Ok::<Event, Infallible>(usage_event);
}
}
}
}
Expand Down

0 comments on commit cbfd82d

Please sign in to comment.