Skip to content

The agent engineering platform.

community[patch]: Invoke callback prior to yielding token (titan_takeoff_pro) (#18624)

Yudhajit Sinha7d216ad1e1fd
diff --git a/libs/community/langchain_community/llms/titan_takeoff_pro.py b/libs/community/langchain_community/llms/titan_takeoff_pro.py
index ce96aad190..8040afab45 100644
--- a/libs/community/langchain_community/llms/titan_takeoff_pro.py
+++ b/libs/community/langchain_community/llms/titan_takeoff_pro.py
@@ -207,9 +207,9 @@ class TitanTakeoffPro(LLM):
# 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
@property
def _identifying_params(self) -> Mapping[str, Any]: