From f186618e9607fe88f7dd4cba1ce85134943fffa5 Mon Sep 17 00:00:00 2001 From: Michael Norgren Date: Wed, 9 Oct 2024 16:40:57 -0500 Subject: [PATCH 1/2] Added document and image support for aws bedrock --- libs/langchain-aws/src/common.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/libs/langchain-aws/src/common.ts b/libs/langchain-aws/src/common.ts index fbb3356e90e4..03db3061b2d1 100644 --- a/libs/langchain-aws/src/common.ts +++ b/libs/langchain-aws/src/common.ts @@ -144,6 +144,14 @@ export function convertToConverseMessages(messages: BaseMessage[]): { return { text: block.text, }; + } else if (block.type === 'document' && block.document !== undefined) { + return { + document: block.document, + }; + } else if (block.type === 'image' && block.image !== undefined) { + return { + image: block.image, + }; } else { throw new Error(`Unsupported content block type: ${block.type}`); } From 0ecec4df73d872b18a9c878fbb79ca708bc66f15 Mon Sep 17 00:00:00 2001 From: jacoblee93 Date: Fri, 11 Oct 2024 14:16:47 -0700 Subject: [PATCH 2/2] Format --- libs/langchain-aws/src/common.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/libs/langchain-aws/src/common.ts b/libs/langchain-aws/src/common.ts index 03db3061b2d1..8b0d8e0d2e18 100644 --- a/libs/langchain-aws/src/common.ts +++ b/libs/langchain-aws/src/common.ts @@ -144,11 +144,14 @@ export function convertToConverseMessages(messages: BaseMessage[]): { return { text: block.text, }; - } else if (block.type === 'document' && block.document !== undefined) { + } else if ( + block.type === "document" && + block.document !== undefined + ) { return { document: block.document, }; - } else if (block.type === 'image' && block.image !== undefined) { + } else if (block.type === "image" && block.image !== undefined) { return { image: block.image, };