Skip to content

Commit

Permalink
Fix VertexAiMultimodalEmbeddingModelIT test by separating documents
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Mark Pollack committed Dec 22, 2024
1 parent 86b155d commit 92cba5d
Showing 1 changed file with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

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;
Expand Down Expand Up @@ -188,13 +189,19 @@ void videoEmbedding() {
@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);
Expand Down

0 comments on commit 92cba5d

Please sign in to comment.