The agent engineering platform.
Python agentsaiai-agentsanthropicchatgptdeepagentsenterpriseframeworkgeminigenerative-ailangchainlanggraphllmmultiagentopen-sourceopenaipydanticpythonragtypescript
community[patch]: Invoke callback prior to yielding token (#24917)
alexqiao8eb0bdead343
diff --git a/libs/community/langchain_community/chat_models/friendli.py b/libs/community/langchain_community/chat_models/friendli.pyindex 593c51ea9e..a860ebf98b 100644--- a/libs/community/langchain_community/chat_models/friendli.py+++ b/libs/community/langchain_community/chat_models/friendli.py@@ -134,9 +134,9 @@ class ChatFriendli(BaseChatModel, BaseFriendli):for chunk in stream:delta = chunk.choices[0].delta.contentif delta:- yield ChatGenerationChunk(message=AIMessageChunk(content=delta))if run_manager:run_manager.on_llm_new_token(delta)+ yield ChatGenerationChunk(message=AIMessageChunk(content=delta))async def _astream(self,@@ -152,9 +152,9 @@ class ChatFriendli(BaseChatModel, BaseFriendli):async for chunk in stream:delta = chunk.choices[0].delta.contentif delta:- yield ChatGenerationChunk(message=AIMessageChunk(content=delta))if run_manager:await run_manager.on_llm_new_token(delta)+ yield ChatGenerationChunk(message=AIMessageChunk(content=delta))def _generate(self,