The agent engineering platform.
Python agentsaiai-agentsanthropicchatgptdeepagentsenterpriseframeworkgeminigenerative-ailangchainlanggraphllmmultiagentopen-sourceopenaipydanticpythonragtypescript
community[patch]: Invoke callback prior to yielding token fix [HuggingFaceTextGenInference] (#20426)
balloonioe786da777468
diff --git a/libs/community/langchain_community/llms/huggingface_text_gen_inference.py b/libs/community/langchain_community/llms/huggingface_text_gen_inference.pyindex 9f56a949c6..e053d17278 100644--- a/libs/community/langchain_community/llms/huggingface_text_gen_inference.py+++ b/libs/community/langchain_community/llms/huggingface_text_gen_inference.py@@ -259,9 +259,10 @@ class HuggingFaceTextGenInference(LLM):# yield text, if anyif text:chunk = GenerationChunk(text=text)- yield chunk+if run_manager:run_manager.on_llm_new_token(chunk.text)+ yield chunk# break if stop sequence foundif stop_seq_found:@@ -295,9 +296,10 @@ class HuggingFaceTextGenInference(LLM):# yield text, if anyif text:chunk = GenerationChunk(text=text)- yield chunk+if run_manager:await run_manager.on_llm_new_token(chunk.text)+ yield chunk# break if stop sequence foundif stop_seq_found: