Skip to content

Commit a75c508

Browse files
committed
lint fix and add dependency version
1 parent ecc013e commit a75c508

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed

genai/pom.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,12 @@
3636
</dependency>
3737
</dependencies>
3838
</dependencyManagement>
39-
<!-- [START googlegenaisdk_install_with_bom] -->
4039
<dependencies>
4140
<dependency>
4241
<groupId>com.google.genai</groupId>
4342
<artifactId>google-genai</artifactId>
43+
<version>0.2.0</version>
4444
</dependency>
45-
<!-- [END googlegenaisdk_install_with_bom] -->
4645
<dependency>
4746
<groupId>junit</groupId>
4847
<artifactId>junit</artifactId>

genai/src/main/java/genai/text_generation/TextGeneration.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,23 @@
1717
package genai.text_generation;
1818

1919
// [START googlegenaisdk_textgen_with_txt]
20+
2021
import com.google.genai.Client;
2122
import com.google.genai.types.GenerateContentResponse;
2223
import java.io.IOException;
2324
import org.apache.http.HttpException;
2425

2526
public class TextGeneration {
27+
2628
public static void main(String[] args) throws IOException, HttpException {
2729
// TODO(Developer): Replace the below variables before running the sample.
2830
String modelId = "gemini-2.0-flash-001";
2931
String prompt = "How does AI work?";
3032
generateContent(modelId, prompt);
3133
}
3234

33-
public static String generateContent(String modelId, String prompt) throws HttpException, IOException {
35+
public static String generateContent(String modelId, String prompt)
36+
throws HttpException, IOException {
3437
// Initialize client that will be used to send requests. This client only needs to be created
3538
// once, and can be reused for multiple requests.
3639
try (Client client = new Client()) {

genai/src/test/java/genai/text_generation/TextGenerationIT.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
@RunWith(JUnit4.class)
3232
public class TextGenerationIT {
3333

34-
private String MODEL_ID="gemini-2.0-flash-001";
34+
private final String MODEL_ID = "gemini-2.0-flash-001";
3535

3636
// Check if the required environment variables are set.
3737
public static void requireEnvVar(String envVarName) {
@@ -42,10 +42,10 @@ public static void requireEnvVar(String envVarName) {
4242

4343
@BeforeClass
4444
public static void setUp() {
45-
requireEnvVar("GOOGLE_APPLICATION_CREDENTIALS");
46-
requireEnvVar("GOOGLE_CLOUD_PROJECT");
47-
requireEnvVar("GOOGLE_CLOUD_LOCATION");
48-
requireEnvVar("GOOGLE_GENAI_USE_VERTEXAI");
45+
requireEnvVar("GOOGLE_APPLICATION_CREDENTIALS");
46+
requireEnvVar("GOOGLE_CLOUD_PROJECT");
47+
requireEnvVar("GOOGLE_CLOUD_LOCATION");
48+
requireEnvVar("GOOGLE_GENAI_USE_VERTEXAI");
4949
}
5050

5151
@Test

0 commit comments

Comments
 (0)