Skip to content

Commit

Permalink
fix streaming issue (opea-project#81)
Browse files Browse the repository at this point in the history
Signed-off-by: letonghan <[email protected]>
  • Loading branch information
letonghan authored May 22, 2024
1 parent 7d823cf commit 1cf449b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion comps/cores/mega/orchestrator.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ async def execute(self, cur_node: str, inputs: Dict):

def generate():
if response:
for chunk in response.iter_lines(decode_unicode=False, delimiter=b"\0"):
for chunk in response.iter_content(chunk_size=None):
if chunk:
yield chunk

Expand Down
4 changes: 2 additions & 2 deletions comps/llms/langchain/llm_tgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ def llm_generate(input: LLMParamsDoc):

if input.streaming:

def stream_generator():
async def stream_generator():
chat_response = ""
for text in llm.stream(input.query):
async for text in llm.astream(input.query):
chat_response += text
processed_text = post_process_text(text)
if text and processed_text:
Expand Down

0 comments on commit 1cf449b

Please sign in to comment.