mirror of
https://github.com/BerriAI/litellm.git
synced 2026-08-28 05:25:59 +00:00
fix indentation and add clarifying comment for usage stripping
This commit is contained in:
parent
a70414d646
commit
437d504ef0
1 changed files with 4 additions and 0 deletions
|
|
@ -1960,6 +1960,10 @@ class CustomStreamWrapper:
|
|||
# The copy in self.chunks retains usage for
|
||||
# calculate_total_usage().
|
||||
processed_chunk.usage = None # type: ignore
|
||||
# After nullifying usage, check if the chunk has any
|
||||
# remaining content (delta, finish_reason, etc.).
|
||||
# is_model_response_stream_empty sees usage=None and
|
||||
# correctly skips it, only checking meaningful fields.
|
||||
is_empty = is_model_response_stream_empty(
|
||||
model_response=cast(ModelResponseStream, processed_chunk)
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue