Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(vertexai): Update to gemini-1.5-flash-001 #9344

Merged
merged 5 commits into from
May 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public static void main(String[] args) throws IOException {
// TODO(developer): Replace these variables before running the sample.
String projectId = "your-google-cloud-project-id";
String location = "us-central1";
String modelName = "gemini-1.5-pro-preview-0409";
String modelName = "gemini-1.5-flash-001";

summarizeAudio(projectId, location, modelName);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public static void main(String[] args) throws IOException {
// TODO(developer): Replace these variables before running the sample.
String projectId = "your-google-cloud-project-id";
String location = "us-central1";
String modelName = "gemini-1.5-pro-preview-0409";
String modelName = "gemini-1.5-flash-001";

transcribeAudio(projectId, location, modelName);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public static void main(String[] args) throws IOException {
// TODO(developer): Replace these variables before running the sample.
String projectId = "your-google-cloud-project-id";
String location = "us-central1";
String modelName = "gemini-1.5-pro-preview-0409";
String modelName = "gemini-1.5-flash-001";

multimodalAllInput(projectId, location, modelName);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public static void main(String[] args) throws IOException {
// TODO(developer): Replace these variables before running the sample.
String projectId = "your-google-cloud-project-id";
String location = "us-central1";
String modelName = "gemini-1.5-pro-preview-0409";
String modelName = "gemini-1.5-flash-001";

pdfInput(projectId, location, modelName);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public static void main(String[] args) throws IOException {
// TODO(developer): Replace these variables before running the sample.
String projectId = "your-google-cloud-project-id";
String location = "us-central1";
String modelName = "gemini-1.5-pro-preview-0409";
String modelName = "gemini-1.5-flash-001";

videoAudioInput(projectId, location, modelName);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public static void main(String[] args) throws Exception {
// TODO(developer): Replace these variables before running the sample.
String projectId = "your-google-cloud-project-id";
String location = "us-central1";
String modelName = "gemini-1.5-pro-preview-0409";
String modelName = "gemini-1.5-flash-001";

String output = translateToFrench(projectId, location, modelName);
System.out.println(output);
Expand Down
20 changes: 9 additions & 11 deletions vertexai/snippets/src/test/java/vertexai/gemini/SnippetsIT.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,11 @@
@RunWith(JUnit4.class)
public class SnippetsIT {

public static final String GEMINI_ULTRA_VISION = "gemini-1.0-ultra-vision";
private static final String PROJECT_ID = System.getenv("GOOGLE_CLOUD_PROJECT");
private static final String LOCATION = "us-central1";
private static final String GEMINI_PRO_VISION = "gemini-1.0-pro-vision-001";
private static final String GEMINI_PRO = "gemini-1.0-pro-002";
private static final String GEMINI_PRO_1_5 = "gemini-1.5-pro-preview-0409";
private static final String GEMINI_FLASH = "gemini-1.5-flash-001";
private static final int MAX_ATTEMPT_COUNT = 3;
private static final int INITIAL_BACKOFF_MILLIS = 120000; // 2 minutes

Expand Down Expand Up @@ -160,10 +159,9 @@ public void testMultimodalVideoInput() throws IOException {
assertThat(bout.toString()).contains("Zoo");
}

@Ignore("Don't test until ultra launch")
@Test
public void testMultiTurnMultimodal() throws IOException {
MultiTurnMultimodal.multiTurnMultimodal(PROJECT_ID, LOCATION, GEMINI_ULTRA_VISION);
MultiTurnMultimodal.multiTurnMultimodal(PROJECT_ID, LOCATION, GEMINI_FLASH);
assertThat(bout.toString()).contains("scones");
}

Expand Down Expand Up @@ -236,45 +234,45 @@ public void testFunctionCalling() throws Exception {

@Test
public void testAudioInputSummary() throws IOException {
String output = AudioInputSummarization.summarizeAudio(PROJECT_ID, LOCATION, GEMINI_PRO_1_5);
String output = AudioInputSummarization.summarizeAudio(PROJECT_ID, LOCATION, GEMINI_FLASH);

assertThat(output).ignoringCase().contains("Pixel");
assertThat(output).ignoringCase().contains("feature");
}

@Test
public void testAudioInputTranscription() throws IOException {
String output = AudioInputTranscription.transcribeAudio(PROJECT_ID, LOCATION, GEMINI_PRO_1_5);
String output = AudioInputTranscription.transcribeAudio(PROJECT_ID, LOCATION, GEMINI_FLASH);

assertThat(output).ignoringCase().contains("Pixel");
assertThat(output).ignoringCase().contains("feature");
}

@Test
public void testVideoAudioInput() throws IOException {
String output = VideoInputWithAudio.videoAudioInput(PROJECT_ID, LOCATION, GEMINI_PRO_1_5);
String output = VideoInputWithAudio.videoAudioInput(PROJECT_ID, LOCATION, GEMINI_FLASH);

assertThat(output).ignoringCase().contains("Pixel");
assertThat(output).ignoringCase().contains("Tokyo");
}

@Test
public void testAllModalityInputs() throws IOException {
String output = MultimodalAllInput.multimodalAllInput(PROJECT_ID, LOCATION, GEMINI_PRO_1_5);
String output = MultimodalAllInput.multimodalAllInput(PROJECT_ID, LOCATION, GEMINI_FLASH);

assertThat(output).ignoringCase().contains("0:49");
assertThat(output).ignoringCase().contains("0:4");
}

@Test
public void testPdfInput() throws IOException {
String output = PdfInput.pdfInput(PROJECT_ID, LOCATION, GEMINI_PRO_1_5);
String output = PdfInput.pdfInput(PROJECT_ID, LOCATION, GEMINI_FLASH);

assertThat(output).ignoringCase().contains("Gemini");
}

@Test
public void testSystemInstruction() throws Exception {
String output = WithSystemInstruction.translateToFrench(PROJECT_ID, LOCATION, GEMINI_PRO_1_5);
String output = WithSystemInstruction.translateToFrench(PROJECT_ID, LOCATION, GEMINI_FLASH);

assertThat(output).ignoringCase().contains("bagels");
assertThat(output).ignoringCase().contains("aime");
Expand Down