Skip to content

Commit

Permalink
community[patch]: Invoke callback prior to yielding token (sparkllm) (l…
Browse files Browse the repository at this point in the history
…angchain-ai#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: langchain-ai#16913 
- Dependencies: None
  • Loading branch information
Lord-Haji authored and gkorland committed Mar 30, 2024
1 parent 8862719 commit d50badd
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion libs/community/langchain_community/llms/sparkllm.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,9 +169,9 @@ def _stream(
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:
Expand Down

0 comments on commit d50badd

Please sign in to comment.