Skip to content

The agent engineering platform.

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

Yudhajit Sinha455a74486b25
diff --git a/libs/community/langchain_community/llms/sparkllm.py b/libs/community/langchain_community/llms/sparkllm.py
index f2735f108d..e7596929c9 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: