Skip to content

The agent engineering platform.

community[patch]: Invoke callback prior to yielding token (pai_eas_endpoint) (#18627)

Yudhajit Sinha9525e392de23
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: