Skip to content

Commit 8306130

Browse files
authored
Support tool use message parts (#5034)
1 parent 23d7178 commit 8306130

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

libs/langchain-anthropic/src/chat_models.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -546,13 +546,13 @@ export class ChatAnthropicMessages<
546546
type: "text" as const, // Explicitly setting the type as "text"
547547
text: contentPart.text,
548548
};
549-
} else if (contentPart.type === "tool_use") {
549+
} else if (
550+
contentPart.type === "tool_use" ||
551+
contentPart.type === "tool_result"
552+
) {
550553
// TODO: Fix when SDK types are fixed
551554
return {
552-
type: "tool_use" as const,
553-
id: contentPart.id,
554-
name: contentPart.name,
555-
input: contentPart.input,
555+
...contentPart,
556556
// eslint-disable-next-line @typescript-eslint/no-explicit-any
557557
} as any;
558558
} else {

0 commit comments

Comments
 (0)