From a8155b48dbd21027c136c90318d11738ade5065e Mon Sep 17 00:00:00 2001 From: Nestor Qin Date: Tue, 23 Apr 2024 15:08:43 -0400 Subject: [PATCH] community[patch]: Fix Anthropic message formatting on Amazon Bedrock --- libs/community/langchain_community/chat_models/bedrock.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/libs/community/langchain_community/chat_models/bedrock.py b/libs/community/langchain_community/chat_models/bedrock.py index 74eb1af216e85..852eb0091f677 100644 --- a/libs/community/langchain_community/chat_models/bedrock.py +++ b/libs/community/langchain_community/chat_models/bedrock.py @@ -193,7 +193,13 @@ def format_messages( ) -_message_type_lookups = {"human": "user", "ai": "assistant"} +_message_type_lookups = { + "human": "user", + "ai": "assistant", + "AIMessageChunk": "assistant", + "HumanMessageChunk": "user", + "function": "user", +} @deprecated(