Skip to content
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 @@ -33,7 +33,7 @@ public static void main(String[] args) throws IOException {
// TODO(developer): Replace these variables before running the sample.
String projectId = "genai-java-demos";
String location = "us-central1";
String modelName = "gemini-2.0-flash-001";
String modelName = "gemini-2.5-flash";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

While this change correctly updates the model name, for improved maintainability and to avoid 'magic strings', consider defining modelName as a private static final String at the class level. This would centralize the model name definition and make future updates easier, especially since this pattern is repeated across multiple snippet files.


controlGenerationWithJsonSchema6(projectId, location, modelName);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,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-2.0-flash-001";
String modelName = "gemini-2.5-flash";

String promptText = "What's the weather like in Paris?";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,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-2.0-flash-001";
String modelName = "gemini-2.5-flash";

getMediaTokenCount(projectId, location, modelName);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,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-2.0-flash-001";
String modelName = "gemini-2.5-flash";

getTokenCount(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-2.0-flash-001";
String modelName = "gemini-2.5-flash";

String output = nonStreamingMultimodal(projectId, location, modelName);
System.out.println(output);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,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-2.0-flash-001";
String modelName = "gemini-2.5-flash";

String output = simpleQuestion(projectId, location, modelName);
System.out.println(output);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,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-2.0-flash-001";
String modelName = "gemini-2.5-flash";

String output = quickstart(projectId, location, modelName);
System.out.println(output);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,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-2.0-flash-001";
String modelName = "gemini-2.5-flash";

streamingMultimodal(projectId, location, modelName);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,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-2.0-flash-001";
String modelName = "gemini-2.5-flash";

streamingQuestion(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 IOException {
// TODO(developer): Replace these variables before running the sample.
String projectId = "your-google-cloud-project-id";
String location = "us-central1";
String modelName = "gemini-2.0-flash-001";
String modelName = "gemini-2.5-flash";
String textPrompt =
"What's a good name for a flower shop that specializes in selling bouquets of"
+ " dried flowers?";
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-2.0-flash-001";
String modelName = "gemini-2.5-flash";

videoAudioInput(projectId, location, modelName);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,9 @@ public class SnippetsIT {

private static final String PROJECT_ID = System.getenv("GOOGLE_CLOUD_PROJECT");
private static final String LOCATION = "us-central1";
private static final String GEMINI_FLASH = "gemini-2.0-flash-001";
private static final String GEMINI_FLASH_1_5 = "gemini-2.0-flash-001";
private static final String DATASTORE_ID = "grounding-test-datastore_1716831150046";
private static final String GEMINI_FLASH = "gemini-2.5-flash";
private static final int MAX_ATTEMPT_COUNT = 3;
private static final int INITIAL_BACKOFF_MILLIS = 120000;
private static final String TARGET_LANGUAGE_CODE = "fr";
private static final String TEXT_TO_TRANSLATE = "Hello! How are you doing today?";


// 2 minutes
Expand Down