diff --git a/libs/vertexai/langchain_google_vertexai/_anthropic_utils.py b/libs/vertexai/langchain_google_vertexai/_anthropic_utils.py index fd3721d2..bac60289 100644 --- a/libs/vertexai/langchain_google_vertexai/_anthropic_utils.py +++ b/libs/vertexai/langchain_google_vertexai/_anthropic_utils.py @@ -99,8 +99,8 @@ def _format_message_anthropic(message: Union[HumanMessage, AIMessage]): if block["type"] == "image_url": # convert format - new_block["source"] = _format_image(block["image_url"]["url"]) - content.append(new_block) + source = _format_image(block["image_url"]["url"]) + content.append({"type": "image", "source": source}) continue if block["type"] == "tool_use": diff --git a/libs/vertexai/tests/unit_tests/test_anthropic_utils.py b/libs/vertexai/tests/unit_tests/test_anthropic_utils.py index 7f83bfb3..dafc193d 100644 --- a/libs/vertexai/tests/unit_tests/test_anthropic_utils.py +++ b/libs/vertexai/tests/unit_tests/test_anthropic_utils.py @@ -160,7 +160,7 @@ "role": "user", "content": [ { - "type": "image_url", + "type": "image", "source": { "type": "base64", "media_type": "image/png",