Skip to content

Commit

Permalink
community[patch]: callback before yield for titan takeoff
Browse files Browse the repository at this point in the history
  • Loading branch information
subroy13 committed Sep 27, 2024
1 parent c6350d6 commit 893eb61
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions libs/community/langchain_community/llms/titan_takeoff.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,13 +252,13 @@ def _stream(
if buffer: # Ensure that there's content to process.
chunk = GenerationChunk(text=buffer)
buffer = "" # Reset buffer for the next set of data.
yield chunk
if run_manager:
run_manager.on_llm_new_token(token=chunk.text)
yield chunk

# Yield any remaining content in the buffer.
if buffer:
chunk = GenerationChunk(text=buffer.replace("</s>", ""))
yield chunk
if run_manager:
run_manager.on_llm_new_token(token=chunk.text)
yield chunk

0 comments on commit 893eb61

Please sign in to comment.