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 (pai_eas_endpoint) (#18627)
## PR title community[patch]: Invoke callback prior to yielding token ## PR message - Description: Invoke callback prior to yielding token in _stream_ method in llms/pai_eas_endpoint. - Issue: #16913 - Dependencies: None
This commit is contained in:
parent
140f06e59a
commit
9525e392de
@ -231,9 +231,9 @@ class PaiEasEndpoint(LLM):
|
|||||||
# yield text, if any
|
# yield text, if any
|
||||||
if text:
|
if text:
|
||||||
res = GenerationChunk(text=text)
|
res = GenerationChunk(text=text)
|
||||||
yield res
|
|
||||||
if run_manager:
|
if run_manager:
|
||||||
run_manager.on_llm_new_token(res.text)
|
run_manager.on_llm_new_token(res.text)
|
||||||
|
yield res
|
||||||
|
|
||||||
# break if stop sequence found
|
# break if stop sequence found
|
||||||
if stop_seq_found:
|
if stop_seq_found:
|
||||||
|
Loading…
Reference in New Issue
Block a user