mirror of
https://github.com/hwchase17/langchain.git
synced 2025-06-26 00:23:25 +00:00
community[patch]: Invoke callback prior to yielding token (#18288)
## PR title community[patch]: Invoke callback prior to yielding PR message Description: Invoke on_llm_new_token callback prior to yielding token in _stream and _astream methods. Issue: https://github.com/langchain-ai/langchain/issues/16913 Dependencies: None Twitter handle: None
This commit is contained in:
parent
ca4f5e2408
commit
6b58943917
@ -175,6 +175,6 @@ class VolcEngineMaasLLM(LLM, VolcEngineMaasBase):
|
|||||||
chunk = GenerationChunk(
|
chunk = GenerationChunk(
|
||||||
text=res.get("choice", {}).get("message", {}).get("content", "")
|
text=res.get("choice", {}).get("message", {}).get("content", "")
|
||||||
)
|
)
|
||||||
yield chunk
|
|
||||||
if run_manager:
|
if run_manager:
|
||||||
run_manager.on_llm_new_token(chunk.text, chunk=chunk)
|
run_manager.on_llm_new_token(chunk.text, chunk=chunk)
|
||||||
|
yield chunk
|
||||||
|
Loading…
Reference in New Issue
Block a user