Properly close mistral response
This commit is contained in:
@@ -46,12 +46,12 @@ class MistralLlmEngine(LlmEngine):
|
||||
try:
|
||||
for chunk in stream_response:
|
||||
if should_stop():
|
||||
stream_response.close()
|
||||
stream_response.response.close()
|
||||
break
|
||||
if content := chunk.data.choices[0].delta.content:
|
||||
yield content
|
||||
finally:
|
||||
stream_response.close()
|
||||
stream_response.response.close()
|
||||
|
||||
def token_count(self, system_prompt: str, main_context: str) -> int:
|
||||
messages = [
|
||||
|
||||
Reference in New Issue
Block a user