fix potential process stuck issue

This commit is contained in:
Aiden Dai
2025-03-22 18:39:08 +08:00
parent 0ead770069
commit 4f1a75b49f

View File

@@ -1,3 +1,4 @@
import asyncio
import base64
import json
import logging
@@ -220,6 +221,7 @@ class BedrockModel(BaseChatModel):
# and the choices field will always be an empty array.
# All other chunks will also include a usage field, but with a null value.
yield self.stream_response_to_bytes(stream_response)
await asyncio.sleep(0)
# return an [DONE] message at the end.
yield self.stream_response_to_bytes()