From 92cba5d75984d2a3f6c645772a0e09043ec3e610 Mon Sep 17 00:00:00 2001 From: Mark Pollack Date: Sat, 21 Dec 2024 20:48:44 -0500 Subject: [PATCH] Fix VertexAiMultimodalEmbeddingModelIT test by separating documents The Document class requires exactly one of text or media to be specified. Updated textImageAndVideoEmbedding test to create separate Document instances for text, image, and video content instead of combining them in a single document. --- .../VertexAiMultimodalEmbeddingModelIT.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/models/spring-ai-vertex-ai-embedding/src/test/java/org/springframework/ai/vertexai/embedding/multimodal/VertexAiMultimodalEmbeddingModelIT.java b/models/spring-ai-vertex-ai-embedding/src/test/java/org/springframework/ai/vertexai/embedding/multimodal/VertexAiMultimodalEmbeddingModelIT.java index e6e37b78f..281ba1c0b 100644 --- a/models/spring-ai-vertex-ai-embedding/src/test/java/org/springframework/ai/vertexai/embedding/multimodal/VertexAiMultimodalEmbeddingModelIT.java +++ b/models/spring-ai-vertex-ai-embedding/src/test/java/org/springframework/ai/vertexai/embedding/multimodal/VertexAiMultimodalEmbeddingModelIT.java @@ -18,6 +18,7 @@ package org.springframework.ai.vertexai.embedding.multimodal; import java.net.MalformedURLException; import java.net.URI; +import java.util.List; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.condition.EnabledIfEnvironmentVariable; @@ -188,13 +189,19 @@ class VertexAiMultimodalEmbeddingModelIT { @Test void textImageAndVideoEmbedding() { - var document = Document.builder() + var textDocument = Document.builder() .text("Hello World") + .build(); + + var imageDocument = Document.builder() .media(new Media(MimeTypeUtils.IMAGE_PNG, new ClassPathResource("/test.image.png"))) + .build(); + + var videoDocument = Document.builder() .media(new Media(new MimeType("video", "mp4"), new ClassPathResource("/test.video.mp4"))) .build(); - DocumentEmbeddingRequest embeddingRequest = new DocumentEmbeddingRequest(document); + DocumentEmbeddingRequest embeddingRequest = new DocumentEmbeddingRequest(List.of(textDocument, imageDocument, videoDocument)); EmbeddingResponse embeddingResponse = this.multiModelEmbeddingModel.call(embeddingRequest); assertThat(embeddingResponse.getResults()).hasSize(3);