From 7d216ad1e1fd26ef66e0a037b011ea52f3aadc78 Mon Sep 17 00:00:00 2001 From: Yudhajit Sinha Date: Wed, 20 Mar 2024 20:28:18 +0530 Subject: [PATCH] community[patch]: Invoke callback prior to yielding token (titan_takeoff_pro) (#18624) ## PR title community[patch]: Invoke callback prior to yielding token ## PR message - Description: Invoke callback prior to yielding token in _stream_ method in llms/titan_takeoff_pro. - Issue: #16913 - Dependencies: None --- libs/community/langchain_community/llms/titan_takeoff_pro.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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("", "")) - yield chunk if run_manager: run_manager.on_llm_new_token(token=chunk.text) + yield chunk @property def _identifying_params(self) -> Mapping[str, Any]: