mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-14 23:21:35 +00:00
fix(proxy): remove per-chunk debug log and use _usage_stripped flag
- Remove verbose_proxy_logger.debug that formatted every streaming chunk - Honor _usage_stripped flag from streaming handler to exclude usage during model_dump_json serialization instead of reconstructing objects
This commit is contained in:
parent
f172a34f90
commit
8140f6caf2
1 changed files with 8 additions and 5 deletions
|
|
@ -5074,10 +5074,6 @@ async def async_data_generator(
|
|||
response=response,
|
||||
request_data=request_data,
|
||||
):
|
||||
verbose_proxy_logger.debug(
|
||||
"async_data_generator: received streaming chunk - {}".format(chunk)
|
||||
)
|
||||
|
||||
### CALL HOOKS ### - modify outgoing data
|
||||
chunk = await proxy_logging_obj.async_post_call_streaming_hook(
|
||||
user_api_key_dict=user_api_key_dict,
|
||||
|
|
@ -5098,7 +5094,14 @@ async def async_data_generator(
|
|||
)
|
||||
|
||||
if isinstance(chunk, BaseModel):
|
||||
chunk = chunk.model_dump_json(exclude_none=True, exclude_unset=True)
|
||||
if getattr(chunk, "_usage_stripped", False):
|
||||
chunk = chunk.model_dump_json(
|
||||
exclude_none=True, exclude_unset=True, exclude={"usage"} # type: ignore
|
||||
)
|
||||
else:
|
||||
chunk = chunk.model_dump_json(
|
||||
exclude_none=True, exclude_unset=True
|
||||
)
|
||||
elif isinstance(chunk, str) and chunk.startswith("data: "):
|
||||
error_message = chunk
|
||||
break
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue