Skip to content

Commit bf4c756

Browse files
fix(aws): fix tool result content block format
1 parent 95d1e23 commit bf4c756

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

libs/langchain-aws/src/common.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import type {
22
MessageContentComplex,
33
BaseMessage,
44
UsageMetadata,
5+
DataContentBlock,
56
} from "@langchain/core/messages";
67
import {
78
AIMessage,
@@ -23,6 +24,7 @@ import type {
2324
ReasoningContentBlock,
2425
ReasoningContentBlockDelta,
2526
ReasoningTextBlock,
27+
ToolResultContentBlock,
2628
} from "@aws-sdk/client-bedrock-runtime";
2729
import type { DocumentType as __DocumentType } from "@smithy/types";
2830
import { isLangChainTool } from "@langchain/core/utils/function_calling";
@@ -223,11 +225,9 @@ export function convertToConverseMessages(messages: BaseMessage[]): {
223225
{
224226
toolResult: {
225227
toolUseId: castMsg.tool_call_id,
226-
content: [
227-
{
228-
json: castMsg.content,
229-
},
230-
],
228+
content: (
229+
msg.content as (MessageContentComplex | DataContentBlock)[]
230+
).map((c) => ({ json: c } as ToolResultContentBlock.JsonMember)),
231231
},
232232
},
233233
],

0 commit comments

Comments
 (0)