From 455a74486b25807b24507bc31cfe74a93a143e31 Mon Sep 17 00:00:00 2001 From: Yudhajit Sinha Date: Wed, 20 Mar 2024 20:27:53 +0530 Subject: [PATCH] community[patch]: Invoke callback prior to yielding token (sparkllm) (#18625) ## PR title community[patch]: Invoke callback prior to yielding token ## PR message - Description: Invoke callback prior to yielding token in _stream_ method in llms/sparkllm. - Issue: #16913 - Dependencies: None --- libs/community/langchain_community/llms/sparkllm.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/community/langchain_community/llms/sparkllm.py b/libs/community/langchain_community/llms/sparkllm.py index f2735f108d0..e7596929c98 100644 --- a/libs/community/langchain_community/llms/sparkllm.py +++ b/libs/community/langchain_community/llms/sparkllm.py @@ -169,9 +169,9 @@ class SparkLLM(LLM): if "data" not in content: continue delta = content["data"] - yield GenerationChunk(text=delta["content"]) if run_manager: run_manager.on_llm_new_token(delta) + yield GenerationChunk(text=delta["content"]) class _SparkLLMClient: