From 3ffcfdc21517c7a73e0cc6d99bcbf712aad3861e Mon Sep 17 00:00:00 2001 From: Mark Pollack Date: Sat, 21 Dec 2024 21:15:46 -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. --- .../multimodal/VertexAiMultimodalEmbeddingModelIT.java | 7 +++---- 1 file changed, 3 insertions(+), 4 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 281ba1c0b..281c0cf19 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 @@ -189,9 +189,7 @@ class VertexAiMultimodalEmbeddingModelIT { @Test void textImageAndVideoEmbedding() { - var textDocument = Document.builder() - .text("Hello World") - .build(); + var textDocument = Document.builder().text("Hello World").build(); var imageDocument = Document.builder() .media(new Media(MimeTypeUtils.IMAGE_PNG, new ClassPathResource("/test.image.png"))) @@ -201,7 +199,8 @@ class VertexAiMultimodalEmbeddingModelIT { .media(new Media(new MimeType("video", "mp4"), new ClassPathResource("/test.video.mp4"))) .build(); - DocumentEmbeddingRequest embeddingRequest = new DocumentEmbeddingRequest(List.of(textDocument, imageDocument, videoDocument)); + DocumentEmbeddingRequest embeddingRequest = new DocumentEmbeddingRequest( + List.of(textDocument, imageDocument, videoDocument)); EmbeddingResponse embeddingResponse = this.multiModelEmbeddingModel.call(embeddingRequest); assertThat(embeddingResponse.getResults()).hasSize(3);