Skip to content

Commit 6fcb3d2

Browse files
committed
Update README based on regenerated code (#164)
## Problem Regenerating the code based on new OAS caused changes in imports, so the examples in the README needs to be updated accordingly. ## Solution Changes include: 1. Updating import statements since inference is now broken out of control, so the paths for the openAPI generated model classes like `ApiException`, `IndexModel`, etc. were updated. 2. Import statement was missing for an example or two ## 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 No code changes so integration tests should run successfully.
1 parent 35ecac2 commit 6fcb3d2

File tree

1 file changed

+35
-26
lines changed

1 file changed

+35
-26
lines changed

README.md

+35-26
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ resources on idle pools. More details on the OkHttpClient can be found [here](ht
5555

5656
```java
5757
import io.pinecone.clients.Pinecone;
58-
import org.openapitools.client.model.*;
5958

6059
public class InitializeClientExample {
6160
public static void main(String[] args) {
@@ -71,6 +70,7 @@ If you need to provide a custom `OkHttpClient`, you can do so by using the `with
7170

7271
```java
7372
import io.pinecone.clients.Pinecone;
73+
import okhttp3.OkHttpClient;
7474

7575
public class InitializeClientExample {
7676
public static void main(String[] args) {
@@ -96,7 +96,7 @@ import io.pinecone.clients.Index;
9696
import io.pinecone.clients.Pinecone;
9797
import io.pinecone.proto.UpsertResponse;
9898
import io.pinecone.unsigned_indices_model.QueryResponseWithUnsignedIndices;
99-
import org.openapitools.control.client.model.IndexModel;
99+
import org.openapitools.db_control.client.model.IndexModel;
100100

101101
import java.util.Arrays;
102102

@@ -169,9 +169,8 @@ serverless and regional availability, see [Understanding indexes](https://docs.p
169169

170170
```java
171171
import io.pinecone.clients.Pinecone;
172-
import org.openapitools.client.model.IndexModel;
173-
import org.openapitools.control.client.model.DeletionProtection;
174-
172+
import org.openapitools.db_control.client.model.IndexModel;
173+
import org.openapitools.db_control.client.model.DeletionProtection;
175174
...
176175

177176
Pinecone pinecone = new Pinecone.Builder("PINECONE_API_KEY").build();
@@ -192,9 +191,7 @@ The following is a minimal example of creating a pod-based index. For all the po
192191

193192
```java
194193
import io.pinecone.clients.Pinecone;
195-
import org.openapitools.client.model.IndexModel;
196-
import org.openapitools.control.client.model.DeletionProtection;
197-
194+
import org.openapitools.db_control.client.model.IndexModel;
198195
...
199196

200197
Pinecone pinecone = new Pinecone.Builder("PINECONE_API_KEY").build();
@@ -235,7 +232,7 @@ The following example returns all indexes (and their corresponding metadata) in
235232

236233
```java
237234
import io.pinecone.clients.Pinecone;
238-
import org.openapitools.client.model.IndexList;
235+
import org.openapitools.db_control.client.model.IndexList;
239236
...
240237

241238
Pinecone pinecone = new Pinecone.Builder("PINECONE_API_KEY").build();
@@ -248,7 +245,7 @@ The following example returns metadata about an index.
248245

249246
```java
250247
import io.pinecone.clients.Pinecone;
251-
import org.openapitools.client.model.IndexModel;
248+
import org.openapitools.db_control.client.model.IndexModel;
252249
...
253250

254251
Pinecone pinecone = new Pinecone.Builder("PINECONE_API_KEY").build();
@@ -261,7 +258,8 @@ The following example deletes an index.
261258

262259
```java
263260
import io.pinecone.clients.Pinecone;
264-
261+
...
262+
265263
Pinecone pinecone = new Pinecone.Builder("PINECONE_API_KEY").build();
266264
pinecone.deleteIndex("example-index");
267265
```
@@ -274,16 +272,17 @@ Note: scaling replicas is only applicable to pod-based indexes.
274272

275273
```java
276274
import io.pinecone.clients.Pinecone;
277-
import org.openapitools.client.model.IndexModel;
275+
import org.openapitools.db_control.client.model.DeletionProtection;
278276
...
279277

280278
Pinecone pinecone = new Pinecone.Builder("PINECONE_API_KEY").build();
281279

282280
String indexName = "example-index";
283281
String podType = "p1.x1";
284282
int newNumberOfReplicas = 7;
285-
286-
pinecone.configurePodsIndex(indexName, podType, newNumberOfReplicas);
283+
DeletionProtection deletionProtection = DeletionProtection.DISABLED;
284+
285+
pinecone.configurePodsIndex(indexName, podType, newNumberOfReplicas, deletionProtection);
287286
```
288287

289288
## Enable deletion protection for pod index
@@ -292,11 +291,15 @@ The following example enables deletion protection for a pod-based index.
292291

293292
```java
294293
import io.pinecone.clients.Pinecone;
294+
import org.openapitools.db_control.client.model.DeletionProtection;
295295
...
296296

297297
Pinecone pinecone = new Pinecone.Builder("PINECONE_API_KEY").build();
298298

299-
pinecone.configurePodsIndex(indexName, DeletionProtection.ENABLED);
299+
String indexName = "example-index";
300+
DeletionProtection deletionProtection = DeletionProtection.ENABLED;
301+
302+
pinecone.configurePodsIndex(indexName, deletionProtection);
300303
```
301304

302305
## Enable deletion protection for serverless index
@@ -305,10 +308,12 @@ The following example enables deletion protection for a serverless index.
305308

306309
```java
307310
import io.pinecone.clients.Pinecone;
311+
import org.openapitools.db_control.client.model.DeletionProtection;
308312
...
309313

310314
Pinecone pinecone = new Pinecone.Builder("PINECONE_API_KEY").build();
311315

316+
String indexName = "example-index";
312317
pinecone.configureServerlessIndex(indexName, DeletionProtection.ENABLED);
313318
```
314319

@@ -320,7 +325,8 @@ The following example returns statistics about an index.
320325
import io.pinecone.clients.Index;
321326
import io.pinecone.clients.Pinecone;
322327
import io.pinecone.proto.DescribeIndexStatsResponse;
323-
328+
...
329+
324330
Pinecone pinecone = new Pinecone.Builder("PINECONE_API_KEY").build();
325331

326332
Index index = pinecone.getIndexConnection("example-index");
@@ -452,8 +458,8 @@ The following example lists up to 100 vector IDs from a Pinecone index.
452458

453459
This method accepts optional parameters for `namespace`, `prefix`, `limit`, and `paginationToken`.
454460

455-
The following
456-
demonstrates how to use the `list` endpoint to get vector IDs from a specific `namespace`, filtered by a given `prefix`.
461+
The following demonstrates how to use the `list` endpoint to get vector IDs from a specific `namespace`, filtered by a
462+
given `prefix`.
457463

458464
```java
459465
import io.pinecone.clients.Index;
@@ -466,7 +472,6 @@ Index index = pinecone.getIndexConnection(indexName);
466472
ListResponse listResponse = index.list("example-namespace", "prefix-");
467473
```
468474

469-
470475
## Update vectors
471476

472477
The following example updates vectors by ID.
@@ -496,7 +501,7 @@ The following example creates the collection `example-collection` from
496501

497502
```java
498503
import io.pinecone.clients.Pinecone;
499-
import org.openapitools.client.model.CollectionModel;
504+
import org.openapitools.db_control.client.model.CollectionModel;
500505
...
501506

502507
Pinecone pinecone = new Pinecone.Builder("PINECONE_API_KEY").build();
@@ -512,7 +517,7 @@ The following example returns a list of the collections in the current project.
512517

513518
```java
514519
import io.pinecone.clients.Pinecone;
515-
import org.openapitools.client.model.CollectionModel;
520+
import org.openapitools.db_control.client.model.CollectionModel;
516521
import java.util.List;
517522
...
518523

@@ -526,7 +531,7 @@ The following example returns a description of the collection
526531

527532
```java
528533
import io.pinecone.clients.Pinecone;
529-
import org.openapitools.client.model.CollectionModel;
534+
import org.openapitools.db_control.client.model.CollectionModel;
530535
...
531536

532537
Pinecone pinecone = new Pinecone.Builder("PINECONE_API_KEY").build();
@@ -550,10 +555,11 @@ pinecone.deleteCollection("example-collection");
550555
The Pinecone SDK now supports creating embeddings via the [Inference API](https://docs.pinecone.io/guides/inference/understanding-inference).
551556

552557
```java
558+
import io.pinecone.clients.Inference;
553559
import io.pinecone.clients.Pinecone;
554-
import org.openapitools.control.client.ApiException;
555-
import org.openapitools.control.client.model.Embedding;
556-
import org.openapitools.control.client.model.EmbeddingsList;
560+
import org.openapitools.inference.client.ApiException;
561+
import org.openapitools.inference.client.model.Embedding;
562+
import org.openapitools.inference.client.model.EmbeddingsList;
557563

558564
import java.util.ArrayList;
559565
import java.util.HashMap;
@@ -589,12 +595,15 @@ The following example shows how to rerank items according to their relevance to
589595
```java
590596
import io.pinecone.clients.Inference;
591597
import io.pinecone.clients.Pinecone;
598+
import org.openapitools.inference.client.ApiException;
592599
import org.openapitools.inference.client.model.RerankResult;
593600

594601
import java.util.*;
595-
596602
...
597603

604+
Pinecone pinecone = new Pinecone.Builder(System.getenv("PINECONE_API_KEY")).build();
605+
Inference inference = pinecone.getInferenceClient();
606+
598607
// The model to use for reranking
599608
String model = "bge-reranker-v2-m3";
600609

0 commit comments

Comments
 (0)