From 9525e392de23cb317124e1780f2ab6992c66909c Mon Sep 17 00:00:00 2001 From: Yudhajit Sinha Date: Wed, 20 Mar 2024 20:26:58 +0530 Subject: [PATCH] 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 --- libs/community/langchain_community/llms/pai_eas_endpoint.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/community/langchain_community/llms/pai_eas_endpoint.py b/libs/community/langchain_community/llms/pai_eas_endpoint.py index b74b9ca2a3..c84083b17e 100644 --- a/libs/community/langchain_community/llms/pai_eas_endpoint.py +++ b/libs/community/langchain_community/llms/pai_eas_endpoint.py @@ -231,9 +231,9 @@ class PaiEasEndpoint(LLM): # yield text, if any if text: res = GenerationChunk(text=text) - yield res if run_manager: run_manager.on_llm_new_token(res.text) + yield res # break if stop sequence found if stop_seq_found: