Skip to content

Commit e760980

Browse files
speedstorm1ed-irl
authored andcommitted
chore: Use call timeout for HttpOptions.timeout in Java GenAI SDK.
Co-authored-by: Edmund Kohlwey <ed@irl.llc> PiperOrigin-RevId: 828998640
1 parent 0dbdf2f commit e760980

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

src/main/java/com/google/genai/ApiClient.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ private OkHttpClient createHttpClient(
231231

232232
httpOptions
233233
.timeout()
234-
.ifPresent(connectTimeout -> builder.connectTimeout(Duration.ofMillis(connectTimeout)));
234+
.ifPresent(timeout -> builder.callTimeout(Duration.ofMillis(timeout)));
235235

236236
HttpRetryOptions retryOptions =
237237
httpOptions.retryOptions().orElse(HttpRetryOptions.builder().build());

src/test/java/com/google/genai/HttpApiClientTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -872,7 +872,7 @@ public void testHttpClientMLDevTimeout() throws Exception {
872872
OkHttpClient httpClient = client.httpClient();
873873
assertNotNull(httpClient);
874874

875-
assertEquals(5000, httpClient.connectTimeoutMillis());
875+
assertEquals(5000, httpClient.callTimeoutMillis());
876876
assertEquals(API_KEY, client.apiKey());
877877
assertFalse(client.vertexAI());
878878
}
@@ -892,7 +892,7 @@ public void testHttpClientVertexTimeout() throws Exception {
892892
OkHttpClient httpClient = client.httpClient();
893893
assertNotNull(httpClient);
894894

895-
assertEquals(4999, httpClient.connectTimeoutMillis());
895+
assertEquals(4999, httpClient.callTimeoutMillis());
896896
assertEquals(PROJECT, client.project());
897897
assertEquals(LOCATION, client.location());
898898
assertTrue(client.vertexAI());

0 commit comments

Comments
 (0)