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
This commit is contained in:
Yudhajit Sinha 2024-03-20 20:27:53 +05:30 committed by GitHub
parent 5ac1860484
commit 455a74486b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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: