Skip to content

Commit 639bb34

Browse files
authored
Update changelogs, examples, and readme (#52)
## Problem Prepare for next java sdk release. ## Solution Updated changelogs, examples, and readme for 0.7.0 release. ## Type of Change - [ ] Bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) - [ ] This change requires a documentation update - [ ] Infrastructure change (CI configs, etc) - [X] Non-code change (docs, etc) - [ ] None of the above: (explain here) ## Test Plan NA
1 parent f28ce34 commit 639bb34

File tree

8 files changed

+40
-58
lines changed

8 files changed

+40
-58
lines changed

CHANGELOG.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,12 @@
22

33
[comment]: <> (When bumping [pc:VERSION_LATEST_RELEASE] create a new entry below)
44
### Unreleased version
5+
6+
### v0.7.0
57
- Add support to list indexes
68
- Add support to configure index
7-
- Add user-agent as a header
9+
- Add user-agent to the header
10+
- Add integration tests for data plane operations
811

912
### v0.6.0
1013
- Add async stub for data plane operations

README.md

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,30 +15,24 @@ Maven:
1515
<dependency>
1616
<groupId>io.pinecone</groupId>
1717
<artifactId>pinecone-client</artifactId>
18-
<version>0.2.3</version>
18+
<version>0.7.0</version>
1919
</dependency>
2020
```
2121

2222
[comment]: <> (^ [pc:VERSION_LATEST_RELEASE])
2323

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

2929
[comment]: <> (^ [pc:VERSION_LATEST_RELEASE])
3030

31-
Alternatively, you can use our standalone uberjar [pinecone-client-0.2.3-all.jar](https://repo1.maven.org/maven2/io/pinecone/pinecone-client/0.2.3/pinecone-client-0.2.3-all.jar), which bundles the pinecone client and all dependencies together inside a single jar. You can include this on your classpath like any 3rd party JAR without having to obtain the *pinecone-client* dependencies separately.
31+
Alternatively, you can use our standalone uberjar [pinecone-client-0.7.0-all.jar](https://repo1.maven.org/maven2/io/pinecone/pinecone-client/0.7.0/pinecone-client-0.7.0-all.jar), which bundles the pinecone client and all dependencies together inside a single jar. You can include this on your classpath like any 3rd party JAR without having to obtain the *pinecone-client* dependencies separately.
3232

3333
[comment]: <> (^ [pc:VERSION_LATEST_RELEASE])
3434

35-
## Features
36-
37-
The Java client doesn't support managing Pinecone services, only reading and writing from existing indices. To create or delete an index, use the Python client.
38-
3935

4036
## Examples
4137

42-
- The most basic example usage is in `src/test/java/io/pinecone/PineconeClientLiveIntegTest.java`, covering most basic operations.
43-
> [!NOTE]
44-
> The java-basic-mvn example is outdated.
38+
- The data and control plane operation examples can be found in `io/pinecone/integration` folder.

examples/java-basic-mvn/src/main/java/pineconeexamples/MinimalUpsertAndQueryExample.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ public static void main(String[] cliArgs) {
5353
.addAllValues(Floats.asList(5F, 3F, 1F))
5454
.build();
5555

56+
// Deprecated: use addValue() or addAllValues() instead of addVector() and addAllVectors() respectively
5657
UpsertRequest upsertRequest = UpsertRequest.newBuilder()
5758
.addVectors(v1)
5859
.addVectors(v2)

examples/java-basic-mvn/src/main/java/pineconeexamples/UpsertsAndQueriesConcurrentExample.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,8 @@ public static void main(String[] cliArgs) throws InterruptedException {
106106
}
107107

108108
try {
109+
// Deprecated: use addValue() or addAllValues() instead of addVector()
110+
// and addAllVectors() respectively
109111
UpsertRequest upsertRequest = UpsertRequest.newBuilder()
110112
.addAllVectors(vectors)
111113
.build();

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
pineconeClientVersion = 0.6.0
1+
pineconeClientVersion = 0.7.0

src/integration/java/io/pinecone/integration/controlPlane/ConfigureIndexTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package io.pinecone.integration.controlPlane;
22

33
import io.pinecone.PineconeClientConfig;
4-
import io.pinecone.PineconeClientLiveIntegTest;
4+
import io.pinecone.integration.dataplane.PineconeClientLiveIntegTest;
55
import io.pinecone.PineconeIndexOperationClient;
66
import io.pinecone.exceptions.PineconeBadRequestException;
77
import io.pinecone.exceptions.PineconeNotFoundException;

src/integration/java/io/pinecone/PineconeIndexOperationsClientIntegrationTest.java renamed to src/integration/java/io/pinecone/integration/controlPlane/CreateListAndDeleteIndexTest.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
package io.pinecone;
1+
package io.pinecone.integration.controlPlane;
22

3+
import io.pinecone.PineconeClientConfig;
4+
import io.pinecone.PineconeIndexOperationClient;
35
import io.pinecone.helpers.RandomStringBuilder;
46
import io.pinecone.model.CreateIndexRequest;
57
import io.pinecone.model.IndexMeta;
@@ -12,7 +14,7 @@
1214
import static org.junit.jupiter.api.Assertions.assertEquals;
1315
import static org.junit.jupiter.api.Assertions.assertNotNull;
1416

15-
public class PineconeIndexOperationsClientIntegrationTest {
17+
public class CreateListAndDeleteIndexTest {
1618
private PineconeIndexOperationClient pinecone;
1719

1820
@BeforeEach

src/integration/java/io/pinecone/PineconeClientLiveIntegTest.java renamed to src/integration/java/io/pinecone/integration/dataplane/PineconeClientLiveIntegTest.java

Lines changed: 23 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,39 @@
1-
package io.pinecone;
1+
package io.pinecone.integration.dataplane;
22

33
import com.google.common.primitives.Floats;
44
import com.google.protobuf.Struct;
55
import com.google.protobuf.Value;
6+
import io.pinecone.PineconeConnection;
67
import io.pinecone.helpers.RandomStringBuilder;
7-
import io.pinecone.model.IndexMeta;
88
import io.pinecone.proto.*;
9-
import org.junit.jupiter.api.BeforeEach;
9+
import org.junit.jupiter.api.BeforeAll;
1010
import org.junit.jupiter.api.Test;
1111
import org.slf4j.Logger;
1212
import org.slf4j.LoggerFactory;
1313

14+
import java.io.IOException;
1415
import java.util.ArrayList;
1516
import java.util.Arrays;
1617
import java.util.List;
1718

19+
import static io.pinecone.helpers.IndexManager.createIndexIfNotExistsDataPlane;
1820
import static org.hamcrest.MatcherAssert.assertThat;
1921
import static org.hamcrest.Matchers.equalTo;
2022
import static org.hamcrest.Matchers.notNullValue;
21-
import static org.junit.jupiter.api.Assertions.assertEquals;
2223

2324
public class PineconeClientLiveIntegTest {
2425

25-
public String indexName = "integ-test-sanity";
26-
2726
private static final Logger logger = LoggerFactory.getLogger(PineconeClientLiveIntegTest.class);
27+
private static VectorServiceGrpc.VectorServiceBlockingStub blockingStub;
2828

29-
private PineconeClient dataPlaneClient;
30-
private PineconeIndexOperationClient controlPlaneClient;
31-
32-
@BeforeEach
33-
public void setUp() {
34-
PineconeClientConfig config = new PineconeClientConfig()
35-
.withApiKey(System.getenv("PINECONE_API_KEY"))
36-
.withEnvironment(System.getenv("PINECONE_ENVIRONMENT"))
37-
.withServerSideTimeoutSec(10);
38-
39-
controlPlaneClient = new PineconeIndexOperationClient(config);
40-
dataPlaneClient = new PineconeClient(config);
29+
@BeforeAll
30+
public static void defineConfig() throws IOException, InterruptedException {
31+
PineconeConnection connection = createIndexIfNotExistsDataPlane(3);
32+
blockingStub = connection.getBlockingStub();
4133
}
4234

4335
@Test
44-
public void checkIndexSetup() throws Exception {
45-
IndexMeta indexMeta = controlPlaneClient.describeIndex(indexName);
46-
assertEquals(3, indexMeta.getDatabase().getDimension());
47-
}
48-
49-
@Test
50-
public void sanity() throws Exception {
51-
IndexMeta indexMeta = controlPlaneClient.describeIndex(indexName);
52-
String host = indexMeta.getStatus().getHost();
53-
PineconeConnection conn = dataPlaneClient.connect(
54-
new PineconeConnectionConfig()
55-
.withConnectionUrl("https://" + host));
56-
36+
public void sanity() {
5737
String namespace = RandomStringBuilder.build("ns", 8);
5838

5939
// upsert
@@ -76,7 +56,7 @@ public void sanity() throws Exception {
7656
.setNamespace(namespace)
7757
.build();
7858

79-
UpsertResponse upsertResponse = conn.getBlockingStub().upsert(request);
59+
UpsertResponse upsertResponse = blockingStub.upsert(request);
8060
logger.info("Put " + upsertResponse.getUpsertedCount() + " vectors into the index");
8161
assert (upsertResponse.getUpsertedCount() == 3);
8262

@@ -100,14 +80,14 @@ public void sanity() throws Exception {
10080
.addAllVectors(hybridVectors)
10181
.setNamespace(namespace)
10282
.build();
103-
UpsertResponse hybridResponse = conn.getBlockingStub().upsert(hybridRequest);
83+
UpsertResponse hybridResponse = blockingStub.upsert(hybridRequest);
10484
logger.info("Put " + hybridResponse.getUpsertedCount() + " vectors into the index");
10585
assert (hybridResponse.getUpsertedCount() == 3);
10686

10787
// fetch
10888
List<String> ids = Arrays.asList("v1", "v2");
10989
FetchRequest fetchRequest = FetchRequest.newBuilder().addAllIds(ids).setNamespace(namespace).build();
110-
FetchResponse fetchResponse = conn.getBlockingStub().fetch(fetchRequest);
90+
FetchResponse fetchResponse = blockingStub.fetch(fetchRequest);
11191
assert (fetchResponse.containsVectors("v1"));
11292

11393
// Updates vector v1's values to 10.0, 11.0, and 12.0 from 1.0, 2.0, and 3.0
@@ -116,9 +96,9 @@ public void sanity() throws Exception {
11696
.setNamespace(namespace)
11797
.addAllValues(Floats.asList(10F, 11F, 12F))
11898
.build();
119-
conn.getBlockingStub().update(updateRequest);
99+
blockingStub.update(updateRequest);
120100
fetchRequest = FetchRequest.newBuilder().addIds("v1").setNamespace(namespace).build();
121-
conn.getBlockingStub().fetch(fetchRequest);
101+
blockingStub.fetch(fetchRequest);
122102

123103
// DEPRECATED: all methods related to queries in QueryVector
124104
// Use methods related to Vector. Example: addVector, addAllVector, etc.
@@ -145,7 +125,7 @@ public void sanity() throws Exception {
145125
.setIncludeMetadata(true)
146126
.build();
147127

148-
QueryResponse queryResponse = conn.getBlockingStub().query(batchQueryRequest);
128+
QueryResponse queryResponse = blockingStub.query(batchQueryRequest);
149129
assertThat(queryResponse, notNullValue());
150130
assertThat(queryResponse.getResultsList(), notNullValue());
151131
assertThat(queryResponse.getResultsCount(), equalTo(1));
@@ -159,7 +139,7 @@ public void sanity() throws Exception {
159139
.build();
160140

161141
// When querying using a single vector, we get matches instead of results
162-
queryResponse = conn.getBlockingStub().query(queryRequest);
142+
queryResponse = blockingStub.query(queryRequest);
163143
assertThat(queryResponse, notNullValue());
164144
assertThat(queryResponse.getMatchesList(), notNullValue());
165145
assertThat(queryResponse.getMatchesCount(), equalTo(2));
@@ -172,7 +152,7 @@ public void sanity() throws Exception {
172152
.setIncludeMetadata(true)
173153
.build();
174154

175-
queryResponse = conn.getBlockingStub().query(queryByIdRequest);
155+
queryResponse = blockingStub.query(queryByIdRequest);
176156
assertThat(queryResponse, notNullValue());
177157
assertThat(queryResponse.getMatchesList(), notNullValue());
178158
assertThat(queryResponse.getMatchesCount(), equalTo(2));
@@ -185,9 +165,9 @@ public void sanity() throws Exception {
185165
.setDeleteAll(false)
186166
.build();
187167

188-
conn.getBlockingStub().delete(deleteRequest);
168+
blockingStub.delete(deleteRequest);
189169
fetchRequest = FetchRequest.newBuilder().addAllIds(ids).setNamespace(namespace).build();
190-
fetchResponse = conn.getBlockingStub().fetch(fetchRequest);
170+
fetchResponse = blockingStub.fetch(fetchRequest);
191171
assert (fetchResponse.getVectorsCount() == ids.size() - 1);
192172

193173
// Clear out the test
@@ -196,9 +176,9 @@ public void sanity() throws Exception {
196176
.setDeleteAll(true)
197177
.build();
198178

199-
conn.getBlockingStub().delete(deleteAllRequest);
179+
blockingStub.delete(deleteAllRequest);
200180
fetchRequest = FetchRequest.newBuilder().addAllIds(ids).setNamespace(namespace).build();
201-
fetchResponse = conn.getBlockingStub().fetch(fetchRequest);
181+
fetchResponse = blockingStub.fetch(fetchRequest);
202182
assert (fetchResponse.getVectorsCount() == 0);
203183
}
204184
}

0 commit comments

Comments
 (0)