Skip to content

Commit 27ea488

Browse files
authored
Prep for release v2.1.0 and add proxy config & disabling TLS examples to README (#152)
## Problem - Prepare for releasing v2.1.0. - Added support proxy configuration and for disabling TLS, so add examples to the README. ## Solution - Update pinecone client version to `v2.1.0`. - Add proxy config and disabling TLS examples to README ## Type of Change - [X] Non-code change (docs, etc) ## Test Plan NA
1 parent c75a0df commit 27ea488

File tree

4 files changed

+85
-5
lines changed

4 files changed

+85
-5
lines changed

CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
[comment]: <> (When bumping [pc:VERSION_LATEST_RELEASE] create a new entry below)
44
### Unreleased version
5+
### 2.1.0
6+
- Add support to disable TLS for data plane operations
7+
58
### 2.0.0
69
- Add deletion protection
710

README.md

+80-3
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Maven:
2323

2424
Gradle:
2525
```
26-
implementation "io.pinecone:pinecone-client:1.2.2"
26+
implementation "io.pinecone:pinecone-client:2.0.0"
2727
```
2828

2929
[comment]: <> (^ [pc:VERSION_LATEST_RELEASE])
@@ -61,7 +61,11 @@ public class InitializeClientExample {
6161
}
6262
```
6363

64-
#### Passing OkHttpClient
64+
#### Passing OkHttpClient for control plane operations
65+
66+
If you need to provide a custom `OkHttpClient`, you can do so by using the `withOkHttpClient()` method of the
67+
`Pinecone.Builder` class to pass in your `OkHttpClient` object.
68+
6569
```java
6670
import io.pinecone.clients.Pinecone;
6771

@@ -79,14 +83,84 @@ public class InitializeClientExample {
7983
}
8084
```
8185

86+
#### Configuring HTTP proxy for both control and data plane operations
87+
88+
If your network setup requires you to interact with Pinecone via a proxy, you will need to pass additional
89+
configuration using the parameters `host` and `port` of the `ProxyConfig` class.
90+
91+
```java
92+
import io.pinecone.clients.Index;
93+
import io.pinecone.clients.Pinecone;
94+
import io.pinecone.proto.UpsertResponse;
95+
import io.pinecone.unsigned_indices_model.QueryResponseWithUnsignedIndices;
96+
import org.openapitools.control.client.model.IndexModel;
97+
98+
import java.util.Arrays;
99+
100+
public class ProxyExample {
101+
public static void main(String[] args) {
102+
String apiKey = "PINECONE_API_KEY";
103+
String proxyHost = "PROXY_HOST";
104+
int proxyPort = 8080; // Port can be configured based on your setup
105+
106+
Pinecone pinecone = new Pinecone.Builder(apiKey)
107+
.withProxy(proxyHost, proxyPort)
108+
.build();
109+
110+
// Control plane operation routed through the proxy server
111+
IndexModel indexModel = pinecone.describeIndex("PINECONE_INDEX");
112+
113+
// Data plane operations routed through the proxy server
114+
Index index = pinecone.getIndexConnection("PINECONE_INDEX_NAME");
115+
// 1. Upsert data
116+
UpsertResponse upsertResponse = index.upsert("v1", Arrays.asList(1F, 2F, 3F, 4F));
117+
// 2. Query vector
118+
QueryResponseWithUnsignedIndices queryResponse = index.queryByVectorId(1, "v1", true, true);
119+
}
120+
}
121+
```
122+
123+
#### Disabling SSL verification for data plane operations
124+
125+
If you would like to disable TLS verification for data plane operations, you can disable it by setting `enableTLS`
126+
parameter of `PineconeConfig` class to false. We do not recommend going to production with TLS verification disabled.
127+
128+
```java
129+
import io.pinecone.clients.Index;
130+
import io.pinecone.configs.PineconeConfig;
131+
import io.pinecone.configs.PineconeConnection;
132+
import io.pinecone.unsigned_indices_model.QueryResponseWithUnsignedIndices;
133+
import io.pinecone.proto.UpsertResponse;
134+
import java.util.Arrays;
135+
136+
public class DisableTLSExample {
137+
public static void main(String[] args) {
138+
PineconeConfig config = new PineconeConfig("api");
139+
config.setHost("localhost:5081");
140+
config.setTLSEnabled(false);
141+
PineconeConnection connection = new PineconeConnection(config);
142+
Index index = new Index(connection, "example-index");
143+
144+
// Data plane operations
145+
// 1. Upsert data
146+
UpsertResponse upsertResponse = index.upsert("v1", Arrays.asList(1f, 2f, 3f));
147+
// 2. Query data
148+
QueryResponseWithUnsignedIndices queryResponse = index.queryByVectorId(1, "v1", true, true);
149+
}
150+
}
151+
```
152+
82153
# Indexes
154+
83155
Operations related to the building and managing of Pinecone indexes are called [control plane](https://docs.pinecone.io/reference/api/introduction#control-plane) operations.
84156

85157
## Create Index
158+
86159
You can use the Java SDK to create two types of indexes: [serverless indexes](https://docs.pinecone.io/guides/indexes/understanding-indexes#serverless-indexes) (recommended for most use cases) and
87160
[pod-based indexes](https://docs.pinecone.io/guides/indexes/understanding-indexes#pod-based-indexes) (recommended for high-throughput use cases).
88161

89162
### Create a serverless index
163+
90164
The following is an example of creating a serverless index in the `us-west-2` region of AWS. For more information on
91165
serverless and regional availability, see [Understanding indexes](https://docs.pinecone.io/guides/indexes/understanding-indexes#serverless-indexes).
92166

@@ -109,6 +183,7 @@ IndexModel indexModel = pinecone.createServerlessIndex(indexName, similarityMetr
109183
```
110184

111185
### Create a pod index
186+
112187
The following is a minimal example of creating a pod-based index. For all the possible configuration options, see
113188
`main/java/io/pinecone/clients/Pinecone.java`.
114189

@@ -131,6 +206,7 @@ IndexModel indexModel = pinecone.createPodsIndex(indexName, dimension, environme
131206
```
132207

133208
### Create a pod index with deletion protection enabled
209+
134210
The following is an example of creating a pod-based index with deletion protection enabled. For all the possible
135211
configuration options, see `main/java/io/pinecone/clients/Pinecone.java`.
136212

@@ -150,7 +226,6 @@ String podType = "p1.x1";
150226
IndexModel indexModel = pinecone.createPodsIndex(indexName, dimension, environment, podType, DeletionProtection.ENABLED);
151227
```
152228

153-
154229
## List indexes
155230

156231
The following example returns all indexes (and their corresponding metadata) in your project.
@@ -369,6 +444,7 @@ FetchResponse fetchResponse = index.fetch(ids, "example-namespace");
369444
```
370445

371446
## List vector IDs
447+
372448
The following example lists up to 100 vector IDs from a Pinecone index.
373449

374450
This method accepts optional parameters for `namespace`, `prefix`, `limit`, and `paginationToken`.
@@ -407,6 +483,7 @@ UpdateResponse updateResponse = index.update("v1", values, "example-namespace");
407483
```
408484

409485
# Collections
486+
410487
Collections fall under data plane operations.
411488

412489
## Create collection

gradle.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
pineconeClientVersion = 2.0.0
1+
pineconeClientVersion = 2.1.0
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
package io.pinecone.commons;
22

33
public class Constants {
4-
public static final String pineconeClientVersion = "v2.0.0";
4+
public static final String pineconeClientVersion = "v2.1.0";
55
}

0 commit comments

Comments
 (0)