The agent engineering platform.
Python agentsaiai-agentsanthropicchatgptdeepagentsenterpriseframeworkgeminigenerative-ailangchainlanggraphllmmultiagentopen-sourceopenaipydanticpythonragtypescript
community[patch]: fix hunyuan client json analysis (#22452) (#22767)
mrhbj9212c9fcb8d9
diff --git a/libs/community/langchain_community/chat_models/hunyuan.py b/libs/community/langchain_community/chat_models/hunyuan.pyindex e83a48c6f7..9cac65c872 100644--- a/libs/community/langchain_community/chat_models/hunyuan.py+++ b/libs/community/langchain_community/chat_models/hunyuan.py@@ -266,6 +266,11 @@ class ChatHunyuan(BaseChatModel):default_chunk_class = AIMessageChunkfor chunk in res.iter_lines():+ chunk = chunk.decode(encoding="UTF-8", errors="strict").replace(+ "data: ", ""+ )+ if len(chunk) == 0:+ continueresponse = json.loads(chunk)if "error" in response:raise ValueError(f"Error from Hunyuan api response: {response}")