Skip to content

The agent engineering platform.

community[patch]: callback before yield for titan takeoff (#26930)

Subhrajyoty Roy5f2cc4ecb26c
diff --git a/libs/community/langchain_community/llms/titan_takeoff.py b/libs/community/langchain_community/llms/titan_takeoff.py
index f89a1f5e3a..7f1d765a0d 100644
--- a/libs/community/langchain_community/llms/titan_takeoff.py
+++ b/libs/community/langchain_community/llms/titan_takeoff.py
@@ -252,13 +252,13 @@ class TitanTakeoff(LLM):
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