Merge pull request #3797 from BerriAI/litellm_fix_post_call_streaming_hooks

[Fix]  async_post_call_streaming_hook not triggered on proxy server
This commit is contained in:
Ishaan Jaff 2024-05-23 15:35:47 -07:00 committed by GitHub
commit 769070b3fe
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 95 additions and 10 deletions

View file

@ -3402,6 +3402,12 @@ async def async_data_generator(
try:
start_time = time.time()
async for chunk in response:
### CALL HOOKS ### - modify outgoing data
chunk = await proxy_logging_obj.async_post_call_streaming_hook(
user_api_key_dict=user_api_key_dict, response=chunk
)
chunk = chunk.model_dump_json(exclude_none=True)
try:
yield f"data: {chunk}\n\n"