Skip to content

Commit

Permalink
community[patch]: Invoke callback prior to yielding token (sparkllm) (#…
Browse files Browse the repository at this point in the history
…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
  • Loading branch information
Lord-Haji authored and hinthornw committed Apr 26, 2024
1 parent ef028f8 commit 9321d12
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 9321d12

Please sign in to comment.