fix(utils.py): fixing sync streaming for caching

This commit is contained in:
Krrish Dholakia 2024-02-26 19:32:30 -08:00
parent 788e24bd83
commit 2a6a72a0e7

View file

@ -1196,7 +1196,8 @@ class Logging:
start_time=start_time, start_time=start_time,
end_time=end_time, end_time=end_time,
) )
except: except Exception as e:
complete_streaming_response = None complete_streaming_response = None
else: else:
self.sync_streaming_chunks.append(result) self.sync_streaming_chunks.append(result)
@ -8903,13 +8904,7 @@ class CustomStreamWrapper:
response: Optional[ModelResponse] = self.chunk_creator(chunk=chunk) response: Optional[ModelResponse] = self.chunk_creator(chunk=chunk)
print_verbose(f"PROCESSED CHUNK POST CHUNK CREATOR: {response}") print_verbose(f"PROCESSED CHUNK POST CHUNK CREATOR: {response}")
if response is None or ( if response is None:
isinstance(response, ModelResponse)
and isinstance(response.choices[0], StreamingChoices)
and response.choices[0].delta.content is None
and response.choices[0].delta.function_call is None
and response.choices[0].delta.tool_calls is None
):
continue continue
## LOGGING ## LOGGING
threading.Thread( threading.Thread(