fix(main.py): fix logging event loop for async logging but sync streaming

This commit is contained in:
Krrish Dholakia 2024-01-25 15:59:53 -08:00
parent bbe6a92eb9
commit 72275ad8cb
2 changed files with 19 additions and 14 deletions

View file

@ -274,14 +274,10 @@ async def acompletion(
else:
# Call the synchronous function using run_in_executor
response = await loop.run_in_executor(None, func_with_context) # type: ignore
# if kwargs.get("stream", False): # return an async generator
# return _async_streaming(
# response=response,
# model=model,
# custom_llm_provider=custom_llm_provider,
# args=args,
# )
# else:
if isinstance(response, CustomStreamWrapper):
response.set_logging_event_loop(
loop=loop
) # sets the logging event loop if the user does sync streaming (e.g. on proxy for sagemaker calls)
return response
except Exception as e:
custom_llm_provider = custom_llm_provider or "openai"