Skip to content

Commit 92cba5d

Browse files
committed
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.
1 parent 86b155d commit 92cba5d

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

models/spring-ai-vertex-ai-embedding/src/test/java/org/springframework/ai/vertexai/embedding/multimodal/VertexAiMultimodalEmbeddingModelIT.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
import java.net.MalformedURLException;
2020
import java.net.URI;
21+
import java.util.List;
2122

2223
import org.junit.jupiter.api.Test;
2324
import org.junit.jupiter.api.condition.EnabledIfEnvironmentVariable;
@@ -188,13 +189,19 @@ void videoEmbedding() {
188189
@Test
189190
void textImageAndVideoEmbedding() {
190191

191-
var document = Document.builder()
192+
var textDocument = Document.builder()
192193
.text("Hello World")
194+
.build();
195+
196+
var imageDocument = Document.builder()
193197
.media(new Media(MimeTypeUtils.IMAGE_PNG, new ClassPathResource("/test.image.png")))
198+
.build();
199+
200+
var videoDocument = Document.builder()
194201
.media(new Media(new MimeType("video", "mp4"), new ClassPathResource("/test.video.mp4")))
195202
.build();
196203

197-
DocumentEmbeddingRequest embeddingRequest = new DocumentEmbeddingRequest(document);
204+
DocumentEmbeddingRequest embeddingRequest = new DocumentEmbeddingRequest(List.of(textDocument, imageDocument, videoDocument));
198205

199206
EmbeddingResponse embeddingResponse = this.multiModelEmbeddingModel.call(embeddingRequest);
200207
assertThat(embeddingResponse.getResults()).hasSize(3);

0 commit comments

Comments
 (0)