@@ -920,9 +920,11 @@ public static class Builder {
920920 private final String apiKey ;
921921
922922 // Optional fields
923+ private String host ;
923924 private String sourceTag ;
924925 private ProxyConfig proxyConfig ;
925926 private OkHttpClient customOkHttpClient ;
927+ private boolean enableTls = true ;
926928
927929 /**
928930 * Constructs a new {@link Builder} with the mandatory API key.
@@ -1023,6 +1025,16 @@ public Builder withProxy(String proxyHost, int proxyPort) {
10231025 return this ;
10241026 }
10251027
1028+ public Builder withHost (String host ) {
1029+ this .host = host ;
1030+ return this ;
1031+ }
1032+
1033+ public Builder withTlsEnabled (boolean enableTls ) {
1034+ this .enableTls = enableTls ;
1035+ return this ;
1036+ }
1037+
10261038 /**
10271039 * Builds and returns a {@link Pinecone} instance configured with the provided API key, optional source tag,
10281040 * and OkHttpClient.
@@ -1034,13 +1046,23 @@ public Builder withProxy(String proxyHost, int proxyPort) {
10341046 */
10351047 public Pinecone build () {
10361048 PineconeConfig config = new PineconeConfig (apiKey , sourceTag , proxyConfig , customOkHttpClient );
1049+ config .setTLSEnabled (enableTls );
10371050 config .validate ();
10381051
10391052 if (proxyConfig != null && customOkHttpClient != null ) {
10401053 throw new PineconeConfigurationException ("Invalid configuration: Both Custom OkHttpClient and Proxy are set. Please configure only one of these options." );
10411054 }
10421055
1043- ApiClient apiClient = (customOkHttpClient != null ) ? new ApiClient (customOkHttpClient ) : new ApiClient (buildOkHttpClient (proxyConfig ));
1056+ ApiClient apiClient ;
1057+ if (customOkHttpClient != null ) {
1058+ apiClient = new ApiClient (customOkHttpClient );
1059+ } else {
1060+ apiClient = new ApiClient (buildOkHttpClient (proxyConfig ));
1061+ if (host !=null && !host .isEmpty ()) {
1062+ config .setHost (host );
1063+ apiClient .setBasePath (host );
1064+ }
1065+ }
10441066 apiClient .setApiKey (config .getApiKey ());
10451067 apiClient .setUserAgent (config .getUserAgent ());
10461068 apiClient .addDefaultHeader ("X-Pinecone-Api-Version" , Configuration .VERSION );
0 commit comments