Skip to content

The agent engineering platform.

community[patch]: Invoke callback prior to yielding token (titan_takeoff) (#18560)

Yudhajit Sinha4570b477b9aa
diff --git a/libs/community/langchain_community/llms/titan_takeoff.py b/libs/community/langchain_community/llms/titan_takeoff.py
index 103a81b59c..9140aa0bc3 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]: