The agent engineering platform.
Python agentsaiai-agentsanthropicchatgptdeepagentsenterpriseframeworkgeminigenerative-ailangchainlanggraphllmmultiagentopen-sourceopenaipydanticpythonragtypescript
community[patch]: Invoke callback prior to yielding token fix for HuggingFaceEndpoint (#20366)
balloonio93caa568f91c
diff --git a/libs/community/langchain_community/llms/huggingface_endpoint.py b/libs/community/langchain_community/llms/huggingface_endpoint.pyindex b4bbf96d82..290b2da963 100644--- a/libs/community/langchain_community/llms/huggingface_endpoint.py+++ b/libs/community/langchain_community/llms/huggingface_endpoint.py@@ -326,9 +326,10 @@ class HuggingFaceEndpoint(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:@@ -361,9 +362,10 @@ class HuggingFaceEndpoint(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: