From 4570b477b9aa5411d7ccddabcce141bd2caae542 Mon Sep 17 00:00:00 2001 From: Yudhajit Sinha Date: Wed, 6 Mar 2024 02:24:26 +0530 Subject: [PATCH] community[patch]: Invoke callback prior to yielding token (titan_takeoff) (#18560) ## 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. - Issue: #16913 - Dependencies: None --- libs/community/langchain_community/llms/titan_takeoff.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/community/langchain_community/llms/titan_takeoff.py b/libs/community/langchain_community/llms/titan_takeoff.py index 103a81b59c6..9140aa0bc3a 100644 --- a/libs/community/langchain_community/llms/titan_takeoff.py +++ b/libs/community/langchain_community/llms/titan_takeoff.py @@ -151,9 +151,9 @@ class TitanTakeoff(LLM): for text in response.iter_content(chunk_size=1, decode_unicode=True): if text: chunk = GenerationChunk(text=text) - yield chunk if run_manager: run_manager.on_llm_new_token(token=chunk.text) + yield chunk @property def _identifying_params(self) -> Mapping[str, Any]: