Skip to content

The agent engineering platform.

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

Robby0653aa469a74
diff --git a/libs/community/langchain_community/llms/watsonxllm.py b/libs/community/langchain_community/llms/watsonxllm.py
index aaea7cd06f..c35e991db3 100644
--- a/libs/community/langchain_community/llms/watsonxllm.py
+++ b/libs/community/langchain_community/llms/watsonxllm.py
@@ -397,7 +397,7 @@ class WatsonxLLM(BaseLLM):
prompt=prompt, raw_response=True, params=params
):
chunk = self._stream_response_to_generation_chunk(stream_resp)
- yield chunk
if run_manager:
run_manager.on_llm_new_token(chunk.text, chunk=chunk)
+ yield chunk