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