diff --git a/libs/community/langchain_community/llms/titan_takeoff.py b/libs/community/langchain_community/llms/titan_takeoff.py index f89a1f5e3ac76..7f1d765a0d698 100644 --- a/libs/community/langchain_community/llms/titan_takeoff.py +++ b/libs/community/langchain_community/llms/titan_takeoff.py @@ -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("", "")) - yield chunk if run_manager: run_manager.on_llm_new_token(token=chunk.text) + yield chunk