diff --git a/.changeset/hot-cats-nail.md b/.changeset/hot-cats-nail.md new file mode 100644 index 0000000000000000000000000000000000000000..52b035e3382ffdef2422b003c42ffd9b76144465 --- /dev/null +++ b/.changeset/hot-cats-nail.md @@ -0,0 +1,5 @@ +--- +"@llamaindex/community": patch +--- + +fix: prevent tool calling getting mixed with conversation diff --git a/packages/community/src/llm/bedrock/providers/anthropic.ts b/packages/community/src/llm/bedrock/providers/anthropic.ts index 9dadf782f145cd3e112f08574c3a339bdedbddd0..b59f48d2a278145e4d4ae99009a49e582a9ed7e4 100644 --- a/packages/community/src/llm/bedrock/providers/anthropic.ts +++ b/packages/community/src/llm/bedrock/providers/anthropic.ts @@ -118,7 +118,7 @@ export class AnthropicProvider extends Provider<AnthropicStreamEvent> { if (!delta && !options) continue; yield { - delta, + delta: options ? "" : delta, options, raw: response, }; diff --git a/packages/community/src/llm/bedrock/utils.ts b/packages/community/src/llm/bedrock/utils.ts index 217c5a4d5df6aa145b0ec574b4a9381dc8704cdc..4c79f994cf1d423c390f6c6cb65dd7c8d8adb315 100644 --- a/packages/community/src/llm/bedrock/utils.ts +++ b/packages/community/src/llm/bedrock/utils.ts @@ -144,6 +144,8 @@ export const mapChatMessagesToAnthropicMessages = < const content = message.content[0]; if (content.type === "text" && !content.text) return false; if (content.type === "image" && !content.source.data) return false; + if (content.type === "image" && message.role === "assistant") + return false; return true; });