1919import static com .google .common .base .StandardSystemProperty .JAVA_VERSION ;
2020
2121import com .google .adk .Version ;
22- import com .google .adk .internal .http .HttpClientFactory ;
2322import com .google .common .collect .ImmutableList ;
2423import com .google .common .collect .ImmutableMap ;
2524import com .google .errorprone .annotations .CanIgnoreReturnValue ;
2625import com .google .genai .Client ;
2726import com .google .genai .ResponseStream ;
2827import com .google .genai .types .Candidate ;
29- import com .google .genai .types .ClientOptions ;
3028import com .google .genai .types .Content ;
3129import com .google .genai .types .FinishReason ;
3230import com .google .genai .types .FunctionCall ;
4442import java .util .Objects ;
4543import java .util .UUID ;
4644import java .util .concurrent .CompletableFuture ;
47- import okhttp3 .OkHttpClient ;
4845import org .jspecify .annotations .Nullable ;
4946import org .slf4j .Logger ;
5047import org .slf4j .LoggerFactory ;
@@ -59,8 +56,6 @@ public class Gemini extends BaseLlm {
5956
6057 private static final Logger logger = LoggerFactory .getLogger (Gemini .class );
6158 private static final ImmutableMap <String , String > TRACKING_HEADERS ;
62- private static final OkHttpClient SHARED_HTTP_CLIENT =
63- HttpClientFactory .createSharedHttpClient ("GeminiApiClient" );
6459
6560 static {
6661 String frameworkLabel = "google-adk/" + Version .JAVA_ADK_VERSION ;
@@ -99,7 +94,6 @@ public Gemini(String modelName, String apiKey) {
9994 Client .builder ()
10095 .apiKey (apiKey )
10196 .httpOptions (HttpOptions .builder ().headers (TRACKING_HEADERS ).build ())
102- .clientOptions (ClientOptions .builder ().customHttpClient (SHARED_HTTP_CLIENT ).build ())
10397 .build ();
10498 }
10599
@@ -113,9 +107,7 @@ public Gemini(String modelName, VertexCredentials vertexCredentials) {
113107 super (modelName );
114108 Objects .requireNonNull (vertexCredentials , "vertexCredentials cannot be null" );
115109 Client .Builder apiClientBuilder =
116- Client .builder ()
117- .httpOptions (HttpOptions .builder ().headers (TRACKING_HEADERS ).build ())
118- .clientOptions (ClientOptions .builder ().customHttpClient (SHARED_HTTP_CLIENT ).build ());
110+ Client .builder ().httpOptions (HttpOptions .builder ().headers (TRACKING_HEADERS ).build ());
119111 vertexCredentials .project ().ifPresent (apiClientBuilder ::project );
120112 vertexCredentials .location ().ifPresent (apiClientBuilder ::location );
121113 vertexCredentials .credentials ().ifPresent (apiClientBuilder ::credentials );
@@ -214,7 +206,6 @@ public Gemini build() {
214206 modelName ,
215207 Client .builder ()
216208 .httpOptions (HttpOptions .builder ().headers (TRACKING_HEADERS ).build ())
217- .clientOptions (ClientOptions .builder ().customHttpClient (SHARED_HTTP_CLIENT ).build ())
218209 .build ());
219210 }
220211 }
0 commit comments